ZenDesk's Deployment web ui with Ansible Ansistrano, Capistrano and PHP Deployer support
Installed packages:
- Samson deployment web ui
- Ansible with Ansistrano
- Capistrano
- PHP Deployer
- git
- rsync
- docker & docker-compose (as client)
- npm, gulp, grunt, bower
- java (jre 7)
- PHP cli & composer
(from ZenDesk/Samson repository)
A web interface for deployments.
View the current status of all your projects:
Allow anyone to watch deploys as they happen:
View all recent deploys across all projects:
- Generate GitHub appliation key
- Generate GitHub access token
- Edit
conf/samson.conf
:- Set GitHub appliation credentials (
GITHUB_CLIENT_ID
,GITHUB_SECRET
) - Set GitHub access token (
GITHUB_TOKEN
) - Set
SECRET_TOKEN
(random string with length of 128, can be generated withopenssl rand -hex 128| head -c 128
) - Set
DEFAULT_URL
(must be accessable url for SSO callbacks)
- Set GitHub appliation credentials (
- Edit
etc/provision.yml
to setup public key fetching of.ssh/known_hosts
- Fixed known_host keys can be stored inside
etc/known_hosts
folder and can be generated withssh-keyscan -H HOSTNAME > etc/known_hosts/HOSTNAME
(very secure) - All hosts without stored known_host keys will be automatically fetched when Dockerfile build is running (less secure)
- Fixed known_host keys can be stored inside
- Add ssh keys to
ssh
(will be deployed to/home/application/.ssh
) or generate an new one withmake ssh-key
- Run
docker-compose up -d
ormake restart
For an easy project independed deployment you can use the predefined deployment runner (based on Ansistrano).
Use following as deployment command:
export DEPLOYMENT_INVENTORY=vagrant
export DEPLOYMENT_DEPLOY_TO=/var/www/target-deployment-path
/opt/ansistrano/deploy
Variable | Description |
---|---|
DEPLOYMENT_INVENTORY | Inventory file for deployment (required) |
DEPLOYMENT_DEPLOY_TO | Target deployment directory (required) |
DEPLOYMENT_CURRENT_DIR | Link name of the htdocs path (default: current) |
DEPLOYMENT_APPLICATION | Include variables for specific application (eg. for shared paths, eg typo3 for including deployment/applications/typo3.yml ) |
DEPLOYMENT_PROJECT | Include variables for specific project (eg. for shared paths, eg foobar for including deployment/projects/foobar.yml ) |
DEPLOYMENT_OPTS | Ansible options (can also be append to /opt/ansistrano/deploy ) |
DEPLOYMENT_PLAYBOOK | Ansible playbook (default is deploy ) |
DEPLOYMENT_URL | URL to website (required for eg. PHP opcode cache clearing) |
Variable | Description |
---|---|
Ansible inventory | deployment/inventory |
Common project build task | deployment/tasks/build.yml |
Main deploy playbook | deployment/deploy.yml |
Common rsync excludes | deployment/rsync-excludes |
Use following as deployment command:
dep deploy
Command | Description |
---|---|
make restart |
Restart Samson (and update/deploy configuration) |
make start |
Start Samson |
make stop |
Stop Samson |
make log |
Show logs |
make update |
Update Samson docker image (docker pull ) and restart Samson |
make ssh-key |
Generate new ssh-key (will not overwrite if exists) |
make backup |
Run backup (app:/app/db/ will be copied to ./backup/db/) |
make restore |
Run restore (./backup/db/ will be copied to app:/app/db/) |
make shell |
Jump into shell inside the container (as application user) |
make root |
Jump into shell inside the container (as root user) |
If you need a project specific deployment feel free to put your ansistrano deployment within your project sources. Your deployment task should look like:
ansible-playbook -i inventory/server deploy.yml
With ssh you can jump over multiple servers transparently to reach servers behinde ssh gateways, use the ssh/config
file for configuration:
Host ssh-gateway
Hostname ssh-gateway.example.com
User foo
Host server-behind-gateway
Hostname server-behind-ssh-gateway.example.com
User root
ProxyCommand ssh ssh-gateway -W %h:%p
Now you can use server-behind-gateway
as target host for SSH'ing at it will automatically jump over ssh-gateway
to
reach this server.