Skip to content

Commit 6d3196d

Browse files
committed
fix: update container name for rust-app in docker-compose
1 parent 91bc521 commit 6d3196d

File tree

2 files changed

+99
-37
lines changed

2 files changed

+99
-37
lines changed

docker-compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
rust-app:
2525
image: ${BACKEND_IMAGE_NAME}
2626
platform: ${PLATFORM}
27-
container_name: ${CONTAINER_NAME}
27+
container_name: ${BACKEND_CONTAINER_NAME}
2828
environment:
2929
POSTGRES_USER: ${POSTGRES_USER}
3030
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}

docs/runbooks/Container-README.md

+98-36
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,133 @@
1-
# Refactor Platform Docker Quickstart
1+
# Refactor Platform: Docker Quickstart
22

3-
This project uses Docker & Docker Compose for local development. It deploys a PostgreSQL database, a Rust back-end, and a Next.js front-end (all pre-built images from GitHub Container Registry).
3+
*This project uses Docker & Docker Compose for local development. It deploys a PostgreSQL database, a Rust back-end, and a Next.js front-end (all pre-built images from GitHub Container Registry).*
44

55
## Prerequisites
66

77
- Docker (v20+)
88
- Docker Compose (v1.29+)
9-
- A configured .env file (see examples)
9+
- A configured .env file (see below)
1010

11-
## Steps & Commands
11+
## Example .env File
1212

13-
1. Clone the repository & set up the environment:
13+
Below is an example of a complete and correct .env file. Copy this content (or adjust values as needed) and save it as .env in the project root.
1414

1515
```bash
16-
git clone <repository-url> && cd <repository-directory>
17-
```
18-
19-
## Copy the example .env file and adjust values as needed
16+
# ==============================
17+
# PostgreSQL Configuration
18+
# ==============================
19+
POSTGRES_USER=refactor # PostgreSQL username
20+
POSTGRES_PASSWORD=password # PostgreSQL password
21+
POSTGRES_DB=refactor # PostgreSQL database name
22+
POSTGRES_HOST=postgres # Hostname for the PostgreSQL container (set in docker-compose)
23+
POSTGRES_PORT=5432 # Internal PostgreSQL port
24+
POSTGRES_SCHEMA=refactor_platform # Database schema
25+
# DATABASE_URL used by the Rust back-end to connect to Postgres
26+
DATABASE_URL=postgres://refactor:password@postgres:5432/refactor
27+
28+
# ==============================
29+
# Rust Back-end Configuration
30+
# ==============================
31+
BACKEND_CONTAINER_NAME=refactor-platform # Name for the Rust back-end container
32+
BACKEND_IMAGE_NAME=ghcr.io/refactor-group/refactor-platform-rs/<branch-name>:latest
33+
# Pre-built image for the Rust back-end from GHCR
34+
BACKEND_ENV=development # Environment (development/production)
35+
BACKEND_ALLOWED_ORIGINS=* # Allowed CORS origins
36+
BACKEND_LOG_FILTER_LEVEL=DEBUG # Logging level for the back-end
37+
BACKEND_PORT=4000 # Port on which the Rust back-end listens
38+
BACKEND_INTERFACE=0.0.0.0 # Interface for the Rust back-end
39+
BACKEND_SERVICE_PROTOCOL=http # Protocol (usually http)
40+
BACKEND_SERVICE_PORT=4000 # Derived service port
41+
BACKEND_SERVICE_HOST=localhost # Hostname used by the service
42+
BACKEND_API_VERSION=0.0.1 # API version
43+
44+
# ==============================
45+
# Next.js Front-end Configuration
46+
# ==============================
47+
FRONTEND_IMAGE_NAME=ghcr.io/refactor-group/refactor-platform-fe/<branch-name>:latest
48+
# Pre-built image for the Next.js front-end from GHCR
49+
FRONTEND_CONTAINER_NAME=refactor-platform-frontend # Name for the front-end container
50+
FRONTEND_SERVICE_INTERFACE=0.0.0.0 # Interface for the front-end service
51+
FRONTEND_SERVICE_PORT=3000 # Port for the front-end service
52+
53+
# ==============================
54+
# TipTap Service Configuration
55+
# ==============================
56+
TIPTAP_URL="https://ok01532m.collab.tiptap.cloud" # URL for the TipTap service
57+
TIPTAP_AUTH_KEY="6122462e59d7cc8c6146f4e3b5c93dfad28c8a219838df69b59ffcec4cdc0041"
58+
# Authentication key for TipTap
59+
TIPTAP_JWT_SIGNING_KEY="0f38cb0650a8fc262258ad415f25c52579bfc4095b222f486557d24c8fafaeb8" # JWT signing key for TipTap
60+
```
2061

21-
```bash
22-
cp .env.example .env
23-
```
62+
## Steps & Commands
2463

25-
2. Use Docker Compose to build and start services:
26-
docker-compose --env-file .env up --build
64+
1. **Clone the repository & set up the environment:**
2765

28-
## This starts PostgreSQL (local), the Rust back-end, and the Next.js front-end
66+
```bash
67+
# Clone the repository and change into the project directory
68+
git clone <repository-url> && cd <repository-directory>
69+
70+
# Copy the example .env file and adjust values as needed
71+
cp .env.example .env
72+
```
2973

30-
3. Basic Management Commands:
74+
1. **Build and Start the Containers with Docker Compose:**
3175

32-
```bash
33-
docker-compose ps # List running containers
34-
docker-compose logs -f # Follow logs; press Ctrl+C to exit
35-
docker-compose restart rust-app # Restart the Rust back-end service
36-
docker-compose down # Stop and remove all containers and networks
37-
docker-compose down -v # Also remove volumes for a fresh start
38-
docker-compose exec rust-app cargo check # Run a command inside the Rust back-end container
39-
docker-compose exec rust-app cargo run # Run the Rust back-end application
76+
```bash
77+
docker-compose --env-file .env up --build
78+
# This command starts:
79+
# - PostgreSQL (local)
80+
# - Rust back-end
81+
# - Next.js front-end
4082
```
4183

42-
4. Direct Docker Commands (Optional):
84+
1. **Basic Management Commands:**
4385

44-
<!-- Pull the Rust back-end image from GHCR (if not built locally) -->
4586
```bash
46-
docker pull ghcr.io/refactor-group/refactor-platform-rs/your-tag:latest # Replace 'your-tag' accordingly
87+
docker-compose ps # List running containers
88+
docker-compose logs -f # Follow live logs (press Ctrl+C to exit)
89+
docker-compose restart rust-app # Restart the Rust back-end container
90+
docker-compose down # Stop and remove all containers and networks
91+
docker-compose down -v # Stop containers and remove volumes for a fresh start
92+
docker-compose exec rust-app cargo check # Run 'cargo check' inside the Rust back-end container
93+
docker-compose exec rust-app cargo run # Run the Rust back-end application
94+
docker-compose ps # List running containers
95+
docker-compose logs -f # Follow live logs (press Ctrl+C to exit)
96+
docker-compose restart rust-app # Restart the Rust back-end container
97+
docker-compose exec rust-app cargo check # Run 'cargo check' inside the Rust back-end container
98+
docker-compose exec rust-app cargo run # Run the Rust back-end application
4799
```
48100

49-
## Run the Rust back-end image directly
101+
1. **Direct Docker Commands (Optional):**
50102

51103
```bash
104+
# Pull the Rust back-end image from GHCR (if not built locally)
105+
docker pull ghcr.io/refactor-group/refactor-platform-rs/your-tag:latest # Replace 'your-tag' as needed
106+
107+
# Run the Rust back-end image directly
52108
docker run -p 4000:4000 --env-file .env --name refactor-backend ghcr.io/refactor-group/refactor-platform-rs/your-tag:latest
53109
```
54-
55-
4. **Debugging / Troubleshooting:**
56110

57-
```bash
111+
**Note:** *By default, Docker Compose uses locally cached images. The remote image is pulled only once unless you force a new pull using commands like `docker-compose pull` or by passing the `--no-cache` flag.*
58112

113+
1. **Debugging & Troubleshooting:**
114+
115+
```bash
116+
docker-compose exec rust-app bash # Access a shell in the Rust back-end container
117+
docker-compose exec rust-app env # View environment variables in the Rust back-end container
118+
docker-compose exec postgres bash # Access a shell in the PostgreSQL container
119+
docker-compose exec postgres pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
120+
# Verify PostgreSQL is ready
59121
docker-compose exec rust-app bash # Access a shell in the Rust back-end container
60122
docker-compose exec rust-app env # Check environment variables inside the rust-app container
61123
docker-compose exec postgres bash # Access a shell in the PostgreSQL container for troubleshooting
62124
docker-compose exec postgres pg_isready -U $POSTGRES_USER -d $POSTGRES_DB # Verify PostgreSQL is ready
125+
docker-compose exec rust-app cargo test # Run tests inside the Rust back-end container
63126
```
64127

65-
**Notes:**
128+
**Final Notes:**
66129

67130
- Ensure your `.env` file includes required variables such as `POSTGRES_USER`, `POSTGRES_PASSWORD`, `POSTGRES_DB`, `DATABASE_URL`, `BACKEND_PORT`, `BACKEND_INTERFACE`, `BACKEND_ALLOWED_ORIGINS`, `BACKEND_LOG_FILTER_LEVEL`, etc.
68-
- The nextjs-app service uses the pre-built image from GHCR (update the image name if necessary).
69-
- If using docker-compose, the `.env` file located in the project root is automatically loaded.
70-
71-
*This guide provides all essential commands to safely work with the containers using Docker and Docker Compose.*
131+
- Docker Compose automatically loads the `.env` file located in the project root.
132+
- The pre-built images from GHCR for both the Rust back-end and the Next.js front-end are used by default. These remote images are only pulled if not already available locally, unless a pull is forced.
133+
- The commands above follow best practices and help ensure a reliable setup every time you run the project.

0 commit comments

Comments
 (0)