-
Notifications
You must be signed in to change notification settings - Fork 0
Manage deployment in production environment
Deploying applications are going to be done at DeployCenter which built up on AWX Project that leverages Ansible
and its playbook or modules to deploy application.
The deploy system contains multiple instances and each instance is specified as an inventory in Inventories
section. Each instance names as production-vps#{suffix}
which suffix ranges from 1..34
and each corresponding to a virtual instance in Hetzner3 system.
For example, the first virtual machine's name is production-vps1
, the second one is production-vps2
and so on.
To deploy an application, please follow these steps:
Deploy steps
- Create a new application template or select an existing one
- Update its settings if there is any
- Click to deploy
Remember this system deploys master
branch or revision from application repository only.
This writes about how to manage a deployment that includes
- Create a new application template
- Deploy an application
- Delete a template
Prerequisites
- A valid user with appropriate permissions at DeployCenter
A reference template can be fetched here Reference template - this is for reference, if you are urged to deploy to go to next section Manage application template.
Let look at the reference template and see what it contains
---
deploy:
- app_name: hemoroizi.net
zone_apex: hemoroizi.net
domains: ["hemoroizi.net"]
document_root: "src/public"
application_type: app
source_url: "[email protected]:Oxi-Dev/hemoroizi.net.git"
scm: git
source_branch: master
deploy_user: deploy
enable_ssl: True
enforce_nossl: False
require_migrate: False
ssl_configuration:
ssl_cert: |
ssl_key: |
require_certbot: True
database:
host: 127.0.0.1
username: root
password: supersecret
database: bonsoir
The template is a YAML file which has:
- app_name: application domain name (requires)
- zone_apex: if the application domain name is a subdomain, like
sub.example.com
, thenexample.com
should be filled here (optional) - domains: domains to be filled in NGINX server_name, e.g
["example.com"]
(require) - document_root: empty by default, useful when application code is not in the root of application revision (optional)
- application_type:
app
by default, use to specify application type (require) - source_url: application source here, e.g "[email protected]:Oxi-Dev/example.com" (require)
- scm:
git
by default (optional) - source_branch:
master
by default, application revision (optional) - deploy_user:
deploy
by default (optional) - ssl_configuration: containter to defines SSL related keys; you do not have to fill this container when cert is requested via
certbot
- ssl_cert: default is empty, fill SSL cert content here
- ssl_key: default is empty, fill SSL key file here
- enable_ssl:
false
by default, set to True to enable SSL; requiressl_configuration
to filled if cert requested from other sources notcertbot
- require_certbot:
false
by default, set to True if request SSL cert from LetsEncrypt (optional) - cron: a container for cronjob (optional)_
- name: cronjob name e.g example-1
- minute: set minute to run, e.g 0 - 59
- hour: set hour to run, e.g 1-23
- command: php file or file need to run in the root document directory, e.g index.php
- prefix: cronjob prefix
- database: a container to specify database settings
- host: database host IP address of domain name (require)
- username: database username
- password: database password
- database: databaser name
As a developer, just focus on how to create a new application that define settings and then deploy on production environment.
Please note: Due to the limitation of the infrastructure, especially, SSL/TLS infrastructure limitation, this deployment centre supports the application with a single domain name only.
An application template contains settings like GitHub URL, domain name, DB settings, etc as well as the instance where application revision to be deployed.
From the scratch
Steps
- Get the reference template
- Modify domain name, and GitHub URL, etc accordingly.
- Select
Templates
underRESOURCES
section in the left pane - Click the green square with plus sign inside to create a new template
- Paste modified content in step 2 in
EXTRA VARIABLES
(please use YAML) - Set
NAME
, for example,deploy.example.com
- Set
JOB TYPE
to Run - Set
INVENTORY
to expected virtual machine instance - Set
PLAYBOOK
to deploy.yml - If not specified, select
BioeliteVert 2018
- Change
VERBOSITY
or leave it as default - Click the green button with
SAVE
to save.
Clone other application templates
We can also clone an existing one if we need to add another deployment to a virtual machine instance.
Steps
- Select
Templates
underRESOURCES
section in the left pane - Select an existing template in the right, and click on stacked paper icon its right to clone that application template
- After a new template with the existing application name and cloned date will be created right beneath that existing template, click on the new template name to edit
- Continue from step 5 in the From the scratch section above
Steps
- Select
Templates
underRESOURCES
section in the left pane - Select an existing template to deploy
- Click the Rocket icon in it's right to deploy
The system is under development phase, any feedback welcome