Introduction - How I end-up with slappy SCP?

I've decided I'll use my old laptop (which is currently used as a media server for TV) as my main "server" for maintaining and creating content and building site on it.

I have to confess, two posts (how-to-create-own-blog && get-noticed ) were deployed by me manually using SCP and "Filezilla" client. I knew it was not best idea, but still time was ticking as I wanted to keep-up with publishing first post at 1st March.

I've got into a "shortcut" mode to make it faster. And now I see it actually makes deployment slower for next-times.

I've decided to level up and move with deployment to using Fabric - since Pelican's quickstart creates this 'fab' file with defaults.

Problems with x32 bit docker-images and Fabric.

On my old laptop I've got windows in 32bit version installed, so obvious reason was to install a 32bit ubuntu VM on it and then use docker from this VM.

Then I've stepped on problem, that almost all type of docker images out-there, supports only 64bit docker-host - this means that images like python:2.7.11 also does not work - since they are supported only on 64 bit arch. A Prove of this concept can be seen on one of VM's I'm currently using - proudly presents using AsciiNema :

Now, I could re-install windows on laptop,but since this laptop has history with battery not-keeping energy and a malfuncion of power at startup, I've decided not to go this way.

Before I figure out that I could deploy second VM with 64bit ubuntu as a docker-host (since laptop supports 64bit architecture), I've decided I'll go a longer but much more satisfying way - creating my own docker images that will support 32bit hosts!

My thinking was like that: I've got an even older laptop that supports only 32bit architecture and few stationary machines - this docker images will be usefull for future deployment.

My adventure with building 32bit docker image that will support Fabric and Pelican and other deployment/development packages has began.

Building x32 Bit Docker image with packages for Fabric

I didn't have to start from "source" - since I already had an ubuntu-trusty 32bit image that I've created some time ago using tutorial which you can find HERE.

I've used a anselmos/ubuntu32 image that is available at image

As this image is a bare-bone I had to first install a pip.

Funny, but I could not download "get-pip" from image, so I've added "wget" to docker-image. To be able to install Pip I had to install a wget by which I could download a "get-pip.py" file.

Then I had to install python since there was no-python.

After that I've realized that just "pip install Fabric" will not work, because there are linux library dependencies for Fabric like : - python-dev - libffi-dev - libssl-dev

Finally I knew Pelican python-library does not go with Markdown installed as default (reStructured is) so I had to add Markdown.

Thankfully then I was able to work on docker-image and finally we can move-on to part where we actually configure our deployment for ssh/ftp

Final version of ubuntu-trusty docker x32 bit docker image with Pelican installed and Fabric ready is pelican32

You can use docker pull anselmos/pelican32 and the image will appear at your host. Keep in mind that this image will only work on x32bit Host-machine for docker. For x64bit - just use official image for python and do pip install Pelican && pip install Fabric. You may also use image that I've prepared based on python:2.7.11 image available pelican

Configuring Deployment for Fabric using ssh/ftp.

At beginning when using pelican-quickstart script, a file called fabfile.py is created with our answers.

We can change them if defaults that we set-up have change or we made a mistake.

Setup FTP connection

Unfortunatelly as I found out you cannot use Fabric with it's default fabfile.py setup for FTP.

At the time I'm writing this post, I'll not find time to fix this, but I see there's possibility to use make.

just make ftp_upload and using Makefile setup variables it will upload files

FTP_HOST=localhost
FTP_USER=bawi
FTP_TARGET_DIR=/var/www

Docker image I'm using needed installation of this packages:

apt-get install -y make
apt-get install -y lftp

I will make an update soon for how to overcome this issue using Fabric.

Setup SSH connection

Use the production variable and change to proper values, e.g. your production hostname is "localhost" and port on which ssh works is "22" and user on this host is "root" then value should be 'root@localhost:22'

For my setup I had to add also ssh-client for docker-image and add ssh-keys to image by adding docker-volume attachment.

Keep in mind, that using ssh method requires rsync installed on your system - my docker image didn't have it so ... yeah :) I had to install it :)

And also keep in mind that default directory is /var/www. If you want to change that then change variable : dest_path = '/var/www'

What's next ?

1. I will make an update on FTP fabric issue with how to overcome this.
2. Docker usage and making your own Docker image available at hub.docker.com

What do you think about this post ? Let me know in comments below - Stay Tuned ! Soon post for Get-Noticed!



Comments

comments powered by Disqus