~ihabunek/harvey

Update deploy script
Remove verbose logging

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~ihabunek/harvey
read/write
git@git.sr.ht:~ihabunek/harvey

You can also use your local clone with git send-email.

#Harvey

Tracking prices over time.

#Deployment

Reading:

#Nginx config

/etc/nginx/sites-available/harvey.bezdomni.net

upstream harvey {
  server 127.0.0.1:4001 max_fails=5 fail_timeout=60s;
}

server {
    listen 80;
    server_name harvey.bezdomni.net;
    return 301 https://$host$request_uri;
}

server {
    listen 443;

    server_name harvey.bezdomni.net;

    access_log /var/log/nginx/harvey.bezdomni.net.access.log;
    error_log /var/log/nginx/harvey.bezdomni.net.error.log;

    ssl_certificate     /etc/letsencrypt/live/bezdomni.net/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/bezdomni.net/privkey.pem;
    include             /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam         /etc/letsencrypt/ssl-dhparams.pem;

    location / {
      allow all;

      # Proxy Headers
      proxy_http_version 1.1;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-Cluster-Client-Ip $remote_addr;

      # The Important Websocket Bits!
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";

      proxy_pass http://harvey;
    }
}

#Environment

/home/ihabunek/projects/harvey/systemd.env

DATABASE_URL=ecto://...
SENTRY_DSN=...
SECRET_KEY_BASE=...
PHX_SERVER=true
PORT=4001

#Systemd config

/etc/systemd/system/harvey.service

[Unit]
Description=Triglav daemon
After=network.target

[Service]
PIDFile=/run/harvey/pid
User=ihabunek
Group=ihabunek
WorkingDirectory=/home/ihabunek/projects/harvey
EnvironmentFile=/home/ihabunek/projects/harvey/systemd.env
ExecStart=/home/ihabunek/projects/harvey/prod/rel/harvey/bin/harvey start
ExecReload=/home/ihabunek/projects/harvey/prod/rel/harvey/bin/harvey restart
ExecStop=/home/ihabunek/projects/harvey/prod/rel/harvey/bin/harvey stop

[Install]
WantedBy=multi-user.target

Enable service (only required once):

sudo systemctl enable harvey.service

Read logs:

journalctl -u harvey.service