Skip to content

Commit ebacb36

Browse files
committed
chore: add docker-compose configuration and update deployment docs
1 parent e5a29d7 commit ebacb36

File tree

3 files changed

+111
-9
lines changed

3 files changed

+111
-9
lines changed

README.md

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ Complete API documentation is available at **https://js.gs/api/reference**
2525

2626
### Prerequisites
2727

28-
- **Bun** runtime
28+
- **Node.js** 24+ (with TypeScript support)
29+
- **pnpm** package manager
2930
- **PostgreSQL** 14+ database
3031
- **ClickHouse** server for analytics storage
3132
- **Redis** (optional, for caching)
@@ -34,17 +35,17 @@ Complete API documentation is available at **https://js.gs/api/reference**
3435

3536
```bash
3637
# Install dependencies
37-
bun install
38+
pnpm install
3839

3940
# Build the application
40-
bun run build
41+
pnpm run build
4142
```
4243

4344
### Development
4445

4546
```bash
4647
# Start development server
47-
bun run dev
48+
pnpm run dev
4849
```
4950

5051
The application will be available at `http://localhost:3000`
@@ -53,21 +54,69 @@ The application will be available at `http://localhost:3000`
5354

5455
```bash
5556
# Build the application
56-
bun run build
57+
pnpm run build
5758

5859
# Start production server
59-
bun run preview
60+
pnpm run preview
6061
```
6162

6263
#### Docker Deployment
6364

65+
##### Option 1: Using Docker Compose (Recommended)
66+
67+
```bash
68+
# Copy environment variables
69+
cp .env.example .env
70+
71+
# Edit .env file to configure your database and services
72+
# nano .env
73+
74+
# Start the application
75+
docker-compose up -d
76+
77+
# View logs
78+
docker-compose logs -f app
79+
80+
# Stop the application
81+
docker-compose down
82+
```
83+
84+
The application will be available at `http://localhost:3000`
85+
86+
##### Option 2: Using Docker Run
87+
88+
```bash
89+
# Pull the official image
90+
docker pull demomacro/js.gs:latest
91+
92+
# Run container
93+
docker run -d \
94+
--name js-gs \
95+
-p 3000:3000 \
96+
--env-file .env \
97+
--restart unless-stopped \
98+
demomacro/js.gs:latest
99+
100+
# View logs
101+
docker logs -f js-gs
102+
103+
# Stop the container
104+
docker stop js-gs
105+
docker rm js-gs
106+
```
107+
108+
##### Option 3: Build from Source
109+
64110
```bash
65111
# Build Docker image
66112
docker build -t js.gs .
67113

68114
# Run container
69-
docker run -p 3000:3000 \
115+
docker run -d \
116+
--name js-gs \
117+
-p 3000:3000 \
70118
--env-file .env \
119+
--restart unless-stopped \
71120
js.gs
72121
```
73122

docker-compose.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
services:
2+
app:
3+
image: demomacro/js.gs:latest
4+
container_name: js-gs-app
5+
restart: unless-stopped
6+
ports:
7+
- "3000:3000"
8+
environment:
9+
# Better Auth Configuration
10+
BETTER_AUTH_URL: ${BETTER_AUTH_URL}
11+
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET}
12+
13+
# Database Configuration
14+
DATABASE_URL: ${DATABASE_URL}
15+
16+
# ClickHouse Configuration
17+
CLICKHOUSE_URL: ${CLICKHOUSE_URL}
18+
CLICKHOUSE_USERNAME: ${CLICKHOUSE_USERNAME}
19+
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD}
20+
CLICKHOUSE_DATABASE: ${CLICKHOUSE_DATABASE}
21+
22+
# Redis Configuration
23+
REDIS_URL: ${REDIS_URL}
24+
25+
# Admin User Configuration
26+
ADMIN_EMAIL: ${ADMIN_EMAIL}
27+
ADMIN_NAME: ${ADMIN_NAME}
28+
ADMIN_USERNAME: ${ADMIN_USERNAME}
29+
ADMIN_PASSWORD: ${ADMIN_PASSWORD}
30+
31+
# Resend Email Service
32+
RESEND_API_KEY: ${RESEND_API_KEY}
33+
RESEND_FROM_EMAIL: ${RESEND_FROM_EMAIL}
34+
35+
# Build Configuration
36+
SKIP_MIGRATE: ${SKIP_MIGRATE:-false}
37+
38+
# Node Environment
39+
NODE_ENV: production
40+
networks:
41+
- js-gs-network
42+
healthcheck:
43+
test:
44+
["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
45+
interval: 30s
46+
timeout: 10s
47+
retries: 3
48+
start_period: 40s
49+
50+
networks:
51+
js-gs-network:
52+
driver: bridge
53+
name: js-gs-network

pm2.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const apps = [
22
{
33
name: "JS.GS",
4-
script: "bun",
5-
args: ".output/server/index.mjs",
4+
script: "node",
5+
args: "--env-file=.env .output/server/index.mjs",
66
},
77
];

0 commit comments

Comments
 (0)