Skip to content
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
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Create a .env file in root directory and add these values. You can simply copy it as cp .env.example .env
# Then run docker compose -f docker-compose.dev.yml up to start postgres inside docker and run migrations if you want
# Don't forget to add the same username, password and DB name to run backend api at /apps/api inside .env

POSTGRES_DB=opensox
POSTGRES_PASSWORD=opensox_dev_password
POSTGRES_USER=opensox
42 changes: 7 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,44 +227,16 @@ docker run -p 4000:4000 \

Your API server will be available at `http://localhost:4000`.

### Using Docker Compose (Optional)

For a complete setup with PostgreSQL, you can create a `docker-compose.yml` file:

```yaml
version: '3.8'
services:
postgres:
image: postgres:15
environment:
POSTGRES_USER: opensox
POSTGRES_PASSWORD: opensox
POSTGRES_DB: opensox
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data

api:
build: .
ports:
- "4000:4000"
environment:
DATABASE_URL: postgresql://opensox:opensox@postgres:5432/opensox?schema=public
JWT_SECRET: your-secret-key
PORT: 4000
NODE_ENV: production
depends_on:
- postgres

volumes:
postgres_data:
```
### Using Docker Compose for Database (Only)

Then run:
For a DB setup with PostgreSQL, cp .env.example .env in root directory with required variables, then run docker-compose.dev.yml

```bash
docker-compose up -d
cp .env.example .env
```
Then run,
```bash
docker-compose -f docker-compose.dev.yml up -d
```

## Our contributors
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

services:
postgres:
image: postgres:18
env_file:
- .env
ports:
- "5432:5432"
volumes:
- opensox_postgres_data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 10s
timeout: 5s
retries: 5

volumes:
opensox_postgres_data: