Commit 8fb2bec9 authored by jz143's avatar jz143

modify config example for Let's Encrypt certs and correct RAILS_ENV setup

parent e12bac6a
......@@ -31,6 +31,23 @@ VERBOSE=1 QUEUE=mac_online rake environment resque:work
```
### Configure Nginx
Use Let's Encrypt to obtain and automatically renew certificates.
```
# /etc/nginx/sites-enabled/appstore-http.conf
server {
listen 80;
server_name appstore.colab.duke.edu;
include letsencrypt.conf;
location / {
rewrite ^ https://$server_name$request_uri? redirect;
}
}
```
```
# /etc/nginx/sites-enabled/appstore.conf
......@@ -39,22 +56,17 @@ upstream puma {
}
server {
listen 80;
listen 443 default ssl;
listen 443 ssl;
server_name appstore.colab.duke.edu;
ssl_certificate /home/appstore/appstore.colab.duke.edu.crt;
ssl_certificate_key /home/appstore/appstore.colab.duke.edu.key;
ssl_certificate /etc/letsencrypt/live/appstore.colab.duke.edu/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/appstore.colab.duke.edu/privkey.pem;
client_max_body_size 500m;
root /home/appstore/appstore/current/public;
try_files $uri/index.html $uri @app;
if ($ssl_protocol = "") {
rewrite ^ https://$server_name$request_uri? redirect;
}
location /system/app_files/archives {
internal;
}
......@@ -69,6 +81,16 @@ server {
}
```
### Set RAILS_ENV for scripts to work
In order for background jobs to run correctly without development gems like `sqlite3` (among other reasons), set the environment variable so the scripts are aware that it is in production mode.
```
# /home/appstore/.bash_profile
export RAILS_ENV=production
# (other RVM stuff)
```
### Auto-start Rails app on app server
#### Rails server
```
......
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