-
Notifications
You must be signed in to change notification settings - Fork 0
[5] Command script
The main idea of this document is to explain how this tool is structured and how it works.
To use this tool, you need to create a .dockgento_profile
file in the folder where the tool will be executed. This file allows you to define environment variables that customize how the environment is generated. The .dockgento_profile
file contains environment variables manually defined by the user. The script also generates additional variables based on the current host's specifications, such as the number of CPUs or available RAM.
Note
The idea is that .dockgento_profile
will have environment variables that should be manually defined, and the script will generate environment variables that could be obtained/calculated.
All these environment variables (those defined in the .dockgento_profile
file and those generated by the script) are combined to create .env
files. These .env
files are the common ones used by a Docker Compose environment to configure the services and control the behavior of the applications running within them (for instance, this one or this one).
Note
Environment variables in the .dockgento_profile
file, as well as those generated by the script, use the SCRIPT_
prefix. This distinction helps differentiate them from other variables, such as:
-
Variables in the
.env
file, which use theBASE_
prefix. -
Variables specific to the
cli
service, which use theMAGENTO_
prefix.
This tool provides several commands:
This is the most important command, as it performs four key tasks:
-
Host dependencies installation: Installs required dependencies such as
docker
andmkcert
(used to generate locally trusted SSL certificates). This is one of the reasons this command requiressudo
privileges. -
Host configuration: Handles tasks like generating locally trusted SSL certificates, updating the
/etc/hosts
file, and configuring Docker to run in rootless mode. -
Docker Compose service configuration: Sets up environment variables that control application behavior, such as defining the number of CPUs for Nginx or specifying the RAM limit for Elasticsearch's JVM.
-
Docker Compose file generation: Generates the Docker Compose files necessary to manage the environment. These files allow you to interact with the setup just like any other Docker Compose environment.
Note
You can start the environment simply by running docker compose up -d
. The script automatically creates a COMPOSE_FILE
environment variable, which tells Docker Compose which files to use.
Additionally, the cron
service is started based on the COMPOSE_PROFILES
environment variable, which the script generates by considering the SCRIPT_COMPOSE_PROFILES
defined in the .dockgento_profile
file.
This command executes the cli
service and uses its init
script to install a Magento platform.
This command executes the cli
service and uses its init
script to set up a Magento platform.
Note
It must receive a DB dump path related to the platform.