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