omnivore/docker-compose.yml

153 lines
3.9 KiB
YAML
Raw Permalink Normal View History

2022-02-11 17:24:33 +00:00
version: '3'
x-postgres:
&postgres-common
image: "ankane/pgvector:v0.5.1"
user: postgres
healthcheck:
test: "exit 0"
interval: 2s
timeout: 12s
retries: 3
2022-02-11 17:24:33 +00:00
services:
postgres:
<<: *postgres-common
2022-02-11 17:24:33 +00:00
container_name: "omnivore-postgres"
expose:
- 5432
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: omnivore
PG_POOL_MAX: 20
POSTGRES_HOST_AUTH_METHOD: "scram-sha-256\nhost replication all 0.0.0.0/0 md5"
POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256
command: |
postgres
-c wal_level=replica
-c hot_standby=on
-c max_wal_senders=10
-c max_replication_slots=10
-c hot_standby_feedback=on
postgres-replica:
<<: *postgres-common
container_name: "omnivore-postgres-replica"
expose:
- 5433
ports:
- "5433:5432"
environment:
PGUSER: replicator
PGPASSWORD: replicator_password
command: |
bash -c "
until pg_basebackup --pgdata=/var/lib/postgresql/data -R --slot=replication_slot --host=postgres --port=5432
do
echo 'Waiting for primary to connect...'
sleep 1s
done
echo 'Backup done, starting replica...'
chmod 0700 /var/lib/postgresql/data
postgres
"
depends_on:
- postgres
2022-02-11 17:24:33 +00:00
migrate:
build:
context: .
dockerfile: ./packages/db/Dockerfile
container_name: "omnivore-migrate"
2025-09-24 10:37:39 +00:00
command: '/bin/sh ./packages/db/setup.sh' # Also create a demo user with email: demo@omnivore.work, password: demo_password
2022-02-11 17:24:33 +00:00
environment:
- PGPASSWORD=postgres
2024-01-07 13:42:26 +00:00
- POSTGRES_USER=postgres
2022-02-11 17:24:33 +00:00
- PG_HOST=postgres
2024-01-07 13:42:26 +00:00
- PG_PASSWORD=app_pass
2022-02-11 17:24:33 +00:00
- PG_DB=omnivore
depends_on:
postgres:
condition: service_healthy
Rebased version of the elastic PR (#225) * Add elastic to our docker compose * add AND/OR/NOT search operations * add elastic and create article in elastic * change error code when elastic throws error * add search pages in elastic * add search by labels * Add elastic to GitHub Action * Update elastic version * Fix port for elastic * add url in search query * Set elastic features when running tests * add debug logs * Use localhost instead of service hostname * refresh elastic after create/update * update search labels query * add typescript support * search pages in elastic * fix search queries * use elastic for saving page * fix test failure * update getArticle api to use elastic * use generic get page function * add elastic migration python script * fix bulk helper param * save elastic page id in article_saving_request instead of postgres article_id * fix page archiving and deleting * add tests for deleteArticle * remove custom date type in elastic mappings which not exist in older version of elastic * fix timestamp format issue * add tests for save reading progress * add tests for save file * optimize search results * add alias to index * update migration script to receive env var as params * Add failing test to validate we don't decrease reading progress This test is failing with Elastic because we aren't fetching the reading progress from elastic here, and are fetching it from postgres. * Rename readingProgress to readingProgressPercent This is the name stored in elastic, so fixes issues pulling the value out. * Linting * Add failing test for creating highlights w/elastic This test fails because the highlight can't be looked up. Is there a different ID we should be passing in to query for highlights, or do we need to update the query to look for elastic_id? * add tests code coverage threshold * update nyc config * include more files in test coverage * change alias name * update updateContent to update pages in elastic * remove debug log * fix createhighlight test * search pages by alias in elastic * update set labels and delete labels in elastic * migration script enumeration * make BULK_SIZE an env var * fix pdf search indexing * debug github action exit issue * call pubsub when create/update/delete page in elastic * fix json parsing bug and reduce reading data from file * replace a depreciated pubsub api call * debug github action exit issue * debug github action exit issue * add handler to upload elastic page data to GCS * fix tests * Use http_auth instead of basic_auth * add index creation and existing postgres tables update in migration script * fix a typo to connect to elastic * rename readingProgress to readingProgressPercent * migrate elastic_page_id in highlights and article_saving_request tables * update migration script to include number of updated rows * update db migration query * read index mappings from file * fix upload pages to gcs * fix tests failure due to pageContext * fix upload file id not exist error * Handle savedAt & isArchived attributes w/out quering elastic * Fix prettier issues * fix content-type mismatching * revert pageId to linkId because frontend was not deployed yet * fix newsletters and attachment not saved in elastic * put linkId in article for setting labels * exclude orginalHtml in the result of searching to improve performace * exclude content in the result of searching to improve performace * remove score sorting * do not refresh immediately to reduce searching and indexing time * do not replace the backup data in gcs * fix no article id defined in articleSavingRequest * add logging of elastic api running time * reduce home feed pagination size to 15 * reduce home feed pagination size to 10 * stop revalidating first page * do not use a separate api to fetch reading progress * Remove unused comment * get reading progress if not exists * replace ngram tokenizer with standard tokenizer * fix tests * remove .env.local * add sort keyword in searching to sort by score Co-authored-by: Hongbo Wu <hongbo@omnivore.app>
2022-03-16 04:08:59 +00:00
2022-02-11 17:24:33 +00:00
api:
build:
context: .
dockerfile: ./packages/api/Dockerfile
container_name: "omnivore-api"
ports:
- "4000:8080"
healthcheck:
test: ["CMD-SHELL", "nc -z 0.0.0.0 8080 || exit 1"]
interval: 15s
timeout: 90s
2022-02-11 17:24:33 +00:00
environment:
- API_ENV=local
- PG_HOST=postgres
- PG_USER=app_user
- PG_PASSWORD=app_pass
- PG_DB=omnivore
- PG_PORT=5432
- PG_POOL_MAX=20
2022-04-01 07:51:28 +00:00
- JAEGER_HOST=jaeger
2022-02-11 17:24:33 +00:00
- IMAGE_PROXY_SECRET=some-secret
- JWT_SECRET=some_secret
- SSO_JWT_SECRET=some_sso_secret
- CLIENT_URL=http://localhost:3000
- GATEWAY_URL=http://localhost:8080/api
- CONTENT_FETCH_URL=http://content-fetch:8080/?token=some_token
- REDIS_URL='redis://redis:6379'
2022-02-11 17:24:33 +00:00
depends_on:
migrate:
condition: service_completed_successfully
web:
build:
context: .
dockerfile: ./packages/web/Dockerfile
args:
- APP_ENV=prod
- BASE_URL=http://localhost:3000
2022-02-11 17:24:33 +00:00
- SERVER_BASE_URL=http://localhost:4000
- HIGHLIGHTS_BASE_URL=http://localhost:3000
2022-02-11 17:24:33 +00:00
container_name: "omnivore-web"
ports:
- "3000:8080"
environment:
- NEXT_PUBLIC_APP_ENV=prod
- NEXT_PUBLIC_BASE_URL=http://localhost:3000
- NEXT_PUBLIC_SERVER_BASE_URL=http://localhost:4000
- NEXT_PUBLIC_HIGHLIGHTS_BASE_URL=http://localhost:3000
2022-02-11 17:24:33 +00:00
depends_on:
api:
condition: service_healthy
content-fetch:
build:
context: .
2022-10-06 04:57:30 +00:00
dockerfile: ./packages/content-fetch/Dockerfile
container_name: "omnivore-content-fetch"
ports:
- "9090:8080"
environment:
- JWT_SECRET=some_secret
2022-06-17 21:59:42 +00:00
- VERIFICATION_TOKEN=some_token
- REST_BACKEND_ENDPOINT=http://api:8080/api
2024-05-13 07:35:07 +00:00
- REDIS_URL=redis://redis:6379
depends_on:
2024-05-13 07:35:07 +00:00
redis:
condition: service_healthy
api:
condition: service_healthy
redis:
image: "redis:7.2.4"
container_name: "omnivore-redis"
ports:
- "6379:6379"
2024-05-13 07:11:37 +00:00
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]