Practical Linux application deployment on desktops
Despite the fact that initially the Linux Deploy was conceived as an Android application, over time, other options appear in its implementation. With the advent of the Linux, Deploy CLI became an available number of possibilities that open up a new scope of this tool.
Deploy Linux CLI is an application with a command-line interface that is designed to automate the process of installing, configuring, and running GNU/Linux distributions, the chroot inside the container. The application can work both in conventional desktop Linux distributions, and mobile platforms based on the Linux kernel and, subject to the necessary dependencies (all dependencies can assemble statically). Application on Linux-distro run in a chroot environment, work in parallel with the primary system and comparable in speed. The Linux Deploy is based on Linux kernel system call, as a “guest” systems could be made only by Linux distributions.
The application can operate in two modes: as root (chroot) and without them (proof). In normal mode are available for all supported types of installation: install to a file on a drive partition (logical drive), POSIX compliant directory and memory (temps). The proof mode is available only in the installation directory, and also appears in some restrictions:
All users within the container have full access to the entire file system container, and all records and lists owner is the current user; No access to privileged system operations, for example, the ping does not work, limit, etc.; Applications can only work with numbers of network ports above 1024; If your application uses in its work the chroot system call, then it must be run through a special utility, for example, fakechroot
The application supports unattended installation (base system) and the initial configuration of the Linux distributions Debian, Ubuntu, Kali Linux, Arch Linux, Fedora, CentOS, openSUSE, Gentoo, and Slackware. Also, you can import any other system of prearranged rootfs-ahriva in tar format.gz, or tar xz. tar.bz2.
The application allows you to connect to the console of the installed system (container), as well as start and stop applications inside a container (it supports various systems initialization and startup scripts of their own). Each installation option saved in a separate configuration file, which is responsible for setting up each container. If necessary, you can run parallel containers. You can export the settings and the container itself as a roots-archive for latest deployment of this container without having to install and configure.
The idea is deploying Linux originated from a desire to get an easy and convenient tool for quick deployment of Linux-distribution, which could use for development purposes, testing or training, and then quickly remove it without making changes in the primary (host) Linux system and without risking its integrity. Proot program became possible to create containers to run Linux applications without requiring superuser (root), as well as use software emulation BECAUSE QEMU to run applications with different host architecture without the need to support the binfmt_misc kernel module.
It turned out that on my main work with the year 2011 used computers with Debian. Local developers periodically require the system on which to run and test your Web applications (mostly Java, PHP, Python). For these purposes, are usually used either virtual systems by VirtualBox, either in a local cloud Proxmox or Docker. The main disadvantage of VirtualBox is its insistence to computer resources, large size VDI disc image, relatively low speed and the likelihood of breakage of the VM image When the system shut down improperly. The downside to using “cloud” can be called a need for administrator himself serve user requests for the establishment of such systems, as well as expenditure cloud resources to secondary tasks. To work with Docker requires superuser privileges.
This month has been an experiment, LD-container replaced PHP developers to their virtual server. Two containers were prepared on the basis of Debian: Apache + PHP + OCI8 and Apache + PHP + MySQL + PhpMyAdmin. The containers placed on a shared network drive on a local area network, each packet size was approximately 150 MB.
That got the administrator:
Once prepared, the container can be deployed on a developer’s computer one command without the participation of the administrator. Working with container does not require root permissions, so there is no risk of breakage of the primary system.
That got a developer:
Deploy, run and manage the system in the container is carried out without the participation of the administrator a single command;
The deployment container from predefined archives network in less than a minute;
Starting and stopping a container (the Web Server + Database) is instantaneous, no need to wait for the operating system startup;
There is no risk to damage the tank if you forgot to turn it off when you shut down your computer because a system image is a mere catalog without a proprietary file system;
The computer runs faster because resources are spent only on startup software in the container and not to the entire operating system (in this case about 50 MB, 500 MB in VirtualBox instead).
Health checks directly from the catalog of the IDE without having to fill it to the server, it is enough to connect the container to the correct directory on the host system.
And now in more detail about how to achieve this. Next, you will give instructions for the preparation and deployment of the LD – container.
To run containers without root permissions, you must install Proot:
Connect to the console as root container (the exit command to exit):
linuxdeploy-p-u root linux shell
You can then install and configure the required software in the container but should take into account the previously described features. For example, to run the Apache to change its port (file/etc/apache2/ports.conf) at 8000, set an empty parameter APACHE_ULIMIT_MAX_FILES = “” (file/etc/apache2/envvars) and the apache CTL start from under a normal user (not root).
Parameters: INIT_LEVEL-SysV init level, INIT_USER — under which user to run services (by default, root), INIT_ASYNC-run services in parallel.
Preparing configuration, export it and export container in the rootfs-archive (tar.gz, tar.bz2 tar .XZ files):
linuxdeploy-p linux conf-source-path = ‘ ‘-linux.tgz target-path = ‘ $ENV/rootfs/linux _DIR-chroot-dir = ‘ $TARGET ‘ _PATH linuxdeploy-p linux conf-x >/path/to/linux.conf linuxdeploy-p linux export/path/to/linux.tgz
Shielding $ lets you save the config variable names, rather than their values. So when you import config variables will automatically be replaced with the appropriate values, which may differ from the current. Now there are two files (Linux and linux.tgz) that you can use when importing a container on another computer:
CD/path/to linuxdeploy-p linux conf-i./linux.conf linuxdeploy-p linux deploy
Connect to the main system directory container (Directory ~/www plug in/var/www container):
linuxdeploy-p linux conf-mounts = ‘ $HOME/www:/var/www ‘
Start the container (for SysV script runs/etc/rcN.d/SXXname start):
linuxdeploy-p linux start
Stopping a container with the release of resources (for SysV script runs/etc./rc6.d/KXXname stop):
linuxdeploy-p linux stop-u
That all. Please let us know if you have any issues or want to share your thought.
The Founder of Smart Spate. His role involves creating work to the highest standards, supporting other members of the team, and researching techniques and systems to keep SmartSpate at the forefront of digital. We spend a lot of time to making sure that the topics quality was high and with a most informative approach.
He has an unhealthy love of IT and Online Marketing and enjoys exploring the ever-changing world of online advertising.