From ab89389c1ac769c26f6c412e6bc8c9c3596f5158 Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Tue, 23 Nov 2021 22:55:19 -0500 Subject: [PATCH] added sync env script and updated deps --- .gitignore | 3 ++- README.md | 5 ++++- backend/.dockerignore | 1 + backend/requirements.in | 4 +++- backend/requirements.txt | 18 ++++++++++++------ scripts/sync_env.sh | 29 +++++++++++++++++++++++++++++ 6 files changed, 51 insertions(+), 9 deletions(-) create mode 100755 scripts/sync_env.sh diff --git a/.gitignore b/.gitignore index 37a1417..3d3b940 100644 --- a/.gitignore +++ b/.gitignore @@ -138,4 +138,5 @@ dmypy.json # Cython debug symbols cython_debug/ -.idea/ \ No newline at end of file +.idea/ + diff --git a/README.md b/README.md index 8f6fb3c..200f575 100644 --- a/README.md +++ b/README.md @@ -66,4 +66,7 @@ Then you need to specify the secret in your deployment spec like so: - name: regcred ``` -[The k8s docs](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-by-providing-credentials-on-the-command-line) \ No newline at end of file +[The k8s docs](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-by-providing-credentials-on-the-command-line) + +# References +- [SQLAlchemy patterns I used to use]: (https://git.runcible.io/androiddrew/molten_exp/src/branch/master/market_look/model.py) \ No newline at end of file diff --git a/backend/.dockerignore b/backend/.dockerignore index 7df1d53..7afccac 100644 --- a/backend/.dockerignore +++ b/backend/.dockerignore @@ -1 +1,2 @@ requirements.in +.env \ No newline at end of file diff --git a/backend/requirements.in b/backend/requirements.in index 550ec13..4cec435 100644 --- a/backend/requirements.in +++ b/backend/requirements.in @@ -1,4 +1,6 @@ +python-dotenv==0.19.2 flask==2.0.2 -psycopg-binary==3.0.4 +psycopg2-binary==2.9.2 gunicorn==20.1.0 flask-cors==3.0.10 +sqlalchemy==1.4.27 \ No newline at end of file diff --git a/backend/requirements.txt b/backend/requirements.txt index 2ef436d..722a3b6 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -2,28 +2,34 @@ # This file is autogenerated by pip-compile with python 3.8 # To update, run: # -# pip-compile --output-file=backend/requirements.txt backend/requirements.in +# pip-compile requirements.in # click==8.0.3 # via flask flask==2.0.2 # via - # -r backend/requirements.in + # -r requirements.in # flask-cors flask-cors==3.0.10 - # via -r backend/requirements.in + # via -r requirements.in +greenlet==1.1.2 + # via sqlalchemy gunicorn==20.1.0 - # via -r backend/requirements.in + # via -r requirements.in itsdangerous==2.0.1 # via flask jinja2==3.0.3 # via flask markupsafe==2.0.1 # via jinja2 -psycopg-binary==3.0.4 - # via -r backend/requirements.in +psycopg2-binary==2.9.2 + # via -r requirements.in +python-dotenv==0.19.2 + # via -r requirements.in six==1.16.0 # via flask-cors +sqlalchemy==1.4.27 + # via -r requirements.in werkzeug==2.0.2 # via flask diff --git a/scripts/sync_env.sh b/scripts/sync_env.sh new file mode 100755 index 0000000..220e01a --- /dev/null +++ b/scripts/sync_env.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# http://redsymbol.net/articles/unofficial-bash-strict-mode/ +set -euo pipefail +IFS=$'\n\t' + +# Pre-configuration + +# Set working directory to root +cd "$(dirname "$0")/../" +CDIR=$(pwd -P) +export CDIR + +VIRTUAL_ENV="${VIRTUAL_ENV:-}" +REQUIREMENTS="${CDIR}/backend/requirements.txt" +DEV_REQUIREMENTS="${CDIR}/dev_requirements.txt" + +function sync_env () { + if [ -z "${VIRTUAL_ENV}" ]; then + echo "warning: you are not in a virtualenv. Skipping sync." + exit 1 + else + echo "Syncing virtualenv" + pip-sync $REQUIREMENTS $DEV_REQUIREMENTS + fi + return 0 +} + +sync_env