-
Notifications
You must be signed in to change notification settings - Fork 0
Production environment
OS and runtimes
- Ubuntu 18.04 or 16.04 LTS
- PHP7.x or PHP5.6 Ondrej PHP repository
- nodejs (latest version expted but optional)
Please note
- Instances are accessible using private key under user
ubuntu
- Web code is running under user
www-data
- CRONS to be run under user
ubuntu
- Users are logged under user
ubuntu
(should use when troubleshooting only, any modification must be done on dev instances with Q/A) - System web root document is located in
/var/www/
' - Application production settings is stored in
opsworks.php
under eachdeploy
directory (see belows under Deploy Phases)
The deployment follows Caspistrano, the workflow is:
In the deploy
directory, a sub-directory named shared
must be created. This sub-directory is where configuration and temporary files will be kept. A typical Oxi Web application might have config
, log
, tmp
, and cache_lp
directories within the shared
directory to keep the files stored there independent of the code in the source repository.
In addition to the shared
sub-directory, the deploy process will create sub-directories named releases
and current
(also in the deploy directory). The release
directory holds (up to) five most recently deployed versions of an application. The current directory holds the currently-released version.
For example:
deploy_directory/
current/
releases/
shared/
config/
log/
cache_lp/
tmp/
deploy
directory follows web application domain name, with .
replaced by ``.
For example:
An application with domain name a-webapp.example.com
will have
deploy
directory names a-webappexamplecom
and located under /var/www/a-webappexamplecom
or an application with domain name beauty.bioelite.ro
will have
deploy
directory names beautybioelitero
and located under /var/www/beautybioelitero
In short, a deployment happens in several phases:
- Checkout - fetch a application revision, mostly using
git
- Hooks - contains tasks like correct application revivision permissions in
deploy
directory, create configure settings for application, in this case,ospworks.php
, initiating the database if specified, then symlink latest revision inreleases
directorytocurrent
directory. If there is any additional task, it goes here. - Restart - reload NGINX to get new web site configuration and restart php-fpm to load new application revision.
While deploying, a opsworks.php
is created and placed under deploy
directory, and filled with production environment DB settings. If code is deployed to deploy
, then its located at /var/www/deploy/current/opsworks.php
.
The opsworks.php
contents can be viewed here: opsworks.php
Any NGINX's rewrite
rules must be put in a filename app.rules
and commit to the root of application repository, it helps deploy machine to populate them in application NGINX configuration file.
An example of app.rules
file:
rewrite ^([^.]*[^/])$ $1/ permanent;
rewrite ^/forms/([a-z0-9-]+)/$ /index.php?action=$1 last;
rewrite ^/redirect/([a-z0-9-]+)/$ /index.php?action=$1 last;
All application should refer to settings provided by this file to avoid hard-code in application revision
All web application should be deployed from here Deploy Center
Steps
- Log in to https://deploycenter.linuxserv.space
- Go to
Templates
underResources
in the left - Select appropriate application template in the right, application template name follows application domain name, such as
example.com
- Click the Rocket icon to deploy
- If the deployment returns green then it's done successful, and changes by new revision should be applied.
- If you have any problem while deploying, please contact sysadmin
The system is under development phase, any feedback welcome