- Elixir/Phoenix
- Absinthe GraphQL
- PostgreSQL (UUID primary keys)
- VSCode with ElixirLS preferred
- Copy contents of .env.local.example to .env.local
- Set config in .env.local
- source ./setenv.sh or ./run.sh to start app in dev mode
Deploy (edeliver and Distillery)
mix edeliver build release production
mix edeliver deploy release production
- Standalone app behind nginx proxy.
- Controlled by systemd (sudo systemd stop/start sntx) or using edelivery.
- Systemd service file located in /etc/systemd/system/sntx.service.
- Migrations can be also performed using server side:
~/api/sntx/bin/sntx migrate
. - Env file is located in
~/api/app.env
and must be imported in.~/profile
or~/.bashrc
.
Create env file in and paste .env.local content. Add file to your ~/.profile or ~/.zshrc or ~/.bashrc:
set -o allexport
source ~/path-to-api/app.env
set +o allexport
- GlitchTip/Sentry error tracking in production builds
- Phoenix Dashboard:
localhost:3000/dashboard
lib/sntx
- business logiclib/sntx_graph
- GraphQL logiclib/sntx_web
- REST controllers, channels, plugs, context
[Unit]
Description=SNTX Server
After=network.target
[Service]
Type=forking
User=sntx
Group=sntx
WorkingDirectory=/home/sntx/api/sntx
ExecStart=/home/sntx/api/sntx/bin/sntx start
ExecStop=/home/sntx/api/sntx/bin/sntx stop
Restart=on-failure
RestartSec=5
SyslogIdentifier=sntx
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
server {
listen 80;
server_name api.sntx.pl;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
ssl_certificate /etc/letsencrypt/live/sntx.pl/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/sntx.pl/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/sntx.pl/chain.pem;
include snippets/ssl-params.conf;
server_name api.sntx.pl;
location / {
proxy_pass http://127.0.0.1:4000;
include snippets/proxy-pass.conf;
}
}