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.

Docker optimisations: Prod server or dev server with hmr

Smaug6739d7513c7df999
diff --git a/README.md b/README.md
index 4f369b77..ad0f6965 100644
--- a/README.md
+++ b/README.md
@@ -46,21 +46,33 @@ Organize, search, and export your notes with an intuitive interface designed for
For local testing and development, you can use Docker to run the entire stack:
+**Start a demo server (local production):**
+
```bash
docker compose up -d --build
```
+**Start a development server with hot reloading (HMR):**
+
+```bash
+docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build
+```
+
**Access points:**
+
- 🌐 **Frontend**: http://localhost:8200
-- πŸ”Œ **Backend API**: http://localhost:8201
+- πŸ”Œ **Backend API**: http://localhost:8201
- πŸ“¦ **MinIO Console**: http://localhost:9001
- πŸ—„οΈ **MySQL**: localhost:3307 (user: `alexandrie`, password: `password`)
**To stop:**
+
```bash
docker compose down
```
+If you don't have Docker installed, you can follow the manual setup instructions in the [CONTRIBUTING.md](./CONTRIBUTING.md).
+
## Contributing 🌍
This project has an MIT license. And you are welcome to contribute.
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
new file mode 100644
index 00000000..4ff78abb
--- /dev/null
+++ b/docker-compose.dev.yml
@@ -0,0 +1,13 @@
+services:
+ # Alexandrie Frontend
+ frontend:
+ build:
+ context: ./frontend
+ dockerfile: Dockerfile.dev
+ container_name: alexandrie-frontend
+ restart: unless-stopped
+ volumes:
+ - ./frontend:/app # montage du code local
+ - /app/node_modules
+ ports:
+ - '8200:8200'
diff --git a/docker-compose.yml b/docker-compose.yml
index 32090bda..a99d932f 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -12,11 +12,11 @@ services:
volumes:
- mysql_data:/var/lib/mysql
ports:
- - "3307:3306"
+ - '3307:3306'
networks:
- alexandrie-network
healthcheck:
- test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
+ test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost']
timeout: 10s
retries: 5
start_period: 30s
@@ -33,12 +33,12 @@ services:
volumes:
- minio_data:/data
ports:
- - "9000:9000"
- - "9001:9001"
+ - '9000:9000'
+ - '9001:9001'
networks:
- alexandrie-network
healthcheck:
- test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
+ test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
interval: 30s
timeout: 20s
retries: 3
@@ -55,30 +55,30 @@ services:
DATABASE_NAME: alexandrie
DATABASE_USER: alexandrie
DATABASE_PASSWORD: password
-
+
# Application Configuration
JWT_SECRET: your-secure-jwt-secret-key-change-this-in-production
DOMAIN_CLIENT: http://localhost:8200
COOKIE_DOMAIN: localhost
-
+
# MinIO Configuration
MINIO_ENDPOINT: minio:9000
MINIO_ACCESSKEY: minioadmin
MINIO_SECRETKEY: minioadmin
MINIO_BUCKET: alexandrie
-
+
# SMTP Configuration (optional)
- SMTP_HOST: ""
- SMTP_MAIL: ""
- SMTP_PASSWORD: ""
-
+ SMTP_HOST: ''
+ SMTP_MAIL: ''
+ SMTP_PASSWORD: ''
+
# Port Configuration
PORT: 8201
CPWD: /app/
- CONFIG_CPWD: ""
+ CONFIG_CPWD: ''
GIN_MODE: release
ports:
- - "8201:8201"
+ - '8201:8201'
depends_on:
mysql:
condition: service_healthy
@@ -100,7 +100,7 @@ services:
VITE_BASE_CDN: http://localhost:9000/alexandrie
NUXT_PUBLIC_BASE_URL: http://localhost:8200
ports:
- - "8200:8200"
+ - '8200:8200'
depends_on:
- backend
networks:
@@ -114,4 +114,4 @@ volumes:
mysql_data:
driver: local
minio_data:
- driver: local
\ No newline at end of file
+ driver: local
diff --git a/frontend/Dockerfile.dev b/frontend/Dockerfile.dev
new file mode 100644
index 00000000..996a3c01
--- /dev/null
+++ b/frontend/Dockerfile.dev
@@ -0,0 +1,38 @@
+# Frontend Dockerfile for Alexandrie - Runtime build with build-time config
+FROM node:20-alpine
+
+# Install bun
+RUN apk add --no-cache curl unzip bash && \
+ curl -fsSL https://bun.sh/install | bash && \
+ cp /root/.bun/bin/bun /usr/local/bin/bun && \
+ chmod +x /usr/local/bin/bun
+
+# Create app user
+RUN addgroup -g 1001 -S appgroup && \
+ adduser -S appuser -G appgroup -u 1001
+
+WORKDIR /app
+
+# Copy package files and install dependencies as root
+COPY package.json bun.lock ./
+RUN bun install
+
+
+# Switch to app user
+USER appuser
+
+# Expose port
+EXPOSE 8200
+
+# Health check
+HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
+ CMD curl -f http://localhost:8200/ || exit 1
+
+# Runtime environment variables - can be overridden at container startup
+ENV NODE_ENV=production
+ENV PORT=8200
+ENV VITE_BASE_API=""
+ENV VITE_BASE_CDN=""
+ENV NUXT_PUBLIC_BASE_URL=""
+
+CMD ["bun", "run", "dev"]