Skip to main content

Production cloud deployments of fig infrastructure with docker

Project description

ficloud
======

ficloud alows to deploy your fig infrastructure to remote servers. Also it
provides all the services needed for hosting production apps.

NB! ficloud is currently in concept stage, so documentation for future components is only thing that exist now.

Features:

- define your app config through Dockerfile and fig.yml
- easy deploy through git push
- pushing several versions of app (dev, staging, production ... etc)
- simple nginx based balancer
- easy switch balancer endpoint between app versions (ex swap prod and dev)
- persistent storage for containers
- easy copying persistence storage between containers (prod -> staging, etc)
- ftp access for container persistence storage

Installation
-------------

Install docker: http://docs.docker.io/en/latest/installation/

Make sure you can run docker containers::

$ sudo docker run -i -t ubuntu echo -e "\033[0;32mDocker is installed - OK\033[0m";

Install packages::

$ sudo apt-get install python-pip
$ sudo pip install ficloud-server

Test that ficloud is working::

$ ficloud-server app-list

+-----+---------+-------+
| App | Version | State |
+-----+---------+-------+
+-----+---------+-------+

Create ficloud user (you can pick any username)::

$ sudo useradd -s /bin/bash -d /home/ficloud -m ficloud
$ sudo su ficloud
$ cd /home/ficloud
$ mkdir ~/.ssh
$ vim ~/.authorized_keys # insert your ssh key into this file
$ chmod -R go-rwx ~/.ssh

Test you can ssh into your server using ficloud account::

$ ssh ficloud@yourserver.com

Add ficloud user to docker group::

$ sudo usermod -a -G docker ficloud

Check ficloud can run docker now::

$ sudo su ficloud
$ docker run -i -t ubuntu echo -e "\033[0;32mFicloud can run Docker - OK\033[0m";
$ exit

Install haproxy::

$ sudo apt-get install haproxy
$ sudo echo "ENABLED=1" > /etc/default/haproxy
$ sudo service haproxy start
$ curl https://raw.github.com/pywizard/ficloud/master/examples/haproxy.cfg.tpl | sudo tee /etc/haproxy/haproxy.cfg.tpl

Now install incron to reconfigure haproxy, when you deploy new apps::

$ sudo apt-get install incron
$ sudo echo "root" > /etc/incron.allow

Edit incrontab file and insert lines generated by inotify-dump in incrontab file::

$ ficloud-server inotify-dump

/home/ficloud/apps-conf IN_MODIFY,IN_CREATE,IN_DELETE,IN_NO_LOOP /home/alex/dev/ficloud/.env/bin/ficloud-server /home/ficloud/apps-conf
/etc/haproxy/haproxy.cfg.tpl IN_MODIFY,IN_CREATE,IN_DELETE,IN_NO_LOOP /home/alex/dev/ficloud/.env/bin/ficloud-server /home/ficloud/apps-conf

$ sudo incrontab -e



Tutorial
----------

Nb! there is no code that implements things described in tutorial yet.

Set working ssh account::

$ ficloud use ubuntu@myserver.com

Apps:

$ ficloud remote app-create myapp
$ ficloud remote app-list
$ ficloud remote app-remove
$ ficloud remote balancer set mydomain.com myapp@localhost/staging/web:5000

push code::

$ git push ubuntu@myserver.com:myapp master:staging

Install balancer::

$ ficloud-server balancer install
$ ficloud-server balancer uninstall

$ ficloud-server balancer set mydomain.com myapp@localhost/staging/web:5000
$ ficloud-server balancer remove mydomain.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ficloud-0.1.2.tar.gz (22.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page