In this tutorial we’re going to take a quick look on porter and what it can do for you in order to make your life easier when it comes to deploying your code.
Porter assumes, that your project consists of modules, which can be dependent on each other. each project must have it’s own directory.:
mkdir project
cd project
touch project.ini
In this file, we are going to specify what is the root module of your project:
[project]
name = My great project
depends = root
[hosts]
testing = user@testing-host.tld
production = user@production-host.tld
vbox = user@192.168.56.101
You can specify a different directory for your modules, if you don’t want to make a mess out of your project directory, by adding a section modules to the project.ini file, like so:
[modules]
module1 = workers/module1
This is where the fun begins!
In order to deploy a module, porter must know something about it. Let’s create a module directory, and see what we can put inside module definition file.:
mkdir root
touch root/root.ini
Please note, that the .ini file must be named the same way as the module itself.
Example .ini file::
[module]
path = /home/user/project/apps/root
path-vbox = /different/path/on/vbox
depends = uwsgi,module1
[scm]
url = git://git@myrepo.tld:reponame.git
[release:stable]
branch = release/0.1.2
Let’s examine this file and see what does it mean.
module section:
scm section:
release section:
You can have multiple ‘releases’ inside your project. You must prefix them with release name. The key thing to remember here is that if you deploy with one particular release, all modules will be deployed with this particular release.
The variables are dependent on what is specified as the scm class. For example, git repository can be checked out on either a branchname or tag, therefore both of these keys are allowed here:
[release:stable]
branch = release/stable
tag = my-stable-tag
inside your project directory, execute the following command:
porter-admin deploy --host vbox --config production
And let the magic begin ;)