Skip to content

Latest commit

 

History

History
89 lines (66 loc) · 2.12 KB

DEPLOY.md

File metadata and controls

89 lines (66 loc) · 2.12 KB

How to deploy

This documentation is an example of how to deploy the application on a Alwaysdata server.

Getting the server ready

First, we need to be able to log easily on the server:

ssh-keygen -C "<some comment about the key, such as your email>" -f ~/.ssh/id_rsa.pamplemousse
ssh-add ~/.ssh/id_rsa.pamplemousse
ssh-copy-id -i ~/.ssh/id_rsa.pamplemousse <alwaysdata-user>@ssh-<alwaysdata-project>.alwaysdata.net

Now, we can log on the server securly:

ssh <alwaysdata-user>@ssh-<alwaysdata-project>.alwaysdata.net

And make it ready:

mkdir pamplemousse.git
cd pamplemousse.git
git init --bare

Now, we can push code onto the server:

git remote add prod ssh://<alwaysdata-user>@ssh-<alwaysdata-project>.alwaysdata.net:/home/<alwaysdata-user>/pamplemousse.git
git push prod master

But the server still need some setup to be ready.

Let's install ImageMagick for a start:

cd ~
mkdir extensions
cd extensions
wget http://pecl.php.net/get/imagick
mv imagick imagick.tar.gz
tar xzvf imagick.tar.gz
cd imagick-3.4.0RC6
phpize
./configure
make

And add it to the php.ini file via the admin backend:

extension = exif.so;
extension = /home/<alwaysdata-project>/extensions/imagick-3.4.0RC6/modules/imagick.so;

Automating deploy

We'll use hooks:

scp deploy/post-receive <alwaysdata-user>@ssh-<alwaysdata-project>.alwaysdata.net:/home/<alwaysdata-project>/pamplemousse.git/hooks/

Setting up configuration

# htaccess file for Alwaysdata
scp deploy/.htaccess <alwaysdata-user>@ssh-<alwaysdata-project>.alwaysdata.net:/home/<alwaysdata-project>/pamplemousse/web/.htaccess
# Prod configuration
scp config/app.prod.yml <alwaysdata-user>@ssh-<alwaysdata-project>.alwaysdata.net:/home/<alwaysdata-project>/pamplemousse/config/app.yml
# Background image
scp web/images/bg* <alwaysdata-user>@ssh-<alwaysdata-project>.alwaysdata.net:/home/<alwaysdata-project>/pamplemousse/web/images/

Some directories need to be created manually:

mkdir pamplemousse/web/{upload,thumbnail}
chmod 777 pamplemousse/web/{upload,thumbnail}

Deploying

git push prod <branch>