Skip to content
Merged
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
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Database Config
POSTGRES_DB=acm
POSTGRES_USER=acmsecy
POSTGRES_PASSWORD=acmheads

# SMTP Config (for sending emails)
SMTP_EMAIL=your_email@gmail.com
SMTP_PASSWORD=your_password
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,29 @@ Backend of the official website of PEC ACM CSS

> You need Intellij IDEA Ultimate, avail it by student discount

### For Frontend Development (Docker)

1. Create `.env` file:
```bash
cp .env.example .env
```
Edit `.env` with your credentials (especially POSTGRES_PASSWORD and SMTP credentials)

2. Start the backend:
```bash
docker-compose up -d
```

3. Backend is now running at: `http://localhost:8080`

4. When done, stop the backend:
```bash
docker-compose stop
```

> [!WARNING]
> Use `docker-compose stop` to pause services. Only use `docker-compose down` if you want to completely remove containers and networks. Use `docker-compose down -v` to also remove database data (full reset).

## Instructions

- Always work in separate branch for each feature.
Expand Down
36 changes: 25 additions & 11 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,41 @@ services:
image: 'postgres:15'
container_name: postgres-database
environment:
- POSTGRES_DB=acm
- POSTGRES_USER=acmsecy
- POSTGRES_PASSWORD=acmheads
ports:
- "5432:5432"
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
volumes:
- db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U acmsecy -d acm"]
interval: 5s
timeout: 5s
retries: 5
networks:
- acm-network


backend:
image : 6791042/seed-acm-backend:latest
container_name: acm-backend
environment:
- POSTGRESQL_DB_URL=jdbc:postgresql://postgres-database:5432/acm
- POSTGRESQL_DB_USER=acmsecy
- POSTGRESQL_DB_PASSWORD=acmheads
- SMTP_EMAIL=youremail@gmail.com
- SMTP_PASSWORD=yourpassword
- POSTGRESQL_DB_URL=jdbc:postgresql://postgres-database:5432/${POSTGRES_DB}
- POSTGRESQL_DB_USER=${POSTGRES_USER}
- POSTGRESQL_DB_PASSWORD=${POSTGRES_PASSWORD}
- SMTP_EMAIL=${SMTP_EMAIL}
- SMTP_PASSWORD=${SMTP_PASSWORD}
ports:
- "8080:8080"
depends_on:
- postgres-database
postgres-database:
condition: service_healthy
restart: unless-stopped
networks:
- acm-network

volumes:
db-data:

networks:
acm-network:
driver: bridge
Loading