Commit 5956eced authored by jz143's avatar jz143

includes systemd service files for starting on boot

parent ca6b38c5
...@@ -6,22 +6,57 @@ ...@@ -6,22 +6,57 @@
## Deploy and maintenance ## Deploy and maintenance
### Deploy from branch `deploy` ### Deploy from branch `deploy`
On development machine, deploy to remote:
``` ```
cap production deploy cap production deploy
``` ```
### Run worker on signing server ### Auto-start worker on signing server
1. Git clone this repository 1. Git clone this repository
2. Gather config files. Most files should be identical to production web app server, except that the MySQL username is `'appstore_sign'@'152.3.124.119'`, which allows remote usage but with fewer privileges. 2. Gather config files. Most files should be identical to production web app server, except that the MySQL username is `'appstore_sign'@'152.3.124.119'`, which allows remote usage but with fewer privileges.
``` ```
scp config/database.yml config/secrets.yml config/settings.local.yml appstore@appstore-mac.colab.managed.jiehan.org:~/appstore_sign/config/ scp config/database.yml config/secrets.yml config/settings.local.yml appstore@appstore-mac.colab.managed.jiehan.org:~/appstore_sign/config/
# be sure to edit config/database.yml on signing server to use the remote MySQL user # be sure to edit config/database.yml on signing server to use the remote MySQL user
``` ```
3. Set up a crontab: 3. Set up cron job:
``` ```
@reboot @reboot cd /Users/appstore/appstore_sign; bash -l -c 'bundle exec god -c config/god/mac_worker.rb'
``` ```
### Auto-start Rails app on app server
#### Rails server
```
# /etc/systemd/system/appstore.service
[Unit]
Description=App Store Puma daemon
After=network.target
[Service]
WorkingDirectory=/home/appstore/appstore/current
ExecStart=/bin/bash -l -c 'bundle exec puma -C /home/appstore/appstore/shared/puma.rb'
User=appstore
[Install]
WantedBy=multi-user.target
```
#### Background jobs
```
# /etc/systemd/system/appstore_worker.service
[Unit]
Description=App Store background jobs worker
After=network.target
[Service]
WorkingDirectory=/home/appstore/appstore/current
ExecStart=/bin/bash -l -c 'bundle exec god -c config/god/web_worker.rb --no-daemonize'
User=appstore
[Install]
WantedBy=multi-user.target
```
### See Puma (app server) status ### See Puma (app server) status
``` ```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment