Using Flockport containers
Please Note: If you haven't already set up LXC please visit the Get Started page to get an overview of how to install LXC in your specific Linux distribution. The Flockport repo provides easy to install LXC packages for Debian Wheezy. Ubuntu already has updated and well supported packages for LXC by default that work perfectly out of the box.
You can browse and download Flockport containers from the container section.
Here is a quick video on how to use Flockport containers. For this video we use the WordPress container.
Every container download page has 2 container downloads. A 64 bit Debian Wheezy container and a 32 bit Ubuntu Precise container. A 64 bit host can use either, but a 32 bit host can only use the 32 bit containers.
The default password for the Debian 64 bit containers
User : root Password : debian
The default password for Ubuntu 32 bit containers
User : ubuntu Password : ubuntu
FLockport containers ship in the xz format.
To see how let's use the WordPress container for this example.
Download and move the container to the LXC container folder.
mv containername /var/lib/lxc
Decompress Flockport container
tar -xvJf 'containername' --numeric-owner
Please note the capital J and --numeric-owner options.
The LXC container configuration options are set in the container name/config file. Please see the LXC Advanced guide in our News section to learn more.
The big moment! Launch the container with the following command.
lxc-start -n containername -d
See if container is running and get its IP with the command below
lxc-ls -f
This will give you a list of running containers and their IPs. You can also use lxc-info
lxc-info -n containername
This will give you details of the specific container including its IP.
If you followed our Getting started guide, it should work without a hiccup.
Nginx is running in the container and is accessible on the container IP. You can try entering the container IP in the browser and you should reach the Nginx default page.
The Flockport container is configured to be available the mywordpress.org URL. You can change this in the Nginx webserver settings as desired but let's leave that for later.
Edit your /etc/hosts to point mywordpress.org to the container IP from the lxc-ls command.
nano /etc/hosts
Suppose your container IP is 10.0.3.175
10.0.3.175 mywordpress.org
Now the application will be available at mywordpress.org in your browser.
Let's finish with a quick start video on using the Flockport Discourse container.
Browse below to our LXC basics and LXC networking guide. Visit the Flockport News section for more guides on configuring and optimizing Flockport and LXC containers.
Accessing Flockport containers on cloud or remote hosts
The above method obviously won't work on a remote system or a cloud KVM with the container in an internal NAT network behind a remote public IP.
Containers are configured to have access to the internet but if you need to make any services on the container available to the world you need to configure port forwarding from the host to the container.
For instance to forward port 80 from the host public IP 1.2.3.4 to a container with NAT IP 10.0.3.165 you can use the iptables rule below.
iptables -t nat -I PREROUTING -i eth0 -p TCP -d 1.1.1.1/32 --dport 80 -j DNAT --to-destination 10.0.3.165:80
This will make for instance an Nginx web server on port 80 of the container available on port 80 of the host.
Now to access the Flockport app in your browser simply add the remote public IP to your local /etc/hosts file.
1.2.3.4 mywordpress.org
This is just an example, change the remote IP and container IP in the above to match your remote system IP and container IP. Of course when you want to use the app in production you will need to make the appropriate changes in your domain or service providers DNS settings.
Flockport container conventions
There are a number of moving parts in Flockport containers with inherent complexity and all choices have been made keeping a simple user experience in mind.
At the same time we do not want generic containers that are just pasted together.
Scalability, reliability and robustness is important. And we ideally do not want users struggling with LXC or Flockport containers in any way.
Containers should be well documented, consistently reliable and be easy to use and deploy.
Flockport containers follow a few conventions.
- For Debian containers the root password is debian
- For Ubuntu containers the user is ubuntu and password is ubuntu
- Flockport containers are shipped in the tar xz format.
- There is a flockport.readme and appname.readme file in the root folder with application and database details.
- Flockport Containers are configured to use the default lxcbr0 bridge. The interface will be setup and enabled properly if LXC is installed from the Flockport or Ubuntu repo, with container IP being managed by Dnsmasq DHCP.
- Applications are configured in Nginx to be available at the myappname.org URL for instance if you download Discourse the app is available is mydiscourse.org.
- To access the application first get the container IP with the lxc-ls command and configure your /etc/hosts to access the Flockport application at myappname.org
- To keep container size to a minimum APT archives are deleted before containers are packaged.
- All application and stacks are installed from official repositories and configured for defaults. Flockport containers are built with official installation guides wherever possible and efforts made to stick to standards, so users have a base environment as it would be if they built it themselves. Optimization and customizations is left to user discretion. Any exceptions are documented in the containers.
Flockport utility
It's only been tested on Debian Wheezy and functions as a simple utility to list containers available and download and make them available for use on your system from the terminal. You need tar, curl and xz-tools available on your system.
Here is the Flockport utility in action
The Flockport utility lets you view and download Flockport containers directly to your systems.
flockport help
This gives you a list of options to use the utility
flockport list
This lists Flockport containers available for download
flockport login
This prompts you for your credentials and logs you in to enable downloads of Flockport containers. Username and Password are your flockport.com credentials, and the login is typically valid for 14 days, so you don't need to login to download for subsequent downloads
flockport check
This checks your login status
flockport get containername
This downloads the selected container and makes it available for use in your system
flockport get md5
flockport get sha
This will download the md5/shasum of flockport containers to your LXC folder
flockport version
This gives you the Flockport utility and LXC version currently installed on you system
The utility is fairly straight forward. Errors if any will be related to invalid or expired login credentials or erroneous containernames. Please check these carefully if you get errors.