shift73k/README.md

90 lines
2.8 KiB
Markdown
Raw Normal View History

2021-03-05 19:23:32 -05:00
# Shift73k
2020-09-12 18:43:17 -04:00
2021-03-16 11:39:53 -04:00
Calendaring app for shift-worker shift tracking, with support for CSV export and sharing work schedule with others.
2020-10-19 15:35:33 -04:00
Written in Elixir & Phoenix LiveView, with Bootstrap v5.
2020-10-19 15:35:33 -04:00
2023-01-27 17:18:59 -05:00
## Production
To run in production, you'll need to provide several environment variable values:
```bash
MIX_ENV=prod \
PHX_SERVER=true \
TZ=America/New_York \
2023-01-27 17:18:59 -05:00
DB_SOCK=[postgres unix socket path] \
DB_NAME=[postgres db name] \
DB_USER=[postgres db user] \
DB_PASS=[postgres db user password] \
SECRET_KEY_BASE=[phoenix secret key base] \
PHX_HOST=[server fqdn (e.g., shift.73k.us)] \
PORT=4000 \
2023-01-27 17:18:59 -05:00
SMTP_RELAY=[smtp server] \
SMTP_PORT=[smtp port] \
SMTP_USER=[smtp username] \
SMTP_PASS=[smtp user password] \
MAIL_REPLY_TO=reply@73k.us \
MAIL_FROM_FRIENDLY=Shift73k \
MAIL_FROM_ADDR=shift73k@73k.us \
ALLOW_REG=[open for registration? true/false] \
iex -S mix phx.server
```
### Rebuilding assets for production
```bash
# rebuild static assets:
MIX_ENV=prod mix phx.digest.clean --all
rm -rf ./priv/static/*
npm --prefix assets run build
MIX_ENV=prod mix phx.digest
# then do a new commit and push...
```
## TODO
- [X] ~~*Proper modal to delete shifts?*~~ [2022-08-14]
- [X] ~~*move runtime config out of compile-time config files, to move towards supporting releases*~~ [2023-01-28]
- [ ] bootstrap dark mode?
- [ ] update tests, which are way out of date? Also I don't care?
## Deploying with docker
The Dockerfile will enable building a new container. I do it all with docker compose, here's an example compose yml:
```yaml
version: '3.9'
services:
shift73k:
build:
context: ./shift73k # relative path from docker-compose.yml to shift73k repo
network: host
container_name: www-shift73k
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /srv/dck/postgres/sock/postgres:/var/run/postgresql # if using unix socket
# env_file: ./shift73k.env # optionally, put your env vars in a separate file
environment:
- PHX_SERVER=true
- TZ=America/New_York
- DB_SOCK=/var/run/postgresql # if using unix socket instead of db url
- DB_NAME=[postgres db name] # if using unix socket instead of db url
- DB_USER=[postgres db user] # if using unix socket instead of db url
- DB_PASS=[postgres db user password] # if using unix socket instead of db url
- SECRET_KEY_BASE=[phoenix secret key base]
- PHX_HOST=[server fqdn (e.g., shift.73k.us)]
- PORT=4000
- SMTP_RELAY=[smtp server]
- SMTP_PORT=[smtp port]
- SMTP_USER=[smtp username]
- SMTP_PASS=[smtp user password]
- MAIL_REPLY_TO=reply@73k.us
- MAIL_FROM_FRIENDLY=Shift73k
- MAIL_FROM_ADDR=shift73k@73k.us
- ALLOW_REG=[open for registration? true/false]
ports:
- 4000:4000
```