Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

New docker compose with export of env variables in a file

Smaug67396947159b7143
diff --git a/.env.example b/.env.example
new file mode 100644
index 00000000..a48148d6
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,69 @@
+# ==============================================================================
+# ALEXANDRIE - ENVIRONMENT CONFIGURATION
+# ==============================================================================
+# Instructions:
+# 1. Copy this file to a new file named ".env"
+# 2. Modify the values below to suit your environment
+# 3. DO NOT commit your final ".env" file to source control
+# ==============================================================================
+
+
+# ------------------------------------------------------------------------------
+# 0. Common Settings
+
+# Public URLs used by the client's browser to reach the services.
+# If using a Reverse Proxy (Nginx/Traefik), use your public domain names here.
+FRONTEND_URL=http://localhost:8200
+API_URL=http://localhost:8201
+CDN_URL=http://localhost:9000/alexandrie
+
+# Flags to enable or disable certain app features
+CONFIG_DISABLE_LANDING=false # Disable the landing page if set to true
+CONFIG_DISABLE_SIGNUP=false # Disable the signup page if set to true
+
+# ------------------------------------------------------------------------------
+# 1. DATABASE CONFIGURATION (MySQL)
+
+MYSQL_EXTERNAL_PORT=3307 # The port exposed on your host machine for database access
+MYSQL_ROOT_PASSWORD=rootpassword # Root password for the MySQL instance
+MYSQL_DATABASE=alexandrie # The name of the application database
+
+MYSQL_USER=alexandrie
+MYSQL_PASSWORD=password
+
+# ------------------------------------------------------------------------------
+# 2. OBJECT STORAGE (RustFS / S3 Compatible)
+RUSTFS_EXTERNAL_PORT=9005 # The port exposed on your host machine for S3 API access
+
+# Access credentials for the object storage
+RUSTFS_ACCESS_KEY=alexandrie-key
+RUSTFS_SECRET_KEY=alexandrie-secret
+MINIO_BUCKET=alexandrie # The default S3 bucket name where files will be stored
+
+RUSTFS_CONSOLE_ENABLE=false # Enable or disable the RustFS web management console (true/false)
+RUSTFS_LOG_LEVEL=info # Logging level (debug, info, warn, error)
+
+# ------------------------------------------------------------------------------
+# 3. BACKEND API CONFIGURATION
+BACKEND_EXTERNAL_PORT=8201 # The port exposed on your host machine for the Backend API
+GIN_MODE=release # Application mode: 'debug' for development, 'release' for production
+
+# Security: Secret key used to sign JWT tokens.
+# /!\ IMPORTANT: Change this to a random long string in production /!\
+JWT_SECRET=your-secure-jwt-secret-key-change-this-in-production
+
+
+COOKIE_DOMAIN=localhost:8200 # Common domain for cookies (e.g., yourdomain.com if you have frontend.yourdomain.com and api.yourdomain.com)
+ALLOW_UNSECURE=true # Set to 'true' if running without HTTPS (local dev). Set to 'false' in production.
+
+# ------------------------------------------------------------------------------
+# 4. SMTP CONFIGURATION (Email Service)
+# Optional: Only required for password reset features.
+# Leave empty if you do not wish to use email functionality.
+SMTP_HOST=
+SMTP_MAIL=
+SMTP_PASSWORD=
+
+# ------------------------------------------------------------------------------
+# 5. FRONTEND CONFIGURATION (Nuxt)
+FRONTEND_EXTERNAL_PORT=8200 # The port exposed on your host machine for the web interface
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 01f7791e..b5c34271 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@ minio
uploads
minio.exe
main.exe
-data
\ No newline at end of file
+data
+.env
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index 870028a5..6c87e8b6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,12 +1,3 @@
-# Docker Compose configuration for Alexandrie application stack
-# This setup includes:
-# - MySQL Database
-# - RustFS Object Storage (S3 compatible)
-# - Alexandrie Backend
-# - Alexandrie Frontend
-
-# For details please refer to the documentation (./docs/setup.md)
-
services:
# MySQL Database
mysql:
@@ -14,18 +5,18 @@ services:
container_name: alexandrie-mysql
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD: rootpassword
- MYSQL_DATABASE: alexandrie
- MYSQL_USER: alexandrie
- MYSQL_PASSWORD: password
+ MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootpassword}
+ MYSQL_DATABASE: ${MYSQL_DATABASE:-alexandrie}
+ MYSQL_USER: ${MYSQL_USER:-alexandrie}
+ MYSQL_PASSWORD: ${MYSQL_PASSWORD:-password}
volumes:
- mysql_data:/var/lib/mysql
ports:
- - '3307:3306'
+ - '${MYSQL_EXTERNAL_PORT:-3307}:3306'
networks:
- alexandrie-network
healthcheck:
- test: ['CMD-SHELL', "mysql -u$$MYSQL_USER -p$$MYSQL_PASSWORD -e 'SELECT 1' $$MYSQL_DATABASE"]
+ test: ['CMD-SHELL', "mysql -u$${MYSQL_USER} -p$${MYSQL_PASSWORD} -e 'SELECT 1' $${MYSQL_DATABASE}"]
timeout: 10s
retries: 5
start_period: 30s
@@ -36,12 +27,12 @@ services:
container_name: alexandrie-rustfs
restart: unless-stopped
environment:
- RUSTFS_ACCESS_KEY: alexandrie-key
- RUSTFS_SECRET_KEY: alexandrie-secret
- RUSTFS_CONSOLE_ENABLE: 'false' # Disable web console
- RUSTFS_LOG_LEVEL: info
+ RUSTFS_ACCESS_KEY: ${RUSTFS_ACCESS_KEY:-alexandrie-key}
+ RUSTFS_SECRET_KEY: ${RUSTFS_SECRET_KEY:-alexandrie-secret}
+ RUSTFS_CONSOLE_ENABLE: '${RUSTFS_CONSOLE_ENABLE:-false}'
+ RUSTFS_LOG_LEVEL: ${RUSTFS_LOG_LEVEL:-info}
ports:
- - '9000:9000'
+ - '${RUSTFS_EXTERNAL_PORT:-9000}:9000'
volumes:
- rustfs_data:/data
- rustfs_logs:/logs
@@ -61,36 +52,37 @@ services:
environment:
# General configuration
BACKEND_PORT: 8201
- GIN_MODE: release # Set to 'release' for production, 'debug' for development
+ GIN_MODE: ${GIN_MODE:-release}
+ JWT_SECRET: ${JWT_SECRET:-your-secure-jwt-secret-key-change-this-in-production}
+ COOKIE_DOMAIN: ${COOKIE_DOMAIN:-localhost:8200} # Common domain for cookies (e.g., yourdomain.com if you have frontend.yourdomain.com and api.yourdomain.com)
+ DOMAIN_CLIENT: ${FRONTEND_URL:-http://localhost:8200} # URL where the frontend is hosted (for CORS policy and url generation in emails)
+ ALLOW_UNSECURE: '${ALLOW_UNSECURE:-true}' # Set to 'true' if you run without HTTPS (e.g., local dev);
+
+ # Flags
+ CONFIG_DISABLE_SIGNUP: '${CONFIG_DISABLE_SIGNUP:-false}' # Disable user signup if set to 'true'
# Database Configuration
DATABASE_HOST: mysql
DATABASE_PORT: 3306
- DATABASE_NAME: alexandrie
- DATABASE_USER: alexandrie
- DATABASE_PASSWORD: password
+ DATABASE_NAME: ${MYSQL_DATABASE:-alexandrie}
+ DATABASE_USER: ${MYSQL_USER:-alexandrie}
+ DATABASE_PASSWORD: ${MYSQL_PASSWORD:-password}
# Object storage configuration (S3 compatible like RustFS, MinIO, etc.)
# OPTIONAL: If you don't want to use the CDN feature you can leave these variables empty
MINIO_ENDPOINT: rustfs:9000
- MINIO_ACCESSKEY: alexandrie-key
- MINIO_SECRETKEY: alexandrie-secret
- MINIO_BUCKET: alexandrie
+ MINIO_ACCESSKEY: ${RUSTFS_ACCESS_KEY:-alexandrie-key}
+ MINIO_SECRETKEY: ${RUSTFS_SECRET_KEY:-alexandrie-secret}
+ MINIO_BUCKET: ${MINIO_BUCKET:-alexandrie}
# SMTP Configuration (only for password reset emails)
# OPTIONAL: If you don't want to use email features, you can leave these variables empty
- SMTP_HOST: ''
- SMTP_MAIL: ''
- SMTP_PASSWORD: ''
-
- # Application authentication and security
- JWT_SECRET: your-secure-jwt-secret-key-change-this-in-production # Change this secret in production!
- COOKIE_DOMAIN: localhost:8200 # Common domain for cookies (e.g., yourdomain.com if you have frontend.yourdomain.com and api.yourdomain.com)
- DOMAIN_CLIENT: http://localhost:8200 # URL where the frontend is hosted (for CORS policy and url generation in emails)
- ALLOW_UNSECURE: 'true' # Set to 'true' if you run without HTTPS (e.g., local dev);
+ SMTP_HOST: ${SMTP_HOST:-}
+ SMTP_MAIL: ${SMTP_MAIL:-}
+ SMTP_PASSWORD: ${SMTP_PASSWORD:-}
ports:
- - '8201:8201'
+ - '${BACKEND_EXTERNAL_PORT:-8201}:8201'
depends_on:
mysql:
condition: service_healthy
@@ -101,17 +93,24 @@ services:
# Alexandrie Frontend
frontend:
- image: ghcr.io/smaug6739/alexandrie-frontend:latest
+ build:
+ context: ./frontend
container_name: alexandrie-frontend
restart: unless-stopped
environment:
PORT: 8200
+
+ # Flags
+ NUXT_PUBLIC_CONFIG_DISABLE_SIGNUP_PAGE: '${CONFIG_DISABLE_SIGNUP:-false}' # Disable signup page if set to 'true'
+ NUXT_PUBLIC_CONFIG_DISABLE_LANDING_PAGE: '${CONFIG_DISABLE_LANDING:-false}' # Disable landing page
+
# Runtime configuration - builds with these values at startup
- NUXT_PUBLIC_BASE_API: http://localhost:8201
- NUXT_PUBLIC_BASE_CDN: http://localhost:9000/alexandrie
- NUXT_PUBLIC_BASE_URL: http://localhost:8200
+ NUXT_PUBLIC_BASE_API: ${API_URL:-http://localhost:8201}
+ NUXT_PUBLIC_BASE_CDN: ${CDN_URL:-http://localhost:9000/alexandrie}
+ NUXT_PUBLIC_BASE_URL: ${FRONTEND_URL:-http://localhost:8200}
+
ports:
- - '8200:8200'
+ - '${FRONTEND_EXTERNAL_PORT:-8200}:8200'
depends_on:
- backend
networks:
@@ -123,8 +122,5 @@ networks:
volumes:
mysql_data:
- driver: local
rustfs_data:
- driver: local
rustfs_logs:
- driver: local