From 1fc58b8c0c5c2fd17602fec198c10975fdd6aadf Mon Sep 17 00:00:00 2001 From: Lewis Dale Date: Fri, 15 Nov 2024 11:42:28 +0000 Subject: [PATCH] Add some deployment instructions, and update the schema when starting the PHP container --- README.md | 10 ++++++++++ compose.yml | 13 ++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0763803..9550593 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,13 @@ It's called Baleen, because that's what whales use to filter out the krill from ## Running tests 1. Run `php vendor/bin/phpunit` to run the tests + +## Running in Docker + +There is a supplied `compose.yml`, so you can run the entire application with `docker compose up -d`, which will create the database and schema, and run an Nginx server. + +To add a feed, get the docker container ID of the PHP container using `docker ps`, and then use the `create feed` command: + +```bash +docker exec fe0bae104040 sh -c 'php bin/doctrine test:feed --filter=include --target=title -a "[No Ads]" -- "" "DnD: Just the eps"' +``` \ No newline at end of file diff --git a/compose.yml b/compose.yml index 89f145d..6d8e7dd 100644 --- a/compose.yml +++ b/compose.yml @@ -18,6 +18,11 @@ services: POSTGRES_USER: postgres POSTGRES_PASSWORD: password POSTGRES_DB: baleen + healthcheck: + test: ["CMD-SHELL", "pg_isready", "-d", "baleen"] + start_period: 20s + retries: 5 + interval: 10s php: build: context: . @@ -30,4 +35,10 @@ services: - ./views:/var/www/html/views - ./bin:/var/www/html/bin environment: - DB_CONNECTION: postgres://postgres:password@postgres:5432/baleen \ No newline at end of file + DB_CONNECTION: postgres://postgres:password@postgres:5432/baleen + entrypoint: sh -c "php bin/doctrine orm:schema-tool:update --complete --force && php-fpm" + depends_on: + postgres: + condition: service_healthy + links: + - postgres \ No newline at end of file