kure-kosen / cho_kure_web

ちょっときいて呉高専のポータルサイト
12 stars 0 forks source link

README

CircleCI Maintainability Test Coverage Netlify Status

Ruby version

$ ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]

Setup without Docker

以下を実行すればセットアップは完了するはず。 mysql に接続できなければ .env を編集して自分の環境に合わせてください。

... installed ruby, mysql
$ git clone git@github.com:kure-kosen/cho_kure_web.git
$ cd cho_kure_web
$ bin/setup

Setup with Docker

Common

$ git clone git@github.com:kure-kosen/cho_kure_web.git
$ cd cho_kure_web

Backend

... installed docker-compose
$ docker-compose build
$ docker-compose up
$ docker-compose run backend bin/rails db:create db:schema:load db:seed_fu

Frontend

refer to /frontend/README.md

CircleCI

CircleCI Local CLI

... installed CircleCI Local CLI
$ circleci local execute --job build
$ circleci local execute --job frontend-build
$ circleci local execute --job frontend-test

SSL

... in production server
$ certbot-auto certificates
$ certbot-auto renew
# $ certbot-auto renew --dry-run
# $ certbot-auto renew --force-renew
$ service nginx restart

Deploy

SSH

$ cat ~/.ssh/config
Host cho_kure_web
  HostName 52.199.95.54
  Port 22
  User euglena1215
  IdentityFile ~/.ssh/id_rsa

# 2019/12/10, staging server is down.
# Host stg_cho_kure_web
#   HostName 13.115.40.132
#   Port 22
#   User taira
#   IdentityFile ~/.ssh/id_rsa
  1. サーバーの ~/.ssh/authorized_keys に IdentityFile 追記する
  2. deploy したいブランチを GitHub に push する
  3. branch 名を変更
    • production: set :branch, "master" in (/config/deploy/production.rb)
    • staging: set :branch, "feature/{xxxx}" in (/config/deploy/staging.rb)
  4. $ bundle exec cap (staging | production) deploy
  5. $ ssh (stg_cho_kure_web | cho_kure_web) でサーバに入る
  6. $ bash ~/deploy_setup.sh をサーバー内で実行

その他