Skip to content

Deployment Overview of Strapi on Server

Prerequisites and Basic Requirements

To ensure a successful deployment, the following requirements must be met:

  • Operating System: Ubuntu.

  • Privileges: Root or sudo access is required for installing Docker and managing system services.

  • Network/Ports:

  • Port 1337 (Internal application port).

  • Port 5432 (Database communication).

  • Standard web ports (handled by the Nginx proxy).

FQDN of the final panel on the hostkey.in domain

The access URL for the Strapi administration panel is determined by the following template:

Parameter Value
Prefix strapi
Domain hostkey.in
Full template strapi{Server_ID}.hostkey.in/admin

File and Directory Structure

The application utilizes the following directory structure for data persistence and configuration:

  • /opt/strapi: Main application volume containing Strapi files and data.

  • /var/lib/postgresql/data: Persistent storage for the PostgreSQL database.

  • /root/nginx: Configuration directory for the Nginx proxy service.

  • /data/nginx/user_conf.d: Custom Nginx configuration files.

Application Installation Process

The application is deployed using a combination of Docker containers and automated environment setup:

  1. System Preparation: The system creates a dedicated Docker network named strapi_network and initializes the application volume at /opt/strapi.

  2. Database Provisioning: A PostgreSQL 15 container is deployed to handle data persistence.

  3. Application Deployment: The Strapi application is pulled from the vshadbolt/strapi:latest image and started within a Docker container.

  4. Proxy Configuration: An Nginx service with Certbot integration is configured in /root/nginx to manage SSL certificates and web traffic.

Access Rights and Security

  • Permissions: The application volume at /opt/strapi is owned by user 1000 and group 1000.

  • Network Isolation: Application components communicate over a private Docker network (strapi_network).

  • SSL/TLS: SSL certificates are managed via Certbot through the Nginx proxy container to ensure encrypted communication.

Databases

The application uses PostgreSQL as its primary database engine.

Parameter Value
Database Name strapi
Database User strapi_user
Database Host strapi-db (Container name)
Database Port 5432

Docker Containers and Their Deployment

The deployment consists of the following containers:

PostgreSQL Container

  • Image: postgres:15

  • Ports: 5432:5432

  • Volumes: /var/lib/postgresql/data:/var/lib/postgresql/data

  • Environment Variables:

  • POSTGRES_DB: strapi

  • POSTGRES_USER: strapi_user

  • POSTGRES_PASSWORD: strapi_password

  • Restart Policy: always

Strapi Container

  • Image: vshadbolt/strapi:latest

  • Ports: 1337:1337

  • Volumes: /opt/strapi:/srv/app

  • Environment Variables:

  • NODE_ENV: production

  • DATABASE_CLIENT: postgres

  • DATABASE_HOST: strapi-db

  • DATABASE_PORT: 5432

  • (Various security secrets generated at runtime)

  • Restart Policy: always

Nginx Proxy Container

  • Image: jonasal/nginx-certbot:latest

  • Network Mode: host

  • Volumes:

  • nginx_secrets:/etc/letsencrypt

  • /data/nginx/user_conf.d:/etc/nginx/user_conf.d

  • Restart Policy: unless-stopped

Application Update Instructions

To update the Strapi application, perform the following steps:

  1. Pull the latest image:

    docker pull vshadbolt/strapi:latest
    

  2. Restart the container to apply changes:

    docker compose -f /root/nginx/compose.yml up -d
    
    (Note: This ensures the application environment is refreshed with the new image version).

Location of configuration files and data

  • Application Data: /opt/strapi

  • Database Data: /var/lib/postgresql/data

  • Nginx Configuration: /root/nginx/compose.yml and /data/nginx/user_conf.d

Available ports for connection

  • 1337: Internal application access.

  • 5432: Database management.

  • 80/443: Standard web traffic (via Nginx proxy).

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×