Sign inSign up

jharlan1980/itdocs-api

By jharlan1980

Updated 6 months ago

ITDocs - A self-hosted alternative to ITGlue.

Image
0

1.1K

jharlan1980/itdocs-api repository overview

Deployment

Docker Compose:

The easiest way to deploy the full ITDocs stack is using Docker Compose.

1. Create a docker-compose.yml file:

services:
  web:
    image: jharlan1980/itdocs-web:latest
    container_name: itdocs-web
    restart: unless-stopped
    ports:
      - "443:443"
    depends_on:
      - api
    networks:
      - itdocs

  api:
    image: jharlan1980/itdocs-api:latest
    container_name: itdocs-api
    restart: unless-stopped
    env_file: .env
    expose:
      - "4000"
    volumes:
      - backup_data:/var/backups/itdocs
      - files_backup_data:/var/backups/itdocs-files
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
    networks:
      - itdocs
  
  postgres:
    image: postgres:16-alpine
    container_name: itdocs-postgres
    restart: unless-stopped
    env_file: .env
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - itdocs

  redis:
    image: redis:7-alpine
    container_name: itdocs-redis
    restart: unless-stopped
    command: >
      redis-server
      --requirepass ${REDIS_PASSWORD}
      --appendonly yes
      --appendfsync everysec
      --maxmemory 256mb
      --maxmemory-policy allkeys-lru
    volumes:
      - redis_data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - itdocs

volumes:
  postgres_data:
  redis_data:
  backup_data:
  files_backup_data:

networks:
  itdocs:
    driver: bridge

2. Create an .env file in the same directory:

# Database
POSTGRES_USER=itdocs
POSTGRES_PASSWORD=your_secure_db_password
POSTGRES_DB=itdocs
DATABASE_URL=postgresql://itdocs:your_secure_db_password@postgres:5432/itdocs?schema=public

# Redis
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=your_secure_redis_password

# API Security
JWT_SECRET=generate_a_random_secret_string

# Must be exactly 64 hexadecimal characters! (Run: openssl rand -hex 32)
VAULT_ENCRYPTION_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
CORS_ORIGIN=*

# (Optional) - Data backup and exports
BACKUP_PATH=/var/backups/itdocs
BACKUP_PASSWORD=your_secure_backups_password
BACKUP_FILES_PATH=/var/backups/itdocs-files

3. Deploy the stack:

docker compose up -d

Support my development progress

Support me on Patreon

Tag summary

Content type

Image

Digest

sha256:f4aa2360a

Size

448.2 MB

Last updated

6 months ago

docker pull jharlan1980/itdocs-api