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:
-
System Preparation: The system creates a dedicated Docker network named
strapi_networkand initializes the application volume at/opt/strapi. -
Database Provisioning: A PostgreSQL 15 container is deployed to handle data persistence.
-
Application Deployment: The Strapi application is pulled from the
vshadbolt/strapi:latestimage and started within a Docker container. -
Proxy Configuration: An Nginx service with Certbot integration is configured in
/root/nginxto manage SSL certificates and web traffic.
Access Rights and Security¶
-
Permissions: The application volume at
/opt/strapiis owned by user1000and group1000. -
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:
-
Pull the latest image:
-
Restart the container to apply changes:
(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.ymland/data/nginx/user_conf.d
Available ports for connection¶
-
1337: Internal application access. -
5432: Database management. -
80/443: Standard web traffic (via Nginx proxy).