{"action":"created","comment":{"url":"https://api.github.com/repos/assembl/assembl/pulls/comments/226323316","pull_request_review_id":165529463,"id":226323316,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjMyMzMxNg==","diff_hunk":"@@ -0,0 +1,73 @@\n+#!/bin/sh\n+\n+# This script try to connect to elastic search and access the DB\n+# return 0 if success / return 1 if error\n+\n+# exit if no parameter given\n+if [ \"$1\" == \"\" ]\n+then\n+    echo \"You should pass local.ini as argument\"\n+    exit 1\n+fi\n+\n+# parse elasticsearch_host from local.ini\n+elasticsearch_host=\"$(cat $1 | grep \"elasticsearch_host\")\"\n+elasticsearch_host=${elasticsearch_host// /}\n+elasticsearch_host=${elasticsearch_host//elasticsearch_host=/}\n+\n+# parse elasticsearch_port from local.ini\n+elasticsearch_port=\"$(cat $1 | grep \"elasticsearch_port\")\"\n+elasticsearch_port=${elasticsearch_port// /}\n+elasticsearch_port=${elasticsearch_port//elasticsearch_port=/}\n+\n+# parse elasticsearch_index from local.ini\n+elasticsearch_index=\"$(cat $1 | grep \"elasticsearch_index\")\"\n+elasticsearch_index=${elasticsearch_index// /}\n+elasticsearch_index=${elasticsearch_index//elasticsearch_index=/}\n+\n+# parse elasticsearch_version from local.ini\n+elasticsearch_version=\"$(cat $1 | grep \"elasticsearch_version\")\"\n+elasticsearch_version=${elasticsearch_version// /}\n+elasticsearch_version=${elasticsearch_version//elasticsearch_version=/}\n+\n+ELASTICSEARCH_URL=http://${elasticsearch_host}:${elasticsearch_port}\n+\n+CURL=\"$(curl --fail --silent --show-error ${ELASTICSEARCH_URL} 2>&1)\"\n+\n+# if curl didn't succeed \n+if [ $? != 0 ]\n+then\n+    echo \"Fail to connect to elatic search\"\n+    echo \"${CURL}\"\n+    exit 1\n+fi\n+\n+# clear line to keep cluster_name value only\n+CLUSTER_NAME=$(echo \"${CURL}\" | grep \"cluster_name\")\n+CLUSTER_NAME=${CLUSTER_NAME// /}\n+CLUSTER_NAME=${CLUSTER_NAME//\\\"/}\n+CLUSTER_NAME=${CLUSTER_NAME//cluster_name:/}\n+CLUSTER_NAME=${CLUSTER_NAME//,/}\n+\n+# clear line to keep version number value only\n+VERSION=$(echo \"${CURL}\" | grep \"number\")\n+VERSION=${VERSION// /}\n+VERSION=${VERSION//\\\"/}\n+VERSION=${VERSION//number:/}\n+VERSION=${VERSION//,/}\n+\n+# Check Elasticsearch cluster name and version\n+if ([ \"$CLUSTER_NAME\" != \"$elasticsearch_index\" ] || [ \"$VERSION\" != \"$elasticsearch_version\" ])\n+then\n+    exit 1\n+fi\n+\n+# Check if database is accessible\n+psql -Uassembl assembl -c \"SELECT * FROM pg_catalog.pg_tables\" &> /dev/null","path":"script/check_elasticsearch.sh","position":null,"original_position":66,"commit_id":"898d35473f167c6327886f9c596c5b96c190cc16","original_commit_id":"d6882cf2bef343a0552dacd746c90fefab82456c","user":{"login":"ayyazdaniaryan","id":1242841,"node_id":"MDQ6VXNlcjEyNDI4NDE=","avatar_url":"https://avatars2.githubusercontent.com/u/1242841?v=4","gravatar_id":"","url":"https://api.github.com/users/ayyazdaniaryan","html_url":"https://github.com/ayyazdaniaryan","followers_url":"https://api.github.com/users/ayyazdaniaryan/followers","following_url":"https://api.github.com/users/ayyazdaniaryan/following{/other_user}","gists_url":"https://api.github.com/users/ayyazdaniaryan/gists{/gist_id}","starred_url":"https://api.github.com/users/ayyazdaniaryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ayyazdaniaryan/subscriptions","organizations_url":"https://api.github.com/users/ayyazdaniaryan/orgs","repos_url":"https://api.github.com/users/ayyazdaniaryan/repos","events_url":"https://api.github.com/users/ayyazdaniaryan/events{/privacy}","received_events_url":"https://api.github.com/users/ayyazdaniaryan/received_events","type":"User","site_admin":false},"body":"Actually, let's make sure that it's not empty, eh? So, we test the connection, could be good, but let's make sure that the result of the psql command return non-empty list of rows?\r\n\r\n- So, firstly, add a semicolon at end of command to execute.\r\n- Next, let's clean up the output and only use the parts of the table that are created by Assembl\r\n- Then count the number of lines\r\n\r\nIn effect, something like this:\r\n```suggestion\r\npsql -Uassembl assembl -c \"SELECT * FROM pg_catalog.pg_tables;\" | grep public | wc -l | tr -d ' '\r\n```","created_at":"2018-10-18T14:17:03Z","updated_at":"2018-10-18T14:19:00Z","html_url":"https://github.com/assembl/assembl/pull/558#discussion_r226323316","pull_request_url":"https://api.github.com/repos/assembl/assembl/pulls/558","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/assembl/assembl/pulls/comments/226323316"},"html":{"href":"https://github.com/assembl/assembl/pull/558#discussion_r226323316"},"pull_request":{"href":"https://api.github.com/repos/assembl/assembl/pulls/558"}}},"pull_request":{"url":"https://api.github.com/repos/assembl/assembl/pulls/558","id":222843487,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyODQzNDg3","html_url":"https://github.com/assembl/assembl/pull/558","diff_url":"https://github.com/assembl/assembl/pull/558.diff","patch_url":"https://github.com/assembl/assembl/pull/558.patch","issue_url":"https://api.github.com/repos/assembl/assembl/issues/558","number":558,"state":"open","locked":false,"title":"Add script to check if Elasticsearch and database are accessible","user":{"login":"victorneuret","id":34629981,"node_id":"MDQ6VXNlcjM0NjI5OTgx","avatar_url":"https://avatars2.githubusercontent.com/u/34629981?v=4","gravatar_id":"","url":"https://api.github.com/users/victorneuret","html_url":"https://github.com/victorneuret","followers_url":"https://api.github.com/users/victorneuret/followers","following_url":"https://api.github.com/users/victorneuret/following{/other_user}","gists_url":"https://api.github.com/users/victorneuret/gists{/gist_id}","starred_url":"https://api.github.com/users/victorneuret/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/victorneuret/subscriptions","organizations_url":"https://api.github.com/users/victorneuret/orgs","repos_url":"https://api.github.com/users/victorneuret/repos","events_url":"https://api.github.com/users/victorneuret/events{/privacy}","received_events_url":"https://api.github.com/users/victorneuret/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-15T09:46:08Z","updated_at":"2018-10-18T14:18:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6edad95fd96cba25aba001b2ea0d0054e5125b43","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/assembl/assembl/pulls/558/commits","review_comments_url":"https://api.github.com/repos/assembl/assembl/pulls/558/comments","review_comment_url":"https://api.github.com/repos/assembl/assembl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/assembl/assembl/issues/558/comments","statuses_url":"https://api.github.com/repos/assembl/assembl/statuses/898d35473f167c6327886f9c596c5b96c190cc16","head":{"label":"assembl:elasticsearch-check-script","ref":"elasticsearch-check-script","sha":"898d35473f167c6327886f9c596c5b96c190cc16","user":{"login":"assembl","id":20449542,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNDQ5NTQy","avatar_url":"https://avatars3.githubusercontent.com/u/20449542?v=4","gravatar_id":"","url":"https://api.github.com/users/assembl","html_url":"https://github.com/assembl","followers_url":"https://api.github.com/users/assembl/followers","following_url":"https://api.github.com/users/assembl/following{/other_user}","gists_url":"https://api.github.com/users/assembl/gists{/gist_id}","starred_url":"https://api.github.com/users/assembl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/assembl/subscriptions","organizations_url":"https://api.github.com/users/assembl/orgs","repos_url":"https://api.github.com/users/assembl/repos","events_url":"https://api.github.com/users/assembl/events{/privacy}","received_events_url":"https://api.github.com/users/assembl/received_events","type":"Organization","site_admin":false},"repo":{"id":18962634,"node_id":"MDEwOlJlcG9zaXRvcnkxODk2MjYzNA==","name":"assembl","full_name":"assembl/assembl","private":false,"owner":{"login":"assembl","id":20449542,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNDQ5NTQy","avatar_url":"https://avatars3.githubusercontent.com/u/20449542?v=4","gravatar_id":"","url":"https://api.github.com/users/assembl","html_url":"https://github.com/assembl","followers_url":"https://api.github.com/users/assembl/followers","following_url":"https://api.github.com/users/assembl/following{/other_user}","gists_url":"https://api.github.com/users/assembl/gists{/gist_id}","starred_url":"https://api.github.com/users/assembl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/assembl/subscriptions","organizations_url":"https://api.github.com/users/assembl/orgs","repos_url":"https://api.github.com/users/assembl/repos","events_url":"https://api.github.com/users/assembl/events{/privacy}","received_events_url":"https://api.github.com/users/assembl/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/assembl/assembl","description":"Assembl is an online debate and synthesis platform","fork":false,"url":"https://api.github.com/repos/assembl/assembl","forks_url":"https://api.github.com/repos/assembl/assembl/forks","keys_url":"https://api.github.com/repos/assembl/assembl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/assembl/assembl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/assembl/assembl/teams","hooks_url":"https://api.github.com/repos/assembl/assembl/hooks","issue_events_url":"https://api.github.com/repos/assembl/assembl/issues/events{/number}","events_url":"https://api.github.com/repos/assembl/assembl/events","assignees_url":"https://api.github.com/repos/assembl/assembl/assignees{/user}","branches_url":"https://api.github.com/repos/assembl/assembl/branches{/branch}","tags_url":"https://api.github.com/repos/assembl/assembl/tags","blobs_url":"https://api.github.com/repos/assembl/assembl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/assembl/assembl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/assembl/assembl/git/refs{/sha}","trees_url":"https://api.github.com/repos/assembl/assembl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/assembl/assembl/statuses/{sha}","languages_url":"https://api.github.com/repos/assembl/assembl/languages","stargazers_url":"https://api.github.com/repos/assembl/assembl/stargazers","contributors_url":"https://api.github.com/repos/assembl/assembl/contributors","subscribers_url":"https://api.github.com/repos/assembl/assembl/subscribers","subscription_url":"https://api.github.com/repos/assembl/assembl/subscription","commits_url":"https://api.github.com/repos/assembl/assembl/commits{/sha}","git_commits_url":"https://api.github.com/repos/assembl/assembl/git/commits{/sha}","comments_url":"https://api.github.com/repos/assembl/assembl/comments{/number}","issue_comment_url":"https://api.github.com/repos/assembl/assembl/issues/comments{/number}","contents_url":"https://api.github.com/repos/assembl/assembl/contents/{+path}","compare_url":"https://api.github.com/repos/assembl/assembl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/assembl/assembl/merges","archive_url":"https://api.github.com/repos/assembl/assembl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/assembl/assembl/downloads","issues_url":"https://api.github.com/repos/assembl/assembl/issues{/number}","pulls_url":"https://api.github.com/repos/assembl/assembl/pulls{/number}","milestones_url":"https://api.github.com/repos/assembl/assembl/milestones{/number}","notifications_url":"https://api.github.com/repos/assembl/assembl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/assembl/assembl/labels{/name}","releases_url":"https://api.github.com/repos/assembl/assembl/releases{/id}","deployments_url":"https://api.github.com/repos/assembl/assembl/deployments","created_at":"2014-04-20T10:52:11Z","updated_at":"2018-10-18T08:31:03Z","pushed_at":"2018-10-18T14:00:42Z","git_url":"git://github.com/assembl/assembl.git","ssh_url":"git@github.com:assembl/assembl.git","clone_url":"https://github.com/assembl/assembl.git","svn_url":"https://github.com/assembl/assembl","homepage":"http://assembl.bluenove.com","size":80288,"stargazers_count":87,"watchers_count":87,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"open_issues_count":25,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":30,"open_issues":25,"watchers":87,"default_branch":"develop"}},"base":{"label":"assembl:develop","ref":"develop","sha":"997a892bbd7b5965c21cd7d0e0d733224b91c096","user":{"login":"assembl","id":20449542,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNDQ5NTQy","avatar_url":"https://avatars3.githubusercontent.com/u/20449542?v=4","gravatar_id":"","url":"https://api.github.com/users/assembl","html_url":"https://github.com/assembl","followers_url":"https://api.github.com/users/assembl/followers","following_url":"https://api.github.com/users/assembl/following{/other_user}","gists_url":"https://api.github.com/users/assembl/gists{/gist_id}","starred_url":"https://api.github.com/users/assembl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/assembl/subscriptions","organizations_url":"https://api.github.com/users/assembl/orgs","repos_url":"https://api.github.com/users/assembl/repos","events_url":"https://api.github.com/users/assembl/events{/privacy}","received_events_url":"https://api.github.com/users/assembl/received_events","type":"Organization","site_admin":false},"repo":{"id":18962634,"node_id":"MDEwOlJlcG9zaXRvcnkxODk2MjYzNA==","name":"assembl","full_name":"assembl/assembl","private":false,"owner":{"login":"assembl","id":20449542,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNDQ5NTQy","avatar_url":"https://avatars3.githubusercontent.com/u/20449542?v=4","gravatar_id":"","url":"https://api.github.com/users/assembl","html_url":"https://github.com/assembl","followers_url":"https://api.github.com/users/assembl/followers","following_url":"https://api.github.com/users/assembl/following{/other_user}","gists_url":"https://api.github.com/users/assembl/gists{/gist_id}","starred_url":"https://api.github.com/users/assembl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/assembl/subscriptions","organizations_url":"https://api.github.com/users/assembl/orgs","repos_url":"https://api.github.com/users/assembl/repos","events_url":"https://api.github.com/users/assembl/events{/privacy}","received_events_url":"https://api.github.com/users/assembl/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/assembl/assembl","description":"Assembl is an online debate and synthesis platform","fork":false,"url":"https://api.github.com/repos/assembl/assembl","forks_url":"https://api.github.com/repos/assembl/assembl/forks","keys_url":"https://api.github.com/repos/assembl/assembl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/assembl/assembl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/assembl/assembl/teams","hooks_url":"https://api.github.com/repos/assembl/assembl/hooks","issue_events_url":"https://api.github.com/repos/assembl/assembl/issues/events{/number}","events_url":"https://api.github.com/repos/assembl/assembl/events","assignees_url":"https://api.github.com/repos/assembl/assembl/assignees{/user}","branches_url":"https://api.github.com/repos/assembl/assembl/branches{/branch}","tags_url":"https://api.github.com/repos/assembl/assembl/tags","blobs_url":"https://api.github.com/repos/assembl/assembl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/assembl/assembl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/assembl/assembl/git/refs{/sha}","trees_url":"https://api.github.com/repos/assembl/assembl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/assembl/assembl/statuses/{sha}","languages_url":"https://api.github.com/repos/assembl/assembl/languages","stargazers_url":"https://api.github.com/repos/assembl/assembl/stargazers","contributors_url":"https://api.github.com/repos/assembl/assembl/contributors","subscribers_url":"https://api.github.com/repos/assembl/assembl/subscribers","subscription_url":"https://api.github.com/repos/assembl/assembl/subscription","commits_url":"https://api.github.com/repos/assembl/assembl/commits{/sha}","git_commits_url":"https://api.github.com/repos/assembl/assembl/git/commits{/sha}","comments_url":"https://api.github.com/repos/assembl/assembl/comments{/number}","issue_comment_url":"https://api.github.com/repos/assembl/assembl/issues/comments{/number}","contents_url":"https://api.github.com/repos/assembl/assembl/contents/{+path}","compare_url":"https://api.github.com/repos/assembl/assembl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/assembl/assembl/merges","archive_url":"https://api.github.com/repos/assembl/assembl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/assembl/assembl/downloads","issues_url":"https://api.github.com/repos/assembl/assembl/issues{/number}","pulls_url":"https://api.github.com/repos/assembl/assembl/pulls{/number}","milestones_url":"https://api.github.com/repos/assembl/assembl/milestones{/number}","notifications_url":"https://api.github.com/repos/assembl/assembl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/assembl/assembl/labels{/name}","releases_url":"https://api.github.com/repos/assembl/assembl/releases{/id}","deployments_url":"https://api.github.com/repos/assembl/assembl/deployments","created_at":"2014-04-20T10:52:11Z","updated_at":"2018-10-18T08:31:03Z","pushed_at":"2018-10-18T14:00:42Z","git_url":"git://github.com/assembl/assembl.git","ssh_url":"git@github.com:assembl/assembl.git","clone_url":"https://github.com/assembl/assembl.git","svn_url":"https://github.com/assembl/assembl","homepage":"http://assembl.bluenove.com","size":80288,"stargazers_count":87,"watchers_count":87,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"open_issues_count":25,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":30,"open_issues":25,"watchers":87,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/assembl/assembl/pulls/558"},"html":{"href":"https://github.com/assembl/assembl/pull/558"},"issue":{"href":"https://api.github.com/repos/assembl/assembl/issues/558"},"comments":{"href":"https://api.github.com/repos/assembl/assembl/issues/558/comments"},"review_comments":{"href":"https://api.github.com/repos/assembl/assembl/pulls/558/comments"},"review_comment":{"href":"https://api.github.com/repos/assembl/assembl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/assembl/assembl/pulls/558/commits"},"statuses":{"href":"https://api.github.com/repos/assembl/assembl/statuses/898d35473f167c6327886f9c596c5b96c190cc16"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ayyazdaniaryan"}}