{"action":"created","comment":{"url":"https://api.github.com/repos/alexkravets/venice/pulls/comments/48440714","id":48440714,"diff_hunk":"@@ -0,0 +1,263 @@\n+#!/bin/sh\n+\n+# On Server\n+# -------------------------------------------------\n+GIT_URL=\"$1\"\n+HOST=\"$2\"\n+MONGO_PASS=$(date +%s | sha256sum | base64 | head -c 32 ; echo)\n+\n+sudo apt-get update\n+sudo apt-get -y install language-pack-UTF-8\n+sudo apt-get -y install libgmp3-dev\n+sudo apt-get -y install imagemagick\n+sudo apt-get -y install git-core\n+sudo apt-get -y install nodejs\n+\n+## MongoDB 3\n+# Add public key:\n+sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10\n+# Create a list file for MongoDB:\n+echo \"deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse\" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list\n+# ​Reload local package database:\n+sudo apt-get update\n+echo \"Installing Mongo DB\"\n+sudo apt-get install -y mongodb-org\n+export LC_ALL=C\n+# Create `rails` mongodb user in venice db:\n+mongo --eval \"conn = new Mongo(); db = conn.getDB('venice'); db.createUser({user:'rails', pwd:'$MONGO_PASS', roles:['readWrite']})\"\n+\n+adduser rails --gecos \"First Last,RoomNumber,WorkPhone,HomePhone\" --disabled-password\n+\n+# Clone git\n+cd ~rails\n+git clone $GIT_URL rails_project\n+cd ~rails/rails_project\n+# Fetch ruby version\n+RUBY_VERSION=$(grep 'ruby ' Gemfile | cut -d '\"' -f 2)\n+\n+## Install RVM\n+gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3\n+curl -L get.rvm.io | bash -s stable\n+source /usr/local/rvm/scripts/rvm\n+rvm requirements\n+rvm install $RUBY_VERSION\n+rvm use $RUBY_VERSION --default\n+rvm rubygems current\n+\n+gem install bundler\n+bundle install\n+## Compile assets:\n+bundle exec rake assets:precompile\n+\n+chown -R rails: /home/rails/rails_project\n+\n+## Setup Nginx\n+# --------------------------------------------------------------\n+sudo apt-get -y install nginx\n+cat <<EOT >> /etc/nginx/sites-available/rails\n+upstream app_server {\n+    server unix:/var/run/unicorn.sock fail_timeout=0;\n+}\n+\n+server {\n+    listen   80;\n+    root /home/rails/rails_project/public;\n+    server_name _;\n+    index index.htm index.html;\n+\n+    location / {\n+            try_files \\$uri/index.html \\$uri.html \\$uri @app;\n+    }\n+\n+    location ~* ^.+\\.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|flv|mpeg|avi)\\$ {\n+                    try_files \\$uri @app;\n+            }\n+\n+     location @app {\n+            proxy_set_header X-Forwarded-For \\$proxy_add_x_forwarded_for;\n+            proxy_set_header Host \\$http_host;\n+            proxy_redirect off;\n+            proxy_pass http://app_server;\n+    }\n+}\n+EOT\n+rm /etc/nginx/sites-enabled/default\n+ln -s /etc/nginx/sites-available/rails /etc/nginx/sites-enabled/rails\n+# --------------------------------------------------------------\n+\n+## Unicorn\n+# --------------------------------------------------------------\n+mkdir /var/log/unicorn/\n+cat <<EOT >> /etc/unicorn.conf\n+listen \"unix:/var/run/unicorn.sock\"\n+worker_processes 4\n+user \"rails\"\n+working_directory \"/home/rails/rails_project\"\n+pid \"/var/run/unicorn.pid\"\n+stderr_path \"/var/log/unicorn/unicorn.log\"\n+stdout_path \"/var/log/unicorn/unicorn.log\"\n+EOT\n+\n+SECRET_KEY_BASE=$(rake -f /home/rails/rails_project/Rakefile secret)\n+cat <<EOT >> /var/rails_vars","path":"bin/do/setup","position":102,"original_position":102,"commit_id":"db5dfcf94eca18db5c6ea4f7fdff960338ff0460","original_commit_id":"db5dfcf94eca18db5c6ea4f7fdff960338ff0460","user":{"login":"alexkravets","id":477851,"avatar_url":"https://avatars.githubusercontent.com/u/477851?v=3","gravatar_id":"","url":"https://api.github.com/users/alexkravets","html_url":"https://github.com/alexkravets","followers_url":"https://api.github.com/users/alexkravets/followers","following_url":"https://api.github.com/users/alexkravets/following{/other_user}","gists_url":"https://api.github.com/users/alexkravets/gists{/gist_id}","starred_url":"https://api.github.com/users/alexkravets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexkravets/subscriptions","organizations_url":"https://api.github.com/users/alexkravets/orgs","repos_url":"https://api.github.com/users/alexkravets/repos","events_url":"https://api.github.com/users/alexkravets/events{/privacy}","received_events_url":"https://api.github.com/users/alexkravets/received_events","type":"User","site_admin":false},"body":"Let's put this file to /etc/default/rails_project.","created_at":"2015-12-25T14:29:36Z","updated_at":"2015-12-25T14:29:36Z","html_url":"https://github.com/alexkravets/venice/pull/3#discussion_r48440714","pull_request_url":"https://api.github.com/repos/alexkravets/venice/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/alexkravets/venice/pulls/comments/48440714"},"html":{"href":"https://github.com/alexkravets/venice/pull/3#discussion_r48440714"},"pull_request":{"href":"https://api.github.com/repos/alexkravets/venice/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/alexkravets/venice/pulls/3","id":54587948,"html_url":"https://github.com/alexkravets/venice/pull/3","diff_url":"https://github.com/alexkravets/venice/pull/3.diff","patch_url":"https://github.com/alexkravets/venice/pull/3.patch","issue_url":"https://api.github.com/repos/alexkravets/venice/issues/3","number":3,"state":"open","locked":false,"title":"Feature/dp setup do","user":{"login":"DenisPopov15","id":10959252,"avatar_url":"https://avatars.githubusercontent.com/u/10959252?v=3","gravatar_id":"","url":"https://api.github.com/users/DenisPopov15","html_url":"https://github.com/DenisPopov15","followers_url":"https://api.github.com/users/DenisPopov15/followers","following_url":"https://api.github.com/users/DenisPopov15/following{/other_user}","gists_url":"https://api.github.com/users/DenisPopov15/gists{/gist_id}","starred_url":"https://api.github.com/users/DenisPopov15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenisPopov15/subscriptions","organizations_url":"https://api.github.com/users/DenisPopov15/orgs","repos_url":"https://api.github.com/users/DenisPopov15/repos","events_url":"https://api.github.com/users/DenisPopov15/events{/privacy}","received_events_url":"https://api.github.com/users/DenisPopov15/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-25T14:02:41Z","updated_at":"2015-12-25T14:29:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e009ffc23ab75eda8e92a0bfcd95fc7dbc263fee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alexkravets/venice/pulls/3/commits","review_comments_url":"https://api.github.com/repos/alexkravets/venice/pulls/3/comments","review_comment_url":"https://api.github.com/repos/alexkravets/venice/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alexkravets/venice/issues/3/comments","statuses_url":"https://api.github.com/repos/alexkravets/venice/statuses/db5dfcf94eca18db5c6ea4f7fdff960338ff0460","head":{"label":"DenisPopov15:feature/dp-setup-do","ref":"feature/dp-setup-do","sha":"db5dfcf94eca18db5c6ea4f7fdff960338ff0460","user":{"login":"DenisPopov15","id":10959252,"avatar_url":"https://avatars.githubusercontent.com/u/10959252?v=3","gravatar_id":"","url":"https://api.github.com/users/DenisPopov15","html_url":"https://github.com/DenisPopov15","followers_url":"https://api.github.com/users/DenisPopov15/followers","following_url":"https://api.github.com/users/DenisPopov15/following{/other_user}","gists_url":"https://api.github.com/users/DenisPopov15/gists{/gist_id}","starred_url":"https://api.github.com/users/DenisPopov15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenisPopov15/subscriptions","organizations_url":"https://api.github.com/users/DenisPopov15/orgs","repos_url":"https://api.github.com/users/DenisPopov15/repos","events_url":"https://api.github.com/users/DenisPopov15/events{/privacy}","received_events_url":"https://api.github.com/users/DenisPopov15/received_events","type":"User","site_admin":false},"repo":{"id":48364858,"name":"venice","full_name":"DenisPopov15/venice","owner":{"login":"DenisPopov15","id":10959252,"avatar_url":"https://avatars.githubusercontent.com/u/10959252?v=3","gravatar_id":"","url":"https://api.github.com/users/DenisPopov15","html_url":"https://github.com/DenisPopov15","followers_url":"https://api.github.com/users/DenisPopov15/followers","following_url":"https://api.github.com/users/DenisPopov15/following{/other_user}","gists_url":"https://api.github.com/users/DenisPopov15/gists{/gist_id}","starred_url":"https://api.github.com/users/DenisPopov15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenisPopov15/subscriptions","organizations_url":"https://api.github.com/users/DenisPopov15/orgs","repos_url":"https://api.github.com/users/DenisPopov15/repos","events_url":"https://api.github.com/users/DenisPopov15/events{/privacy}","received_events_url":"https://api.github.com/users/DenisPopov15/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DenisPopov15/venice","description":"Personal website platform where art meets technology.","fork":true,"url":"https://api.github.com/repos/DenisPopov15/venice","forks_url":"https://api.github.com/repos/DenisPopov15/venice/forks","keys_url":"https://api.github.com/repos/DenisPopov15/venice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DenisPopov15/venice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DenisPopov15/venice/teams","hooks_url":"https://api.github.com/repos/DenisPopov15/venice/hooks","issue_events_url":"https://api.github.com/repos/DenisPopov15/venice/issues/events{/number}","events_url":"https://api.github.com/repos/DenisPopov15/venice/events","assignees_url":"https://api.github.com/repos/DenisPopov15/venice/assignees{/user}","branches_url":"https://api.github.com/repos/DenisPopov15/venice/branches{/branch}","tags_url":"https://api.github.com/repos/DenisPopov15/venice/tags","blobs_url":"https://api.github.com/repos/DenisPopov15/venice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DenisPopov15/venice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DenisPopov15/venice/git/refs{/sha}","trees_url":"https://api.github.com/repos/DenisPopov15/venice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DenisPopov15/venice/statuses/{sha}","languages_url":"https://api.github.com/repos/DenisPopov15/venice/languages","stargazers_url":"https://api.github.com/repos/DenisPopov15/venice/stargazers","contributors_url":"https://api.github.com/repos/DenisPopov15/venice/contributors","subscribers_url":"https://api.github.com/repos/DenisPopov15/venice/subscribers","subscription_url":"https://api.github.com/repos/DenisPopov15/venice/subscription","commits_url":"https://api.github.com/repos/DenisPopov15/venice/commits{/sha}","git_commits_url":"https://api.github.com/repos/DenisPopov15/venice/git/commits{/sha}","comments_url":"https://api.github.com/repos/DenisPopov15/venice/comments{/number}","issue_comment_url":"https://api.github.com/repos/DenisPopov15/venice/issues/comments{/number}","contents_url":"https://api.github.com/repos/DenisPopov15/venice/contents/{+path}","compare_url":"https://api.github.com/repos/DenisPopov15/venice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DenisPopov15/venice/merges","archive_url":"https://api.github.com/repos/DenisPopov15/venice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DenisPopov15/venice/downloads","issues_url":"https://api.github.com/repos/DenisPopov15/venice/issues{/number}","pulls_url":"https://api.github.com/repos/DenisPopov15/venice/pulls{/number}","milestones_url":"https://api.github.com/repos/DenisPopov15/venice/milestones{/number}","notifications_url":"https://api.github.com/repos/DenisPopov15/venice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DenisPopov15/venice/labels{/name}","releases_url":"https://api.github.com/repos/DenisPopov15/venice/releases{/id}","created_at":"2015-12-21T10:06:15Z","updated_at":"2015-12-21T10:06:16Z","pushed_at":"2015-12-25T14:11:36Z","git_url":"git://github.com/DenisPopov15/venice.git","ssh_url":"git@github.com:DenisPopov15/venice.git","clone_url":"https://github.com/DenisPopov15/venice.git","svn_url":"https://github.com/DenisPopov15/venice","homepage":null,"size":179,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"alexkravets:develop","ref":"develop","sha":"ae9a18ca114668733f4e510cf82afb5aa070d981","user":{"login":"alexkravets","id":477851,"avatar_url":"https://avatars.githubusercontent.com/u/477851?v=3","gravatar_id":"","url":"https://api.github.com/users/alexkravets","html_url":"https://github.com/alexkravets","followers_url":"https://api.github.com/users/alexkravets/followers","following_url":"https://api.github.com/users/alexkravets/following{/other_user}","gists_url":"https://api.github.com/users/alexkravets/gists{/gist_id}","starred_url":"https://api.github.com/users/alexkravets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexkravets/subscriptions","organizations_url":"https://api.github.com/users/alexkravets/orgs","repos_url":"https://api.github.com/users/alexkravets/repos","events_url":"https://api.github.com/users/alexkravets/events{/privacy}","received_events_url":"https://api.github.com/users/alexkravets/received_events","type":"User","site_admin":false},"repo":{"id":44021408,"name":"venice","full_name":"alexkravets/venice","owner":{"login":"alexkravets","id":477851,"avatar_url":"https://avatars.githubusercontent.com/u/477851?v=3","gravatar_id":"","url":"https://api.github.com/users/alexkravets","html_url":"https://github.com/alexkravets","followers_url":"https://api.github.com/users/alexkravets/followers","following_url":"https://api.github.com/users/alexkravets/following{/other_user}","gists_url":"https://api.github.com/users/alexkravets/gists{/gist_id}","starred_url":"https://api.github.com/users/alexkravets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexkravets/subscriptions","organizations_url":"https://api.github.com/users/alexkravets/orgs","repos_url":"https://api.github.com/users/alexkravets/repos","events_url":"https://api.github.com/users/alexkravets/events{/privacy}","received_events_url":"https://api.github.com/users/alexkravets/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexkravets/venice","description":"Website boilerplate for your next Rails project.","fork":false,"url":"https://api.github.com/repos/alexkravets/venice","forks_url":"https://api.github.com/repos/alexkravets/venice/forks","keys_url":"https://api.github.com/repos/alexkravets/venice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexkravets/venice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexkravets/venice/teams","hooks_url":"https://api.github.com/repos/alexkravets/venice/hooks","issue_events_url":"https://api.github.com/repos/alexkravets/venice/issues/events{/number}","events_url":"https://api.github.com/repos/alexkravets/venice/events","assignees_url":"https://api.github.com/repos/alexkravets/venice/assignees{/user}","branches_url":"https://api.github.com/repos/alexkravets/venice/branches{/branch}","tags_url":"https://api.github.com/repos/alexkravets/venice/tags","blobs_url":"https://api.github.com/repos/alexkravets/venice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexkravets/venice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexkravets/venice/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexkravets/venice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexkravets/venice/statuses/{sha}","languages_url":"https://api.github.com/repos/alexkravets/venice/languages","stargazers_url":"https://api.github.com/repos/alexkravets/venice/stargazers","contributors_url":"https://api.github.com/repos/alexkravets/venice/contributors","subscribers_url":"https://api.github.com/repos/alexkravets/venice/subscribers","subscription_url":"https://api.github.com/repos/alexkravets/venice/subscription","commits_url":"https://api.github.com/repos/alexkravets/venice/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexkravets/venice/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexkravets/venice/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexkravets/venice/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexkravets/venice/contents/{+path}","compare_url":"https://api.github.com/repos/alexkravets/venice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexkravets/venice/merges","archive_url":"https://api.github.com/repos/alexkravets/venice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexkravets/venice/downloads","issues_url":"https://api.github.com/repos/alexkravets/venice/issues{/number}","pulls_url":"https://api.github.com/repos/alexkravets/venice/pulls{/number}","milestones_url":"https://api.github.com/repos/alexkravets/venice/milestones{/number}","notifications_url":"https://api.github.com/repos/alexkravets/venice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexkravets/venice/labels{/name}","releases_url":"https://api.github.com/repos/alexkravets/venice/releases{/id}","created_at":"2015-10-10T17:50:39Z","updated_at":"2015-12-22T12:10:52Z","pushed_at":"2015-12-25T14:26:00Z","git_url":"git://github.com/alexkravets/venice.git","ssh_url":"git@github.com:alexkravets/venice.git","clone_url":"https://github.com/alexkravets/venice.git","svn_url":"https://github.com/alexkravets/venice","homepage":"https://github.com/alexkravets/venice","size":202,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alexkravets/venice/pulls/3"},"html":{"href":"https://github.com/alexkravets/venice/pull/3"},"issue":{"href":"https://api.github.com/repos/alexkravets/venice/issues/3"},"comments":{"href":"https://api.github.com/repos/alexkravets/venice/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/alexkravets/venice/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/alexkravets/venice/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alexkravets/venice/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/alexkravets/venice/statuses/db5dfcf94eca18db5c6ea4f7fdff960338ff0460"}}}}