diff --git a/env.example b/.env.example similarity index 53% rename from env.example rename to .env.example index af0a984..19aeca2 100644 --- a/env.example +++ b/.env.example @@ -1,7 +1,14 @@ -# Docker Configuration +# Postgres configuration POSTGRES_DB=cactoied_database POSTGRES_USER=cactoide POSTGRES_PASSWORD=cactoide_password +POSTGRES_PORT=5432 -# Development Settings DATABASE_URL="postgres://cactoide:cactoide_password@localhost:5432/cactoied_database" + +# Application configuration +APP_VERSION=latest +ANALYTICS=true +PORT=3000 +HOSTNAME=0.0.0.0 +NODE_ENV=production diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 82c3f34..344d85d 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -3,6 +3,7 @@ name: build & push the images on: push: branches: [main] + tags: ['*'] env: REGISTRY: ghcr.io diff --git a/README.md b/README.md index 6d7ae11..bb4fa41 100644 --- a/README.md +++ b/README.md @@ -25,15 +25,7 @@ A mobile-first event RSVP platform that lets you create events, share unique URL - **🛡️ Smart Limits** - Choose between unlimited RSVPs or set a limited capacity. Perfect for any event size. - **✨ Effortless Simplicity** - Designed to be instantly clear and easy. No learning curve — just open, create, and go. -### 🏗️ Technology - -- **SvelteKit** - Full-stack web framework -- **Tailwind CSS** - Utility-first CSS framework -- **TypeScript** - Type-safe development -- **PostgreSQL** - Robust relational database -- **Drizzle ORM** - Type-safe database queries - -### 🚀 Quick Start +### Quick Start ```bash git clone https://github.com/polaroi8d/cactoide/ @@ -44,13 +36,13 @@ make db-only npm run dev -- --open ``` -Your app will be available at `http://localhost:5173` +Your app will be available at `http://localhost:5173`. You can use the Makefile commands to run the application or the database, eg.: `make db-only`. -### 🚀 Self-Host +### Self-Host -WIP +Use the [`docker-compose.yml`](docker-compose.yml) file to setup the application with the database. You can define all ENV variables in the [`.env`](.env.example) file from the `.env.example`. -### 📄 License +### License This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details. diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml deleted file mode 100644 index 23c970a..0000000 --- a/docker-compose.prod.yml +++ /dev/null @@ -1,59 +0,0 @@ -version: '3.8' - -services: - # Database - postgres: - image: postgres:15-alpine - container_name: cactoide-db-prod - environment: - POSTGRES_DB: ${POSTGRES_DB:-cactoied_database} - POSTGRES_USER: ${POSTGRES_USER:-cactoide} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-cactoide_password} - ports: - - '5432:5432' - volumes: - - postgres_data_prod:/var/lib/postgresql/data - - ./database/init.sql:/docker-entrypoint-initdb.d/init.sql - healthcheck: - test: - [ - 'CMD-SHELL', - 'pg_isready -U ${POSTGRES_USER:-cactoide} -d ${POSTGRES_DB:-cactoied_database}' - ] - interval: 10s - timeout: 5s - retries: 5 - networks: - - cactoide-network-prod - restart: unless-stopped - - # Application - app: - image: ghcr.io/polaroi8d/cactoide:latest - container_name: cactoide-app-prod - ports: - - '3000:3000' - environment: - DATABASE_URL: postgres://${POSTGRES_USER:-cactoide}:${POSTGRES_PASSWORD:-cactoide_password}@postgres:5432/${POSTGRES_DB:-cactoied_database} - NODE_ENV: production - PORT: 3000 - HOSTNAME: 0.0.0.0 - depends_on: - postgres: - condition: service_healthy - networks: - - cactoide-network-prod - restart: unless-stopped - healthcheck: - test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:3000/'] - interval: 30s - timeout: 10s - retries: 3 - start_period: 40s - -volumes: - postgres_data_prod: - -networks: - cactoide-network-prod: - driver: bridge diff --git a/docker-compose.yml b/docker-compose.yml index 95f0bd3..1cabdfd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,38 +1,42 @@ version: '3.8' services: - # PostgreSQL Database + # Database postgres: image: postgres:15-alpine container_name: cactoide-db environment: - POSTGRES_DB: cactoied_database - POSTGRES_USER: cactoide - POSTGRES_PASSWORD: cactoide_password + POSTGRES_DB: ${POSTGRES_DB:-cactoied_database} + POSTGRES_USER: ${POSTGRES_USER:-cactoide} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-cactoide_password} ports: - - '5432:5432' + - '${POSTGRES_PORT:-5432}:5432' volumes: - postgres_data:/var/lib/postgresql/data - ./database/init.sql:/docker-entrypoint-initdb.d/init.sql healthcheck: - test: ['CMD-SHELL', 'pg_isready -U cactoide -d cactoied_database'] + test: + [ + 'CMD-SHELL', + 'pg_isready -U ${POSTGRES_USER:-cactoide} -d ${POSTGRES_DB:-cactoied_database}' + ] interval: 10s timeout: 5s retries: 5 networks: - cactoide-network - # SvelteKit Application + # Application app: - build: - context: . - dockerfile: Dockerfile + image: ghcr.io/polaroi8d/cactoide/cactoide:${APP_VERSION:-latest} container_name: cactoide-app ports: - - '3000:3000' + - '${PORT:-3000}:3000' environment: - DATABASE_URL: postgres://cactoide:cactoide_password@postgres:5432/cactoied_database - NODE_ENV: production + DATABASE_URL: postgres://${POSTGRES_USER:-cactoide}:${POSTGRES_PASSWORD:-cactoide_password}@postgres:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-cactoied_database} + NODE_ENV: ${NODE_ENV:-dev} + PORT: 3000 + HOSTNAME: ${HOSTNAME:-0.0.0.0} depends_on: postgres: condition: service_healthy diff --git a/env.prod.example b/env.prod.example deleted file mode 100644 index a4f1d00..0000000 --- a/env.prod.example +++ /dev/null @@ -1,11 +0,0 @@ -# Production Environment Variables -# Copy this file to .env.prod and update the values - -# Database Configuration -POSTGRES_DB=cactoide_production -POSTGRES_USER=cactoide_prod -POSTGRES_PASSWORD=your_secure_password_here - -# App Configuration -NODE_ENV=production -PORT=3000 diff --git a/src/app.html b/src/app.html index b9c45d8..f930998 100644 --- a/src/app.html +++ b/src/app.html @@ -4,7 +4,7 @@ - %sveltekit.head% + %sveltekit.head% %ANALYTICS_SCRIPT%