Skip to content
This repository was archived by the owner on Jul 27, 2025. It is now read-only.

Commit 3e64aa2

Browse files
committed
chore: release version v0.2.0
- Added Playwright service and configuration - Added configurable Docker images - Enhanced Redis persistence - Updated environment templates
1 parent 03dbfb5 commit 3e64aa2

File tree

9 files changed

+96
-10
lines changed

9 files changed

+96
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ENV/
2020
!db.env.example
2121
!minio.env.example
2222
!frontend.env.example
23+
!playwright.env.example
2324

2425
# Backup directories
2526
.config_backup/

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [v0.2.0] - 2025-01-15
6+
7+
### Added
8+
- Added Playwright service for web automation
9+
- Added Redis data volume for persistence
10+
- Added support for configurable Docker images through environment variables
11+
- Added playwright.env.example template
12+
13+
### Changed
14+
- Updated Docker Compose configuration to use environment variables for image versions
15+
- Modified frontend Dockerfile to use configurable image from environment
16+
- Updated environment templates with new variables
17+
- Enhanced install script to handle missing environment variables
18+
19+
### Infrastructure
20+
- Added configurable image versions for all services:
21+
- WATER_CRAWL_BACKEND_IMAGE
22+
- WATER_CRAWL_FRONTEND_IMAGE
23+
- NEGINX_IMAGE
24+
- MINIO_IMAGE
25+
- POSTGRES_IMAGE
26+
- REDIS_IMAGE
27+
- PLAYWRIGHT_IMAGE

docker-compose.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ x-app: &app
22
build:
33
context: watercrawl
44
dockerfile: Dockerfile
5+
args:
6+
- WATER_CRAWL_BACKEND_IMAGE
57
env_file:
68
- app.env
79
volumes:
@@ -26,12 +28,14 @@ services:
2628
build:
2729
context: frontend
2830
dockerfile: Dockerfile
31+
args:
32+
- WATER_CRAWL_FRONTEND_IMAGE
2933
restart: always
3034
env_file:
3135
- frontend.env
3236

3337
nginx:
34-
image: nginx:1.25-alpine
38+
image: ${NEGINX_IMAGE:-nginx:1.25-alpine}
3539
restart: always
3640
ports:
3741
- "80:80"
@@ -43,7 +47,7 @@ services:
4347
- app
4448

4549
# minio:
46-
# image: minio/minio:RELEASE.2024-11-07T00-52-20Z
50+
# image: {MINIO_IMAGE:-minio/minio:RELEASE.2024-11-07T00-52-20Z}
4751
# restart: always
4852
# volumes:
4953
# - minio-data:/data
@@ -56,7 +60,7 @@ services:
5660
# timeout: 20s
5761

5862
postgres:
59-
image: postgres:17.2-alpine3.21
63+
image: ${POSTGRES_IMAGE:-postgres:17.2-alpine3.21}
6064
restart: always
6165
env_file:
6266
- db.env
@@ -67,9 +71,17 @@ services:
6771
interval: 5s
6872
timeout: 5s
6973

74+
playwright:
75+
image: ${PLAYWRIGHT_IMAGE:-watercrawl/playwright:1.1}
76+
restart: always
77+
env_file:
78+
- playwright.env
79+
7080
redis:
71-
image: redis:latest
81+
image: ${REDIS_IMAGE:-redis:7.2-alpine}
7282
restart: always
83+
volumes:
84+
- redis-data:/data
7385

7486
volumes:
7587
postgres-db:

env_templates/.env.example

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
VERISON=latest
1+
WATER_CRAWL_BACKEND_IMAGE=watercrawl/watercrawl:latest
2+
WATER_CRAWL_FRONTEND_IMAGE=watercrawl/frontend:latest
3+
NEGINX_IMAGE=nginx:1.25-alpine
4+
MINIO_IMAGE=minio/minio:RELEASE.2024-11-07T00-52-20Z
5+
POSTGRES_IMAGE=postgres:17.2-alpine3.21
6+
REDIS_IMAGE=redis:7.2-alpine

env_templates/app.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,5 @@ IS_GOOGLE_LOGIN_ACTIVE=False
8585
# EMAIL_HOST_PASSWORD=
8686
# DEFAULT_FROM_EMAIL=info@example.com
8787

88+
PLAYWRIGHT_SERVER=http://playwright:8000
89+
PLAYWRIGHT_API_KEY=your-secret-api-key
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
AUTH_API_KEY=your_auth_api_key_here
2+
PORT=8000
3+
HOST=0.0.0.0

frontend/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
FROM watercrawl/frontend:latest
1+
ARG WATER_CRAWL_FRONTEND_IMAGE
2+
FROM ${WATER_CRAWL_FRONTEND_IMAGE}

install.sh

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,24 @@ safe_replace() {
111111
fi
112112
}
113113

114+
add_missing_variables() {
115+
local example_file="$1"
116+
local env_file="$2"
117+
118+
while IFS='=' read -r key value; do
119+
# Skip lines that start with '#'
120+
if [[ $key == \#* || -z $key ]]; then
121+
continue
122+
fi
123+
if ! grep -q "^$key=" "$env_file"; then
124+
echo "$key=$value" >> "$env_file"
125+
fi
126+
done < "$example_file"
127+
}
128+
114129
# Function to validate required example files
115130
validate_example_files() {
116-
local example_files=("env_templates/app.env.example" "env_templates/db.env.example" "env_templates/minio.env.example" "env_templates/frontend.env.example" "env_templates/.env.example")
131+
local example_files=("env_templates/app.env.example" "env_templates/db.env.example" "env_templates/minio.env.example" "env_templates/frontend.env.example" "env_templates/playwright.env.example" "env_templates/.env.example")
117132

118133
for file in "${example_files[@]}"; do
119134
if [[ ! -f "$file" ]]; then
@@ -125,7 +140,7 @@ validate_example_files() {
125140

126141
# Function to validate environment files
127142
validate_env_files() {
128-
local files=("app.env" "db.env" "frontend.env")
143+
local files=("app.env" "db.env" "frontend.env" "playwright.env")
129144

130145
for file in "${files[@]}"; do
131146
if [[ ! -f "$file" ]]; then
@@ -140,6 +155,7 @@ REINSTALL=false
140155
DEBUG=false
141156
DB_FILE_EXISTS=$([ -f db.env ] && echo "true" || echo "false")
142157
APP_FILE_EXISTS=$([ -f app.env ] && echo "true" || echo "false")
158+
PLAYWRIGHT_FILE_EXISTS=$([ -f playwright.env ] && echo "true" || echo "false")
143159

144160
for arg in "$@"; do
145161
case $arg in
@@ -197,14 +213,22 @@ WEBSITE_URL="${WEBSITE_PROTOCOL}://${WEBSITE_DOMAIN}"
197213
# STORAGE_URL="${STORAGE_PROTOCOL}://${STORAGE_DOMAIN}"
198214

199215
# Copy and configure environment files
200-
for env in app db frontend; do
216+
for env in app db frontend playwright; do
201217
if [[ -f "env_templates/${env}.env.example" && ! -f "${env}.env" ]]; then
202218
echo "Creating ${env}.env..."
203219
cp "env_templates/${env}.env.example" "${env}.env"
220+
else
221+
echo -e "${YELLOW}${env}.env already exists. checking for missing variables...${NC}"
222+
add_missing_variables "env_templates/${env}.env.example" "${env}.env"
204223
fi
205224

206225
done
207226

227+
if [[ -f "env_templates/.env.example" && ! -f ".env" ]]; then
228+
echo "Creating .env..."
229+
cp "env_templates/.env.example" ".env"
230+
fi
231+
208232
# Generate secrets and configure app.env
209233
if [[ -f app.env ]]; then
210234
safe_replace "app.env" "ALLOWED_HOSTS" "$WEBSITE_DOMAIN"
@@ -242,6 +266,16 @@ if [[ -f frontend.env ]]; then
242266
safe_replace "frontend.env" "VITE_API_URL" "$WEBSITE_URL"
243267
fi
244268

269+
if [[ -f playwright.env ]]; then
270+
if [[ "$PLAYWRIGHT_FILE_EXISTS" == "true" ]]; then
271+
echo -e "\n${YELLOW}playwright.env already exists. Skipping API key generation.${NC}"
272+
else
273+
AUTH_API_KEY=$(generate_random_string 32)
274+
safe_replace "playwright.env" "AUTH_API_KEY" "$AUTH_API_KEY"
275+
safe_replace "app.env" "PLAYWRIGHT_API_KEY" "$AUTH_API_KEY"
276+
fi
277+
fi
278+
245279
# Validate environment files
246280
validate_env_files
247281

watercrawl/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM watercrawl/watercrawl:latest
1+
ARG WATER_CRAWL_BACKEND_IMAGE
2+
FROM ${WATER_CRAWL_BACKEND_IMAGE}
23

34
COPY plugin_requirements.txt /var/www/plugin_requirements.txt
45

0 commit comments

Comments
 (0)