Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Add `justfile` deployment recipe (#267)
Madison Swain-Bowdend65d4c461550
diff --git a/.github/workflows/push_pull_request_test.yml b/.github/workflows/push_pull_request_test.ymlindex 886e6a3db..f15b0402d 100644--- a/.github/workflows/push_pull_request_test.yml+++ b/.github/workflows/push_pull_request_test.yml@@ -16,4 +16,7 @@ jobs:- name: Change permissions for Docker stepsrun: chmod -R 777 openverse_catalog/ tests/- name: Test- run: just test+ run: |+ just up+ sleep 5 # TODO: Find a more thorough way of addressing this+ just testdiff --git a/justfile b/justfileindex 0c9334bae..c6fb438a1 100644--- a/justfile+++ b/justfile@@ -4,7 +4,10 @@ set dotenv-load := falsedefault:@just --list --unsorted-DEV_DOCKER_FILES := "--file=docker-compose.yml --file=docker-compose.override.yml"+IS_PROD := env_var_or_default("IS_PROD", "")+DOCKER_FILES := "--file=docker-compose.yml" + (+ if IS_PROD != "true" {" --file=docker-compose.override.yml"} else {""}+)SERVICE := "webserver"@@ -19,15 +22,15 @@ dotenv:# Build all (or specified) container(s)build service="": dotenv- docker-compose {{ DEV_DOCKER_FILES }} build {{ service }}+ docker-compose {{ DOCKER_FILES }} build {{ service }}# Bring all Docker services upup flags="": dotenv- docker-compose {{ DEV_DOCKER_FILES }} up -d {{ flags }}+ docker-compose {{ DOCKER_FILES }} up -d {{ flags }}# Take all Docker services downdown flags="":- docker-compose {{ DEV_DOCKER_FILES }} down {{ flags }}+ docker-compose {{ DOCKER_FILES }} down {{ flags }}# Recreate all volumes and containers from scratchrecreate: dotenv@@ -36,7 +39,14 @@ recreate: dotenv# Show logs of all, or named, Docker serviceslogs service="": up- docker-compose {{ DEV_DOCKER_FILES }} logs -f {{ service }}+ docker-compose {{ DOCKER_FILES }} logs -f {{ service }}++# Pull, build, and deploy all services+deploy:+ @just down+ -git pull+ @just build+ @just up# Run pre-commit on all fileslint:@@ -45,7 +55,7 @@ lint:# Run pytest using the webserver imagetest pytestargs="": up# The test directory is mounted into the container only during testing- docker-compose {{ DEV_DOCKER_FILES }} run \+ docker-compose {{ DOCKER_FILES }} run \-v {{ justfile_directory() }}/tests:/usr/local/airflow/tests/ \--rm \{{ SERVICE }} \@@ -53,12 +63,12 @@ test pytestargs="": up# Open a shell into the webserver containershell: up- docker-compose {{ DEV_DOCKER_FILES }} exec {{ SERVICE }} /bin/bash+ docker-compose {{ DOCKER_FILES }} exec {{ SERVICE }} /bin/bash# Run a given airflow command using the webserver imageairflow command="": up- docker-compose {{ DEV_DOCKER_FILES }} exec {{ SERVICE }} airflow {{ command }}+ docker-compose {{ DOCKER_FILES }} exec {{ SERVICE }} airflow {{ command }}# Launch a pgcli shell on the postgres container (defaults to openledger) use "airflow" for airflow metastoredb-shell args="openledger": up- docker-compose {{ DEV_DOCKER_FILES }} exec postgres pgcli {{ args }}+ docker-compose {{ DOCKER_FILES }} exec postgres pgcli {{ args }}