Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up docker-compose to replace the startup scripts #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ cargo run --bin forc.pub
Before starting the server, the local database must be up and running.

```sh
./scripts/start_local_db.sh
docker compose up
```

Next, set up the environment by filling in the `.env` file with your Pinata test gateway details.
Expand Down
38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3.8'

services:
postgres:
image: postgres:latest
container_name: forc_pub_db
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB_NAME}
ports:
- "${POSTGRES_PORT}:${POSTGRES_PORT}"
volumes:
- postgres_data:/var/lib/postgresql/data

pgadmin:
image: dpage/pgadmin4:latest
container_name: pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: admin
ports:
- "5050:80"
depends_on:
- postgres

migrations:
image: rust:latest
container_name: migrations
volumes:
- .:/app
working_dir: /app
command: bash -c "cargo install diesel_cli --no-default-features --features postgres && diesel migration run"
depends_on:
- postgres

volumes:
postgres_data:
36 changes: 0 additions & 36 deletions scripts/start_local_db.sh

This file was deleted.

8 changes: 4 additions & 4 deletions scripts/start_local_server.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash

# Start the PostgreSQL container
./scripts/start_local_db.sh

# Source environment variables
source .env

Expand Down Expand Up @@ -57,6 +54,9 @@ if [[ "$(docker ps -aqf name=$CONTAINER_NAME)" ]]; then
fi
fi

# Start the services using docker-compose
docker-compose up -d

# Start the Docker container on the same network as the PostgreSQL container
docker run \
--rm -d \
Expand All @@ -69,4 +69,4 @@ docker run \
-e POSTGRES_DB_NAME=$POSTGRES_DB_NAME \
$CONTAINER_NAME

echo "Server container started successfully."
echo "Server container started successfully."