Skip to main content

get it working

ID
09c01c7
date
2022-05-04 21:40:55+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
6240da0
message
get it working
changed files
3 files, 31 additions

Changed files

webapp/requirements.in (26) → webapp/requirements.in (35)

diff --git a/webapp/requirements.in b/webapp/requirements.in
index b028da6..f4b778f 100644
--- a/webapp/requirements.in
+++ b/webapp/requirements.in
@@ -1,2 +1,3 @@
 flask
+gunicorn
 wcag_contrast_ratio

webapp/requirements.txt (443) → webapp/requirements.txt (580)

diff --git a/webapp/requirements.txt b/webapp/requirements.txt
index ef4ceb1..8b580ee 100644
--- a/webapp/requirements.txt
+++ b/webapp/requirements.txt
@@ -8,6 +8,8 @@ click==8.1.3
     # via flask
 flask==2.1.2
     # via -r requirements.in
+gunicorn==20.1.0
+    # via -r requirements.in
 importlib-metadata==4.11.3
     # via flask
 itsdangerous==2.1.2
@@ -22,3 +24,6 @@ werkzeug==2.1.2
     # via flask
 zipp==3.8.0
     # via importlib-metadata
+
+# The following packages are considered to be unsafe in a requirements file:
+# setuptools

webapp/start.sh (0) → webapp/start.sh (668)

diff --git a/webapp/start.sh b/webapp/start.sh
new file mode 100755
index 0000000..e2d57ba
--- /dev/null
+++ b/webapp/start.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+
+pip3 install -r requirements.txt
+
+DOWNLOAD_URL=$(curl --silent 'https://api.github.com/repos/alexwlchan/dominant_colours/releases/latest' \
+  | jq -r ' .assets | map(.browser_download_url) | map(select(test(".*linux.*")))[0]'
+)
+
+# The --location flag means we follow redirects
+curl --location "$DOWNLOAD_URL" > ~/.cargo/bin/dominant_colours.tar.gz
+tar -xzf ~/.cargo/bin/dominant_colours.tar.gz
+
+mv dominant_colours /usr/local/bin/dominant_colours
+chmod +x /usr/local/bin/dominant_colours
+dominant_colours --version
+
+if [[ "$DEBUG" == "yes" ]]
+then
+  python3 server.py
+else
+  gunicorn server:app -w 4 --log-file -
+fi