This repository was archived by the owner on Jul 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
SetupProduction
Hal Seki edited this page Oct 14, 2017
·
7 revisions
Server: Ubuntu Server 16.04.3 LTS 64bit
create user 'deployer' and add ssh public key to ~/.ssh/authorized_keys
as a deployer user,
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
cd /tmp
curl -sSL https://get.rvm.io -o rvm.sh
cat /tmp/rvm.sh | bash -s stable --rails
source /home/deployer/.rvm/scripts/rvm
rvm install 2.4.1
gem install bundler
sudo apt-get install libmysqlclient-dev
cd /tmp
\curl -sSL https://deb.nodesource.com/setup_6.x -o nodejs.sh
less nodejs.sh
cat /tmp/nodejs.sh | sudo -E bash -
sudo apt-get update
sudo apt-get install -y nodejs
sudo vi /etc/hosts
127.0.0.1 localhost db
sudo apt-get install mysql-server
mysql -u root -p
% create database cfj_election_front_production default character set utf8;
% CREATE USER 'cfj_election_front'@'localhost' IDENTIFIED BY 'password';
% GRANT ALL PRIVILEGES ON cfj_election_front_production.* TO 'cfj_election_front'@'localhost';
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
sudo apt-get install nginx
sudo vi /etc/nginx/sites-available/default
upstream unicorn {
server unix:/var/www/codeforelection_front/shared/tmp/sockets/unicorn.sock;
}
server {
listen 80 default_server;
server_name kouhosha.info;
access_log /var/log/nginx/candidatesnavi_access.log;
error_log /var/log/nginx/candidatesnavi_error.log;
root /var/www/codeforelection_front/current/public;
client_max_body_size 100m;
error_page 404 /404.html;
error_page 500 502 503 504 /500.html;
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://unicorn;
}
}
vi /var/www/codeforelection_front/shared/config/database.yml
vi /var/www/codeforelection_front/shared/config/secrets.yml
(中身はそれぞれ現行のリポジトリものをコピーして、必要なパスワードをハードコーディングする)