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
2021-03-25 20:31:32 -04:00
Written in Elixir & Phoenix LiveView, with Bootstrap v5.
2020-10-19 15:35:33 -04:00
2021-03-25 20:31:32 -04:00
## TODO
2022-08-14 13:58:41 -04:00
- [X] ~~*Proper modal to delete shifts?*~~ [2022-08-14]
2022-08-14 15:09:30 -04:00
- [ ] move runtime config out of compile-time config files, to move towards supporting releases
- [ ] probably need to use `def get_app_config` style functions instead of `@module_var` module variables, ([see this](https://stephenbussey.com/2019/01/03/understanding-compile-time-dependencies-in-elixir-a-bug-hunt.html))
2022-08-14 13:58:41 -04:00
- [ ] Update tests, which are probably all way out of date. But I also don't care that much for this project...
2021-03-25 20:31:32 -04:00
## Deploying
2022-08-14 15:09:30 -04:00
I'm using a dumb & simple docker approach to deploying this now. Nothing automated, the basic steps are:
2022-08-14 13:58:41 -04:00
2022-08-14 15:09:30 -04:00
1. ensure latest assets are built, digested, and committed to the repo
2021-03-25 20:31:32 -04:00
2022-08-14 15:09:30 -04:00
```shell
# rebuild static assets:
rm -rf ./priv/static/*
npm --prefix assets run build
MIX_ENV=prod mix phx.digest
# then do a new commit and push...
```
2021-03-25 20:31:32 -04:00
2022-08-14 15:09:30 -04:00
2. on server, build a new container, and run it
### Simple dockerfile
```dockerfile
# ./Dockerfile
# Extend from the official Elixir image
FROM elixir:1.13.4-otp-25-alpine
# # install the package postgresql-client to run pg_isready within entrypoint script
# RUN apt-get update && \
# apt-get install -y postgresql-client
# Copy the entrypoint script
COPY ./entrypoint.sh /entrypoint.sh
# Create app directory and copy the Elixir projects into it
RUN mkdir /app
COPY ./app /app
WORKDIR /app
# Install the build tools we'll need
RUN apk update & & \
apk upgrade --no-cache & & \
apk add --no-cache \
build-base & & \
mix local.rebar --force & & \
mix local.hex --force
2021-03-25 20:31:32 -04:00
2022-08-14 15:09:30 -04:00
# The environment to build with
ENV MIX_ENV=prod
# Get deps and compile
RUN mix do deps.get, deps.compile, compile
# Start command
CMD = ["/entrypoint.sh"]
2021-03-25 20:31:32 -04:00
```
2022-08-14 15:09:30 -04:00
### Simple entrypoint script
```shell
#!/bin/ash
export MIX_ENV="prod"
cd /app
exec mix ecto.migrate & & mix phx.server
```