Last active
January 29, 2026 13:10
-
-
Save kkroesch/86a59159331d2c6acbe7764d949a1391 to your computer and use it in GitHub Desktop.
Starting a PostgreSQL, Elasticsearch and Redis environment for testing purposes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "0.5" | |
| vars: | |
| ELASTIC_VERSION: "8.18.1" | |
| POSTGRES_PORT: "5432" | |
| DATA_DIR: "./data" | |
| processes: | |
| postgres: | |
| command: | | |
| initdb -D ./data/postgres || true | |
| postgres -D ./data/postgres -p 5432 | |
| environment: | |
| - PGHOST=localhost | |
| - PGPORT=5432 | |
| readiness_probe: | |
| exec: | |
| command: pg_isready -h localhost -p 5432 | |
| initial_delay_seconds: 2 | |
| period_seconds: 2 | |
| elasticsearch: | |
| command: | | |
| if [ ! -d ./vendor/elasticsearch-${ELASTIC_VERSION} ]; then | |
| mkdir -p ./vendor | |
| curl -L -o ./vendor/es.tar.gz https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTIC_VERSION}-linux-x86_64.tar.gz | |
| tar xzf ./vendor/es.tar.gz -C ./vendor | |
| rm ./vendor/es.tar.gz | |
| fi | |
| ./vendor/elasticsearch-${ELASTIC_VERSION}/bin/elasticsearch | |
| environment: | |
| - ES_JAVA_OPTS=-Xms256m -Xmx256m | |
| - discovery.type=single-node | |
| - xpack.security.enabled=false | |
| - path.data=./data/elasticsearch | |
| - path.logs=./data/elasticsearch/logs | |
| readiness_probe: | |
| http_get: | |
| host: localhost | |
| port: 9200 | |
| path: /_cluster/health | |
| initial_delay_seconds: 5 | |
| period_seconds: 3 | |
| redis: | |
| command: | | |
| mkdir -p ./data/redis | |
| redis-server --dir ./data/redis --port 6379 | |
| readiness_probe: | |
| exec: | |
| command: redis-cli -p 6379 ping | |
| initial_delay_seconds: 1 | |
| period_seconds: 2 | |
| init: | |
| command: psql -h localhost -p 5432 -U $(whoami) -d postgres -f init.sql | |
| disabled: ${SKIP_INIT:-false} | |
| availability: | |
| restart: "no" | |
| exit_on_end: false | |
| depends_on: | |
| postgres: | |
| condition: process_healthy |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can skip the initialization like so: