Deployment Overview of Restyaboard on Server¶
Prerequisites and Basic Requirements¶
The deployment of Restyaboard requires a server running Ubuntu with the following specifications:
- Operating System: Ubuntu (compatible with
aptpackage manager) - Privileges: Root access or
sudoprivileges are required to install Docker and manage system services - Domain: A valid domain name is required for the Nginx reverse proxy and SSL certificate generation via Certbot
- Ports:
- Port
80and443must be open for the Nginx reverse proxy - Port
8080is used internally by the Restyaboard application container (bound to127.0.0.1) - Port
5432is used internally by the PostgreSQL database container
File and Directory Structure¶
The deployment utilizes specific directories on the host system to store application data, database files, and proxy configurations:
/opt/restyaboard/postgres: Persistent storage volume for the PostgreSQL database data/opt/restyaboard/uploads: Directory for Restyaboard file uploads/root/nginx: Directory containing the Nginx and Certbot Docker Compose configuration/root/nginx/compose.yml: The Docker Compose file defining the Nginx and Certbot services/data/nginx/user_conf.d: Directory containing custom Nginx configuration files for the host/data/nginx/nginx-certbot.env: Environment file containing configuration for the Nginx-Certbot service/etc/letsencrypt: Volume mount for Let's Encrypt SSL certificates
Application Installation Process¶
The Restyaboard application is deployed using Docker containers. The process involves installing Docker Engine, creating a dedicated network, and running the application and database containers.
- Docker Installation: The system installs Docker CE, Docker CLI, containerd.io, and the Docker Compose plugin.
- Network Creation: A dedicated Docker network named
restya_netis created to isolate the application and database containers. - Image Pulling: The following Docker images are pulled from the registry:
postgres:15restyaplatform/restyaboard:v1.7.1
- Database Initialization:
- A PostgreSQL container named
restya_dbis started. - The database
restyaboardis created. - A database role named
restyais created with login privileges. - The schema is imported from a SQL file located inside the application container if the tables do not already exist.
- A PostgreSQL container named
- Application Launch:
- The Restyaboard container named
restya_appis started. - The application connects to the database using the
restyarole. - The application listens on port
8080bound to127.0.0.1.
- The Restyaboard container named
Docker Containers and Their Deployment¶
The deployment consists of three primary Docker containers:
- restya_db:
- Image:
postgres:15 - Network:
restya_net - Environment Variables:
POSTGRES_USER=postgresPOSTGRES_PASSWORD: Set via therestya_db_passwordvariablePOSTGRES_DB=restyaboard
- Volume Mount:
/opt/restyaboard/postgres:/var/lib/postgresql/data -
Restart Policy:
unless-stopped -
restya_app:
- Image:
restyaplatform/restyaboard:v1.7.1 - Network:
restya_net - Environment Variables:
POSTGRES_HOST=restya_dbPOSTGRES_PORT=5432POSTGRES_ADMIN_USER=postgresPOSTGRES_ADMIN_PASS: Set via therestya_db_passwordvariableRESTYA_DB_USERNAME=restyaRESTYA_DB_USERPASS: Set via therestya_db_passwordvariableRESTYA_DB=restyaboard
- Port Mapping:
127.0.0.1:8080:80 -
Restart Policy:
unless-stopped -
nginx:
- Image:
jonasal/nginx-certbot:latest - Network Mode:
host - Environment Variables:
- Volume Mounts:
nginx_secrets:/etc/letsencrypt/data/nginx/user_conf.d:/etc/nginx/user_conf.d
- Restart Policy:
unless-stopped
Databases¶
The application uses a PostgreSQL database hosted within a Docker container.
- Connection Method: The application connects to the database via the internal Docker network using the hostname
restya_db. - Storage Location: Database data is persisted in the host directory
/opt/restyaboard/postgres. - Database Name:
restyaboard - User Credentials:
- Application User:
restya - Admin User:
postgres - Password: Defined by the
restya_db_passwordvariable during deployment. - Schema Initialization: If the
oauth_clientsorsettingstables are missing, the deployment script automatically copies the appropriate SQL schema file from the application container to the database container and executes it.
Proxy Servers¶
Access to the Restyaboard application is provided through an Nginx reverse proxy managed by Docker Compose.
- Proxy Service: The
nginxcontainer runs thejonasal/nginx-certbotimage. - Configuration:
- The proxy configuration is located in
/data/nginx/user_conf.d. - A specific configuration file (e.g.,
{{ prefix }}{{ server_id }}.hostkey.in.conf) is updated to include the proxy pass directive. - Routing:
- The Nginx configuration routes traffic to the Restyaboard application at
http://127.0.0.1:8080. - The
proxy_passdirective is set tohttp://127.0.0.1:8080;within the location block. - SSL/TLS: SSL certificates are managed automatically by Certbot within the Nginx container, storing secrets in the
nginx_secretsvolume. - Deployment Command: The proxy service is started using
docker compose -p certproxy up -d nginxfrom the/root/nginxdirectory.
Starting, Stopping, and Updating¶
The following commands are used to manage the lifecycle of the deployed containers:
-
Start the Nginx Proxy:
This command is executed from the/root/nginxdirectory. -
Restart the Application Container:
-
Remove Containers:
-
Check Container Status:
-
Verify Database Readiness:
-
Verify Application Availability: The application is considered ready when port
8080on127.0.0.1is reachable.