deploybuilder¶
The deploybuilder
command is used to automatically create the configuration files necessary to run a Genropy application in production.
At the first installation you will have to enable the gnrdaemon
and gnrsiterunner
services, while for each new site you will have to create the Nginx configuration file that will connect our application with a domain name
Start gnrdaemon as a service¶
Create a genro_conf directory and move into it.
With the command:
gnr app deploybuilder -g
the gnrdaemon.service file is created and moved to /etc/systemd/system/gnrdaemon.service:
sudo mv gnrdaemon.service /etc/systemd/system/gnrdaemon.service
you will have to change the file permissions:
sudo chmod 644 /etc/systemd/system/gnrdaemon.service
reload the list of available services:
sudo systemctl daemon-reload
enable the service to start automatically:
sudo systemctl enable gnrdaemon.service
start the service:
sudo systemctl start gnrdaemon.service
To verify the operation of the service you can use the following commands:
sudo systemctl status gnrdaemon.service sudo journalctl -e -u gnrdaemon.service
Start gnrsiterunner as a service¶
Similar to what was done with gnrdaemon, you will have to configure the startup of supervisord which in turn will start the necessary processes such as gunicorn, gnrasync (for websocket management) and any gnrworker processes (for scheduled batch executions).
With the command:
gnr app deploybuilder -s
the gnrsiterunner.service file is created and moved to /etc/systemd/system/gnrsiterunner.service:
sudo mv gnrsiterunner.service /etc/systemd/system/gnrsiterunner.service
you will have to change the file permissions:
sudo chmod 644 /etc/systemd/system/gnrsiterunner.service
reload the list of available services:
sudo systemctl daemon-reload
enable the service to start automatically:
sudo systemctl enable gnrsiterunner.service
start the service:
sudo systemctl start gnrsiterunner.service
Hint
If what we are starting is the first Genropy project, we will encounter an error when starting the service. It will be necessary to continue configuring Nginx first, and only then repeat the startup of gnrsiterunner
To verify the operation of the service you can use the following commands:
sudo systemctl status gnrsiterunner.service
sudo journalctl -e -u gnrsiterunner.service
Nginx configuration¶
With the command:
gnr app deploybuilder -d my.domain.com myapp
we’ll create a myapp.conf file that will instruct Nginx how to respond to calls for the domain (my.domain.com in the example), and route them to dedicated gunicorn processes.
The created file will be copied to the nginx sites folder (/etc/nginx/sites-enabled):
sudo mv myapp.conf /etc/nginx/sites-enabled
The command will also automatically create gunicorn.py file in the site folder and automatically modify the supervisor configuration so that the gnrsiterunner service starts automatically our site processes.
Once the files have been created we will have to restart gnrsiterunner and Nginx:
sudo service gnrsiterunner restart
sudo service nginx restart