Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51767ebbdb | ||
|
|
ad91148616 | ||
|
|
38df66044d | ||
|
|
24dc99a19a | ||
|
|
907075f51d | ||
|
|
b48ac45085 | ||
|
|
b115d0a772 | ||
|
|
ad0cdfe1d9 |
@@ -15,7 +15,9 @@ services:
|
||||
- worklenz
|
||||
|
||||
backend:
|
||||
image: docker.io/chamikajaycey/worklenz-backend:latest
|
||||
build:
|
||||
context: ./worklenz-backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: worklenz_backend
|
||||
ports:
|
||||
- "3000:3000"
|
||||
@@ -51,28 +53,25 @@ services:
|
||||
depends_on:
|
||||
- minio
|
||||
entrypoint: >
|
||||
/bin/sh -c "
|
||||
# Wait for MinIO to be available
|
||||
echo 'Waiting for MinIO to start...'
|
||||
sleep 15;
|
||||
# Retry up to 5 times
|
||||
for i in 1 2 3 4 5; do
|
||||
echo \"Attempt $$i to connect to MinIO...\"
|
||||
if /usr/bin/mc config host add myminio http://minio:9000 minioadmin minioadmin; then
|
||||
echo \"Successfully connected to MinIO!\"
|
||||
/usr/bin/mc mb --ignore-existing myminio/worklenz-bucket;
|
||||
/usr/bin/mc policy set public myminio/worklenz-bucket;
|
||||
exit 0;
|
||||
fi
|
||||
echo \"Connection failed, retrying in 5 seconds...\"
|
||||
sleep 5;
|
||||
done
|
||||
echo \"Failed to connect to MinIO after 5 attempts\"
|
||||
exit 1;
|
||||
"
|
||||
/bin/sh -c '
|
||||
echo "Waiting for MinIO to start...";
|
||||
sleep 15;
|
||||
for i in 1 2 3 4 5; do
|
||||
echo "Attempt $i to connect to MinIO...";
|
||||
if /usr/bin/mc config host add myminio http://minio:9000 minioadmin minioadmin; then
|
||||
echo "Successfully connected to MinIO!";
|
||||
/usr/bin/mc mb --ignore-existing myminio/worklenz-bucket;
|
||||
/usr/bin/mc policy set public myminio/worklenz-bucket;
|
||||
exit 0;
|
||||
fi
|
||||
echo "Connection failed, retrying in 5 seconds...";
|
||||
sleep 5;
|
||||
done;
|
||||
echo "Failed to connect to MinIO after 5 attempts";
|
||||
exit 1;
|
||||
'
|
||||
networks:
|
||||
- worklenz
|
||||
|
||||
db:
|
||||
image: postgres:15
|
||||
container_name: worklenz_db
|
||||
@@ -94,22 +93,19 @@ services:
|
||||
target: /docker-entrypoint-initdb.d
|
||||
consistency: cached
|
||||
command: >
|
||||
bash -c '
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
bash -c ' if command -v apt-get >/dev/null 2>&1; then
|
||||
apt-get update && apt-get install -y dos2unix
|
||||
elif command -v apk >/dev/null 2>&1; then
|
||||
apk add --no-cache dos2unix
|
||||
fi &&
|
||||
find /docker-entrypoint-initdb.d -type f -name "*.sh" -exec sh -c '\''
|
||||
fi && find /docker-entrypoint-initdb.d -type f -name "*.sh" -exec sh -c '\''
|
||||
dos2unix "{}" 2>/dev/null || true
|
||||
chmod +x "{}"
|
||||
'\'' \; &&
|
||||
exec docker-entrypoint.sh postgres
|
||||
'
|
||||
'\'' \; && exec docker-entrypoint.sh postgres '
|
||||
|
||||
volumes:
|
||||
worklenz_postgres_data:
|
||||
worklenz_minio_data:
|
||||
|
||||
|
||||
networks:
|
||||
worklenz:
|
||||
|
||||
24
start.bat
24
start.bat
@@ -39,6 +39,12 @@ IF %ERRORLEVEL% NEQ 0 (
|
||||
echo docker-compose is installed >> worklenz_startup.log
|
||||
)
|
||||
|
||||
REM Check for update-docker-env.sh
|
||||
IF EXIST update-docker-env.sh (
|
||||
echo [94mFound update-docker-env.sh script. You can use it to update environment variables.[0m
|
||||
echo Found update-docker-env.sh script >> worklenz_startup.log
|
||||
)
|
||||
|
||||
REM Run preflight checks
|
||||
echo Running Docker daemon check...
|
||||
docker info >nul 2>>worklenz_startup.log
|
||||
@@ -52,17 +58,6 @@ IF %ERRORLEVEL% NEQ 0 (
|
||||
echo Docker daemon is running >> worklenz_startup.log
|
||||
)
|
||||
|
||||
REM Check if .env file exists
|
||||
IF NOT EXIST .env (
|
||||
echo Warning: .env file not found. Using default configuration.
|
||||
echo Warning: .env file not found. Using default configuration. >> worklenz_startup.log
|
||||
IF EXIST .env.example (
|
||||
copy .env.example .env
|
||||
echo Created .env file from .env.example
|
||||
echo Created .env file from .env.example >> worklenz_startup.log
|
||||
)
|
||||
)
|
||||
|
||||
REM Stop any running containers
|
||||
echo Stopping any running containers...
|
||||
docker-compose down > nul 2>>worklenz_startup.log
|
||||
@@ -111,7 +106,7 @@ REM Check frontend
|
||||
findstr /C:"frontend" running_services.txt > nul
|
||||
IF %ERRORLEVEL% EQU 0 (
|
||||
echo [92m^✓[0m Frontend is running
|
||||
echo Frontend URL: http://localhost:5000
|
||||
echo Frontend URL: http://localhost:5000 (or https://localhost:5000 if SSL is enabled)
|
||||
echo Frontend is running >> worklenz_startup.log
|
||||
) ELSE (
|
||||
echo [91m^✗[0m Frontend service failed to start
|
||||
@@ -122,7 +117,7 @@ REM Check backend
|
||||
findstr /C:"backend" running_services.txt > nul
|
||||
IF %ERRORLEVEL% EQU 0 (
|
||||
echo [92m^✓[0m Backend is running
|
||||
echo Backend URL: http://localhost:3000
|
||||
echo Backend URL: http://localhost:3000 (or https://localhost:3000 if SSL is enabled)
|
||||
echo Backend is running >> worklenz_startup.log
|
||||
) ELSE (
|
||||
echo [91m^✗[0m Backend service failed to start
|
||||
@@ -180,6 +175,9 @@ IF %allRunning% EQU 1 (
|
||||
|
||||
echo You can access the application at: http://localhost:5000
|
||||
echo To stop the services, run: stop.bat
|
||||
echo To update environment variables, run: update-docker-env.sh
|
||||
echo.
|
||||
echo Note: To enable SSL, set ENABLE_SSL=true in your .env file and run update-docker-env.sh
|
||||
echo.
|
||||
echo For any errors, check worklenz_startup.log file
|
||||
echo.
|
||||
|
||||
19
start.sh
19
start.sh
@@ -20,14 +20,9 @@ echo " W O R K L E N Z "
|
||||
echo -e "${NC}"
|
||||
echo "Starting Worklenz Docker Environment..."
|
||||
|
||||
# Check if .env file exists
|
||||
if [ ! -f .env ]; then
|
||||
echo -e "${YELLOW}Warning: .env file not found. Using default configuration.${NC}"
|
||||
# Copy the example .env file if it exists
|
||||
if [ -f .env.example ]; then
|
||||
cp .env.example .env
|
||||
echo "Created .env file from .env.example"
|
||||
fi
|
||||
# Check if update-docker-env.sh exists and is executable
|
||||
if [ -f update-docker-env.sh ] && [ -x update-docker-env.sh ]; then
|
||||
echo -e "${BLUE}Found update-docker-env.sh script. You can use it to update environment variables.${NC}"
|
||||
fi
|
||||
|
||||
# Function to check if a service is running
|
||||
@@ -129,7 +124,7 @@ DB_STATUS=$?
|
||||
check_service "MinIO" "worklenz_minio" "http://localhost:9000/minio/health/live"
|
||||
MINIO_STATUS=$?
|
||||
|
||||
check_service "Backend" "worklenz_backend" "http://localhost:3000/api/health"
|
||||
check_service "Backend" "worklenz_backend" "http://localhost:3000/public/health"
|
||||
BACKEND_STATUS=$?
|
||||
|
||||
check_service "Frontend" "worklenz_frontend" "http://localhost:5000"
|
||||
@@ -137,8 +132,8 @@ FRONTEND_STATUS=$?
|
||||
|
||||
# Display service URLs
|
||||
echo -e "\n${BLUE}Service URLs:${NC}"
|
||||
[ $FRONTEND_STATUS -eq 0 ] && echo " • Frontend: http://localhost:5000"
|
||||
[ $BACKEND_STATUS -eq 0 ] && echo " • Backend API: http://localhost:3000"
|
||||
[ $FRONTEND_STATUS -eq 0 ] && echo " • Frontend: http://localhost:5000 (or https://localhost:5000 if SSL is enabled)"
|
||||
[ $BACKEND_STATUS -eq 0 ] && echo " • Backend API: http://localhost:3000 (or https://localhost:3000 if SSL is enabled)"
|
||||
[ $MINIO_STATUS -eq 0 ] && echo " • MinIO Console: http://localhost:9001 (login: minioadmin/minioadmin)"
|
||||
|
||||
# Check if all services are up
|
||||
@@ -152,3 +147,5 @@ fi
|
||||
echo -e "\n${BLUE}Useful commands:${NC}"
|
||||
echo " • View logs: $DOCKER_COMPOSE_CMD logs -f"
|
||||
echo " • Stop services: ./stop.sh"
|
||||
echo " • Update environment variables: ./update-docker-env.sh"
|
||||
echo -e "\n${YELLOW}Note:${NC} To enable SSL, set ENABLE_SSL=true in your .env file and run ./update-docker-env.sh"
|
||||
@@ -80,6 +80,14 @@ COOKIE_SECRET=change_me_in_production
|
||||
SOCKET_IO_CORS=${FRONTEND_URL}
|
||||
SERVER_CORS=${FRONTEND_URL}
|
||||
|
||||
|
||||
# Google Login
|
||||
GOOGLE_CLIENT_ID="your_google_client_id"
|
||||
GOOGLE_CLIENT_SECRET="your_google_client_secret"
|
||||
GOOGLE_CALLBACK_URL="${FRONTEND_URL}/secure/google/verify"
|
||||
LOGIN_FAILURE_REDIRECT="${FRONTEND_URL}/auth/authenticating"
|
||||
LOGIN_SUCCESS_REDIRECT="${FRONTEND_URL}/auth/authenticating"
|
||||
|
||||
# Database
|
||||
DB_HOST=db
|
||||
DB_PORT=5432
|
||||
|
||||
@@ -23,13 +23,20 @@ RUN npm install -g serve
|
||||
COPY --from=build /app/build /app/build
|
||||
COPY --from=build /app/public/env-config.js /app/build/env-config.js
|
||||
|
||||
# Create env-config.sh script
|
||||
RUN echo '#!/bin/sh' > /app/env-config.sh && \
|
||||
echo '# Update env-config.js with runtime environment variables' >> /app/env-config.sh && \
|
||||
echo 'cat > /app/build/env-config.js << EOL' >> /app/env-config.sh && \
|
||||
echo 'window.VITE_API_URL="${VITE_API_URL:-http://backend:3000}";' >> /app/env-config.sh && \
|
||||
echo 'window.VITE_SOCKET_URL="${VITE_SOCKET_URL:-ws://backend:3000}";' >> /app/env-config.sh && \
|
||||
echo 'EOL' >> /app/env-config.sh && \
|
||||
chmod +x /app/env-config.sh
|
||||
|
||||
# Create start.sh script
|
||||
RUN echo '#!/bin/sh' > /app/start.sh && \
|
||||
echo '# Update env-config.js with runtime environment variables' >> /app/start.sh && \
|
||||
echo 'cat > /app/build/env-config.js << EOL' >> /app/start.sh && \
|
||||
echo 'window.VITE_API_URL="${VITE_API_URL:-http://backend:3000}";' >> /app/start.sh && \
|
||||
echo 'window.VITE_SOCKET_URL="${VITE_SOCKET_URL:-ws://backend:3000}";' >> /app/start.sh && \
|
||||
echo 'EOL' >> /app/start.sh && \
|
||||
echo '# Run environment configuration' >> /app/start.sh && \
|
||||
echo '/app/env-config.sh' >> /app/start.sh && \
|
||||
echo '# Start the server' >> /app/start.sh && \
|
||||
echo 'exec serve -s build -l 5000' >> /app/start.sh && \
|
||||
chmod +x /app/start.sh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user