don't gzip static files, and always commit them
2
.gitignore
vendored
|
@ -35,7 +35,7 @@ npm-debug.log
|
|||
# Since we are building assets from assets/,
|
||||
# we ignore priv/static. You may want to comment
|
||||
# this depending on your deployment strategy.
|
||||
/priv/static/
|
||||
#/priv/static/
|
||||
|
||||
# Files matching config/*.secret.exs pattern contain sensitive
|
||||
# data and you should not commit them into version control.
|
||||
|
|
132
README.md
|
@ -7,84 +7,72 @@ Written in Elixir & Phoenix LiveView, with Bootstrap v5.
|
|||
## TODO
|
||||
|
||||
- [X] ~~*Proper modal to delete shifts?*~~ [2022-08-14]
|
||||
- [ ] 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))
|
||||
- [ ] Update tests, which are probably all way out of date. But I also don't care that much for this project...
|
||||
|
||||
## Deploying
|
||||
|
||||
The below notes are old; I'm using a docker build to deploy this now. Will document when I have time.
|
||||
I'm using a dumb & simple docker approach to deploying this now. Nothing automated, the basic steps are:
|
||||
|
||||
### New versions
|
||||
1. ensure latest assets are built, digested, and committed to the repo
|
||||
|
||||
When improvements are made, we can update the deployed version like so:
|
||||
```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...
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
|
||||
# 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"]
|
||||
```
|
||||
|
||||
### Simple entrypoint script
|
||||
|
||||
```shell
|
||||
cd ${SHIFT73K_BASE_DIR}
|
||||
# update from master
|
||||
/usr/bin/git pull 73k master
|
||||
# fetch prod deps & compile
|
||||
/usr/bin/mix deps.get --only prod
|
||||
MIX_ENV=prod /usr/bin/mix compile
|
||||
# perform any migrations
|
||||
MIX_ENV=prod /usr/bin/mix ecto.migrate
|
||||
# update node packages via package-lock.json
|
||||
/usr/bin/npm --prefix ./assets/ ci
|
||||
# rebuild static assets:
|
||||
rm -rf ./priv/static/*
|
||||
/usr/bin/npm --prefix ./assets/ run build
|
||||
MIX_ENV=prod /usr/bin/mix phx.digest
|
||||
# rebuild release
|
||||
MIX_ENV=prod /usr/bin/mix release --overwrite
|
||||
# restart service
|
||||
sudo /bin/systemctl restart shift73k.service
|
||||
#!/bin/ash
|
||||
|
||||
export MIX_ENV="prod"
|
||||
|
||||
cd /app
|
||||
exec mix ecto.migrate && mix phx.server
|
||||
```
|
||||
|
||||
### systemd unit:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Shift73k service
|
||||
After=local-fs.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=runuser
|
||||
Group=runuser
|
||||
WorkingDirectory=/opt/shift73k/_build/prod/rel/shift73k
|
||||
ExecStart=/opt/shift73k/_build/prod/rel/shift73k/bin/shift73k start
|
||||
ExecStop=/opt/shift73k/_build/prod/rel/shift73k/bin/shift73k stop
|
||||
#EnvironmentFile=/etc/default/myApp.env
|
||||
Environment=LANG=en_US.utf8
|
||||
Environment=MIX_ENV=prod
|
||||
#Environment=PORT=4000
|
||||
LimitNOFILE=65535
|
||||
UMask=0027
|
||||
SyslogIdentifier=shift73k
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
### nginx config:
|
||||
|
||||
```conf
|
||||
upstream phoenix {
|
||||
server 127.0.0.1:4000 max_fails=5 fail_timeout=60s;
|
||||
}
|
||||
server {
|
||||
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;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_redirect off;
|
||||
# WebSockets
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_pass http://phoenix;
|
||||
}
|
||||
}
|
||||
```
|
|
@ -25,7 +25,7 @@ defmodule Shift73kWeb.Endpoint do
|
|||
plug Plug.Static,
|
||||
at: "/",
|
||||
from: :shift73k,
|
||||
gzip: (Mix.env() not in [:dev, :test]),
|
||||
gzip: false,
|
||||
only: ~w(assets
|
||||
android-chrome-192x192.png
|
||||
android-chrome-512x512.png
|
||||
|
|
After Width: | Height: | Size: 2.1 KiB |
BIN
priv/static/android-chrome-192x192.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.9 KiB |
BIN
priv/static/android-chrome-512x512.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 1.8 KiB |
BIN
priv/static/apple-touch-icon.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
82
priv/static/assets/app-0219437518c49e2ce7636ddbcb242015.js
Normal file
BIN
priv/static/assets/app-0219437518c49e2ce7636ddbcb242015.js.gz
Normal file
BIN
priv/static/assets/app-115d16c19684910e766fcd02a193de16.css.gz
Normal file
7
priv/static/assets/app.css
Normal file
BIN
priv/static/assets/app.css.gz
Normal file
82
priv/static/assets/app.js
Normal file
BIN
priv/static/assets/app.js.gz
Normal file
BIN
priv/static/assets/bootstrap-icons.woff
Normal file
BIN
priv/static/assets/bootstrap-icons.woff2
Normal file
BIN
priv/static/assets/lato-all-300-normal.woff
Normal file
BIN
priv/static/assets/lato-all-400-normal.woff
Normal file
BIN
priv/static/assets/lato-all-700-normal.woff
Normal file
BIN
priv/static/assets/lato-latin-300-normal.woff2
Normal file
BIN
priv/static/assets/lato-latin-400-normal.woff2
Normal file
BIN
priv/static/assets/lato-latin-700-normal.woff2
Normal file
BIN
priv/static/assets/lato-latin-ext-300-normal.woff2
Normal file
BIN
priv/static/assets/lato-latin-ext-400-normal.woff2
Normal file
BIN
priv/static/assets/lato-latin-ext-700-normal.woff2
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#ee6c4d</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
9
priv/static/browserconfig.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#ee6c4d</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
6
priv/static/cache_manifest.json
Normal file
BIN
priv/static/favicon-16x16-1dc7f8c2edaa8ef7c6b311d212113442.png
Normal file
After Width: | Height: | Size: 850 B |
BIN
priv/static/favicon-16x16.png
Normal file
After Width: | Height: | Size: 850 B |
BIN
priv/static/favicon-32x32-daf21a099474d36810d7f5a37f122c04.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
priv/static/favicon-32x32.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
priv/static/favicon-d017b32aaddf3139532b004f276caff7.ico
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
priv/static/favicon.ico
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
priv/static/mstile-144x144-37c05cb7ac4dfe14539080f048288cd8.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
priv/static/mstile-144x144.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
priv/static/mstile-150x150-ec10b87f703d3bc7abfd4088ba1173c7.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
priv/static/mstile-150x150.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
priv/static/mstile-310x150-f31f3da0f7959db75a49ca2290d5f9fc.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
priv/static/mstile-310x150.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
priv/static/mstile-310x310-91a0c8044b8015fb1c810c7da3b8ce19.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
priv/static/mstile-310x310.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
priv/static/mstile-70x70-9d68ce610bb58a84c991a538ee5a2471.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
priv/static/mstile-70x70.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
5
priv/static/robots-067185ba27a5d9139b10a759679045bf.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
||||
#
|
||||
# To ban all spiders from the entire site uncomment the next two lines:
|
||||
# User-agent: *
|
||||
# Disallow: /
|
BIN
priv/static/robots-067185ba27a5d9139b10a759679045bf.txt.gz
Normal file
5
priv/static/robots.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
||||
#
|
||||
# To ban all spiders from the entire site uncomment the next two lines:
|
||||
# User-agent: *
|
||||
# Disallow: /
|
BIN
priv/static/robots.txt.gz
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="700.000000pt" height="700.000000pt" viewBox="0 0 700.000000 700.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.11, written by Peter Selinger 2001-2013
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,700.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M1442 6981 c-49 -23 -86 -61 -109 -111 -15 -32 -21 -104 -23 -271 l0
|
||||
-36 -242 0 c-134 0 -265 -3 -293 -7 -27 -4 -66 -10 -84 -13 -134 -20 -324
|
||||
-125 -440 -242 -102 -105 -205 -285 -224 -397 -3 -16 -10 -51 -16 -79 -7 -34
|
||||
-10 -871 -10 -2555 l0 -2505 24 -91 c44 -173 125 -314 246 -430 61 -57 180
|
||||
-144 199 -144 5 0 24 -9 42 -19 18 -11 74 -32 123 -48 l90 -28 2770 0 2770 0
|
||||
79 23 c240 69 415 204 543 417 27 46 56 115 81 195 l27 85 2 2530 c1 2396 1
|
||||
2534 -16 2610 -25 109 -44 161 -93 247 -134 238 -356 394 -623 438 -39 7 -181
|
||||
12 -318 13 -136 0 -250 4 -253 8 -3 5 -5 59 -6 121 -1 134 -16 192 -60 236
|
||||
-44 46 -81 63 -147 68 -80 6 -153 -31 -196 -101 -29 -47 -30 -53 -33 -190 l-4
|
||||
-142 -1749 0 -1749 0 0 127 c0 136 -9 176 -49 227 -58 73 -176 102 -259 64z
|
||||
m4820 -880 c143 -46 254 -168 289 -317 13 -56 18 -4891 5 -4979 -12 -83 -68
|
||||
-186 -132 -244 -63 -57 -111 -85 -188 -108 -45 -13 -366 -15 -2722 -15 -1469
|
||||
0 -2691 3 -2715 7 -72 12 -165 60 -224 116 -64 60 -119 163 -131 244 -4 28 -7
|
||||
1153 -7 2500 l0 2450 22 63 c12 35 33 82 47 104 61 95 181 177 289 195 28 5
|
||||
1254 8 2725 7 l2675 -1 67 -22z"/>
|
||||
<path d="M1255 5463 c-50 -13 -110 -64 -138 -118 -19 -37 -21 -57 -22 -300 -2
|
||||
-293 2 -321 64 -385 68 -72 -109 -67 2361 -66 l2225 1 40 22 c54 29 82 61 104
|
||||
119 16 43 18 80 17 314 l-2 265 -26 42 c-34 51 -81 88 -133 102 -28 8 -681 11
|
||||
-2255 10 -1218 -1 -2224 -4 -2235 -6z"/>
|
||||
<path d="M3657 3928 c-52 -14 -131 -87 -145 -136 -8 -26 -12 -128 -12 -298 0
|
||||
-235 2 -263 20 -299 26 -55 50 -80 101 -107 42 -22 55 -23 284 -25 132 -1 259
|
||||
1 283 4 63 8 131 58 161 117 25 49 25 52 26 309 0 171 -4 272 -11 294 -18 50
|
||||
-60 101 -107 125 -40 22 -54 23 -302 25 -152 1 -276 -3 -298 -9z"/>
|
||||
<path d="M4950 3921 c-59 -24 -115 -88 -129 -149 -7 -29 -10 -143 -9 -302 3
|
||||
-242 4 -257 25 -290 33 -53 73 -86 123 -103 36 -12 95 -14 295 -13 137 2 266
|
||||
6 285 11 50 12 124 89 138 145 17 70 14 525 -5 575 -19 50 -88 117 -136 132
|
||||
-23 7 -134 11 -289 11 -221 1 -259 -2 -298 -17z"/>
|
||||
<path d="M1465 2612 c-66 -19 -130 -85 -143 -146 -5 -26 -9 -160 -8 -299 1
|
||||
-275 4 -292 64 -353 59 -59 82 -63 371 -64 264 -1 265 0 315 25 57 28 98 79
|
||||
115 141 11 41 14 457 4 528 -9 60 -60 127 -118 156 -49 24 -55 25 -302 25
|
||||
-184 1 -265 -3 -298 -13z"/>
|
||||
<path d="M2777 2613 c-60 -17 -122 -79 -139 -138 -10 -33 -13 -115 -13 -303 1
|
||||
-242 3 -259 23 -298 24 -48 69 -88 119 -109 44 -19 514 -22 577 -4 54 15 93
|
||||
46 124 99 l27 45 0 285 0 285 -25 40 c-28 46 -40 58 -95 87 -38 20 -54 22
|
||||
-297 23 -183 1 -270 -3 -301 -12z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.9 KiB |
48
priv/static/safari-pinned-tab.svg
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="700.000000pt" height="700.000000pt" viewBox="0 0 700.000000 700.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.11, written by Peter Selinger 2001-2013
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,700.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M1442 6981 c-49 -23 -86 -61 -109 -111 -15 -32 -21 -104 -23 -271 l0
|
||||
-36 -242 0 c-134 0 -265 -3 -293 -7 -27 -4 -66 -10 -84 -13 -134 -20 -324
|
||||
-125 -440 -242 -102 -105 -205 -285 -224 -397 -3 -16 -10 -51 -16 -79 -7 -34
|
||||
-10 -871 -10 -2555 l0 -2505 24 -91 c44 -173 125 -314 246 -430 61 -57 180
|
||||
-144 199 -144 5 0 24 -9 42 -19 18 -11 74 -32 123 -48 l90 -28 2770 0 2770 0
|
||||
79 23 c240 69 415 204 543 417 27 46 56 115 81 195 l27 85 2 2530 c1 2396 1
|
||||
2534 -16 2610 -25 109 -44 161 -93 247 -134 238 -356 394 -623 438 -39 7 -181
|
||||
12 -318 13 -136 0 -250 4 -253 8 -3 5 -5 59 -6 121 -1 134 -16 192 -60 236
|
||||
-44 46 -81 63 -147 68 -80 6 -153 -31 -196 -101 -29 -47 -30 -53 -33 -190 l-4
|
||||
-142 -1749 0 -1749 0 0 127 c0 136 -9 176 -49 227 -58 73 -176 102 -259 64z
|
||||
m4820 -880 c143 -46 254 -168 289 -317 13 -56 18 -4891 5 -4979 -12 -83 -68
|
||||
-186 -132 -244 -63 -57 -111 -85 -188 -108 -45 -13 -366 -15 -2722 -15 -1469
|
||||
0 -2691 3 -2715 7 -72 12 -165 60 -224 116 -64 60 -119 163 -131 244 -4 28 -7
|
||||
1153 -7 2500 l0 2450 22 63 c12 35 33 82 47 104 61 95 181 177 289 195 28 5
|
||||
1254 8 2725 7 l2675 -1 67 -22z"/>
|
||||
<path d="M1255 5463 c-50 -13 -110 -64 -138 -118 -19 -37 -21 -57 -22 -300 -2
|
||||
-293 2 -321 64 -385 68 -72 -109 -67 2361 -66 l2225 1 40 22 c54 29 82 61 104
|
||||
119 16 43 18 80 17 314 l-2 265 -26 42 c-34 51 -81 88 -133 102 -28 8 -681 11
|
||||
-2255 10 -1218 -1 -2224 -4 -2235 -6z"/>
|
||||
<path d="M3657 3928 c-52 -14 -131 -87 -145 -136 -8 -26 -12 -128 -12 -298 0
|
||||
-235 2 -263 20 -299 26 -55 50 -80 101 -107 42 -22 55 -23 284 -25 132 -1 259
|
||||
1 283 4 63 8 131 58 161 117 25 49 25 52 26 309 0 171 -4 272 -11 294 -18 50
|
||||
-60 101 -107 125 -40 22 -54 23 -302 25 -152 1 -276 -3 -298 -9z"/>
|
||||
<path d="M4950 3921 c-59 -24 -115 -88 -129 -149 -7 -29 -10 -143 -9 -302 3
|
||||
-242 4 -257 25 -290 33 -53 73 -86 123 -103 36 -12 95 -14 295 -13 137 2 266
|
||||
6 285 11 50 12 124 89 138 145 17 70 14 525 -5 575 -19 50 -88 117 -136 132
|
||||
-23 7 -134 11 -289 11 -221 1 -259 -2 -298 -17z"/>
|
||||
<path d="M1465 2612 c-66 -19 -130 -85 -143 -146 -5 -26 -9 -160 -8 -299 1
|
||||
-275 4 -292 64 -353 59 -59 82 -63 371 -64 264 -1 265 0 315 25 57 28 98 79
|
||||
115 141 11 41 14 457 4 528 -9 60 -60 127 -118 156 -49 24 -55 25 -302 25
|
||||
-184 1 -265 -3 -298 -13z"/>
|
||||
<path d="M2777 2613 c-60 -17 -122 -79 -139 -138 -10 -33 -13 -115 -13 -303 1
|
||||
-242 3 -259 23 -298 24 -48 69 -88 119 -109 44 -19 514 -22 577 -4 54 15 93
|
||||
46 124 99 l27 45 0 285 0 285 -25 40 c-28 46 -40 58 -95 87 -38 20 -54 22
|
||||
-297 23 -183 1 -270 -3 -301 -12z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.9 KiB |
BIN
priv/static/safari-pinned-tab.svg.gz
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "Shift73k",
|
||||
"short_name": "Shift73k",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ee6c4d",
|
||||
"background_color": "#ee6c4d"
|
||||
}
|
18
priv/static/site.webmanifest
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "Shift73k",
|
||||
"short_name": "Shift73k",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ee6c4d",
|
||||
"background_color": "#ee6c4d"
|
||||
}
|