(Created page with "= Overview = Running and deploying QA Dashboard relies heavily on automated deployment scripts and version control repository. At high level, deployment process is following: #...") |
|||
| Line 10: | Line 10: | ||
## Restarting the application on production server | ## Restarting the application on production server | ||
| - | + | = Setting up the local environment for deployments = | |
| + | |||
| + | QA Dashboard uses Capistrano to automate the deployments. The main benefit is to eliminate the risks of human errors and to enable easy and repeatable rollbacks. See [http://github.com/capistrano/capistrano/wiki Capistrano documentation] for the details | ||
| + | |||
| + | == Install development environment == | ||
| + | |||
| + | You should first [http://wiki.meego.com/Quality/QA-tools/QADashboard/Setting_up_the_development_environment set up the development environment] on your workstation before continuing. | ||
| + | Capistrano is run from your development environment | ||
| + | |||
| + | == Installing Capistrano == | ||
| + | |||
| + | Capistrano requires Ruby. If you do not have Ruby installed please follow the "Install Ruby" instructions [http://wiki.meego.com/Quality/QA-tools/QAReports/Setting_up_the_development_environment here]. | ||
| + | |||
| + | <tt>$ gem install capistrano</tt> | ||
= Setting up the production server = | = Setting up the production server = | ||
| + | |||
| + | == Install dependencies == | ||
The same installations are needed in the production server as in development environment. | The same installations are needed in the production server as in development environment. | ||
| Line 19: | Line 34: | ||
# Install Node Package Manager | # Install Node Package Manager | ||
# Install mongodb | # Install mongodb | ||
| + | |||
| + | == Create virtual host for QA Dashboard == | ||
| + | (example using nginx) | ||
| + | |||
| + | Write a following virtual host declaration to /etc/nginx/sites-available/qa-dashboard | ||
| + | |||
| + | <code> | ||
| + | server { | ||
| + | listen 80; | ||
| + | server_name qa-dashboard.qa.leonidasoy.fi; | ||
| + | location / { | ||
| + | proxy_pass http://localhost:3030; | ||
| + | proxy_set_header Host $host; | ||
| + | proxy_set_header X-Forwarded-Host $host; | ||
| + | proxy_set_header X-Forwarded-Server $host; | ||
| + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| + | proxy_set_header X-Real-IP $remote_addr; | ||
| + | } | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | = Deploying QA Dashboard = | ||
| + | |||
| + | == Enable public key authentication for your deployment account == | ||
| + | |||
| + | Set up public key authentication: | ||
| + | # Generate yourself as SSH key pair if you don't have one: <tt>$ ssh-keygen</tt> | ||
| + | # Add your public key to <tt>authorized_keys</tt> file of your production environment user: <br> <tt>$ ssh your.production.user@your.production.host 'mkdir .ssh; echo '`cat ~/.ssh/id_rsa.pub`' >> ~/.ssh/authorized_keys'</tt> | ||
| + | # Try logging in: <tt>ssh your.production.user@your.production.host</tt> | ||
| + | |||
| + | == Modify Capistrano scripts and setup deployment == | ||
| + | |||
| + | QA Dashboard uses following scripts to configure Capistrano | ||
| + | * <tt>config/deploy.rb</tt> | ||
| + | * <tt>config/deploy/staging.rb</tt> | ||
| + | * <tt>config/deploy/production.rb</tt> | ||
| + | |||
| + | You might want to review all the files, but usually it's enough to update only <tt>config/deploy/production.rb</tt> according to your needs (servers, deployment account, ssh options). You can also create new deployment environment just by copying the production.rb, to e.g. internal.rb and modify it. | ||
| + | |||
| + | When you deploy for first time you need to run setup command, which creates creates the folder hierarchy and the symbolic links required by Capistrano.<br> | ||
| + | Once the Capistrano is updated according to your needs you need to run setup command, which creates creates the folder hierarchy and the symbolic links required by Capistrano. After that the server can be started. | ||
| + | <code> | ||
| + | $ cap production deploy:setup # or cap internal deploy:setup, if you created a new deployment environment | ||
| + | $ cap production deploy:start # starts the server | ||
| + | </code> | ||
| + | |||
| + | == Deploying QA Dashboard == | ||
| + | |||
| + | Once the setup is complete, the deployment is as easy as it gets | ||
| + | <code> | ||
| + | $ cap production deploy | ||
| + | </code> | ||
Contents |
Running and deploying QA Dashboard relies heavily on automated deployment scripts and version control repository. At high level, deployment process is following:
QA Dashboard uses Capistrano to automate the deployments. The main benefit is to eliminate the risks of human errors and to enable easy and repeatable rollbacks. See Capistrano documentation for the details
You should first set up the development environment on your workstation before continuing. Capistrano is run from your development environment
Capistrano requires Ruby. If you do not have Ruby installed please follow the "Install Ruby" instructions here.
$ gem install capistrano
The same installations are needed in the production server as in development environment. Follow the instructions in Quality/QA-tools/QAReports/Setting_up_the_development_environment to:
(example using nginx)
Write a following virtual host declaration to /etc/nginx/sites-available/qa-dashboard
server {
listen 80;
server_name qa-dashboard.qa.leonidasoy.fi;
location / {
proxy_pass http://localhost:3030;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
Set up public key authentication:
QA Dashboard uses following scripts to configure Capistrano
You might want to review all the files, but usually it's enough to update only config/deploy/production.rb according to your needs (servers, deployment account, ssh options). You can also create new deployment environment just by copying the production.rb, to e.g. internal.rb and modify it.
When you deploy for first time you need to run setup command, which creates creates the folder hierarchy and the symbolic links required by Capistrano.
Once the Capistrano is updated according to your needs you need to run setup command, which creates creates the folder hierarchy and the symbolic links required by Capistrano. After that the server can be started.
$ cap production deploy:setup # or cap internal deploy:setup, if you created a new deployment environment $ cap production deploy:start # starts the server
Once the setup is complete, the deployment is as easy as it gets
$ cap production deploy