diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..6e0bdd3d --- /dev/null +++ b/.env.example @@ -0,0 +1,9 @@ +# Database +POSTGRES_DB=wiki +POSTGRES_USER=wikijs +POSTGRES_PASSWORD=changeme + +# Connection (leave blank and commented for local, fill in for AWS RDS) +#DB_HOST= +#DB_PORT= +#DB_SSL=false \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9e37fa62..ce3ae078 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,6 @@ test-results/ # Localization Resources /server/locales/**/*.yml + +# Environment variables +.env \ No newline at end of file diff --git a/CONFIG.md b/CONFIG.md new file mode 100644 index 00000000..b3e6a154 --- /dev/null +++ b/CONFIG.md @@ -0,0 +1,32 @@ +# Wiki.js Docker Setup + +## Local Development + +### Prerequisites +- Docker Desktop installed and running + +### Steps +1. Clone the repo +2. Copy the env file: `copy .env.example .env` +3. Fill in your values in `.env` +4. Run: `docker compose up -d` +5. Open: `http://localhost` + +## AWS ECS Deployment + +### Prerequisites +- AWS CLI configured +- ECR repository created +- RDS PostgreSQL instance running + +### Steps +1. Build the image: `docker build -t wikijs .` +2. Push to ECR: follow AWS ECR push commands +3. Update ECS Task Definition with your RDS env vars: + - DB_HOST=your-rds-endpoint.amazonaws.com + - DB_PORT=5432 + - DB_USER=wikijs + - DB_PASS=yourpassword + - DB_NAME=wiki + - DB_SSL=true +4. Deploy the ECS service \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..860d3e17 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM ghcr.io/requarks/wiki:2 + +EXPOSE 3000 + +CMD ["node", "server"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..c049f5d0 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,33 @@ +services: + + db: + image: postgres:15-alpine + environment: + POSTGRES_DB: ${POSTGRES_DB} + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + logging: + driver: none + restart: unless-stopped + volumes: + - db-data:/var/lib/postgresql/data + + wiki: + image: ghcr.io/requarks/wiki:2 + depends_on: + - db + init: true + environment: + DB_TYPE: postgres + DB_HOST: ${DB_HOST:-db} + DB_PORT: ${DB_PORT:-5432} + DB_USER: ${POSTGRES_USER} + DB_PASS: ${POSTGRES_PASSWORD} + DB_NAME: ${POSTGRES_DB} + DB_SSL: ${DB_SSL:-false} + restart: unless-stopped + ports: + - "80:3000" + +volumes: + db-data: \ No newline at end of file