К основному контенту

Сообщения

Сообщения за 2018

LXD - Заметки

lxd-fix-privileged   lxc config set u3 security.privileged true Allow LXD/LXC to mount Glusterfs from the host Type the following command on your host: $ sudo -i Type the following two command: # echo Y > /sys/module/fuse/parameters/userns_mounts # echo Y > /sys/module/ext4/parameters/userns_mounts Edit the /etc/rc.local file: # vi /etc/rc.local Edit/Update it as follow before exit 0 line:   echo Y > /sys/module/fuse/parameters/userns_mounts echo Y > /sys/module/ext4/parameters/userns_mounts   Mount Glusterfs client on lxc/lxd VM You need to create a mount point using the mkdir command: $ sudo mkdir /data/ Mount it as follows: $ sudo mount -t glusterfs gfs01:/gvol0 /data/ Update /etc/fstab as follows: $ echo 'gfs01:/gvol0 /data glusterfs defaults,_netdev 0 0' >> /etc/fstab Save and close the file. You can now store data at /data/ location and it will get replicated across the cl...

Docker - заметки

Фильтр: -f, --filter value Filter output based on conditions provided (default []) - dangling=(true|false) - label= < key > or label= < key > = < value > - before=( < image-name > [:tag]| < image-id > | < image@digest > ) - since=( < image-name > [:tag]| < image-id > | < image@digest > ) - reference=(pattern of an image reference)       Удаление образов Docker Удаление одного или нескольких конкретных образов Используйте команду docker images command со флажком -a , чтобы найти ID образов, которые вы желаете удалить. Эта команда покажет вам каждый образ, включая промежуточные слои образа. После того как вы обнаружили нужный образ, который вы хотите удалить, вы можете включить их ID или тэг в команду docker rmi : Список: docker images -a Удаление: docker rmi Image Image ...

Tools Python development

Вы можете использовать следующий код для создания файла requirements.txt:   pip install pipreqs pipreqs / path / to / project подробнее связанные с pipreqs можно найти здесь . Иногда вы столкнетесь pip freeze , но сохраняют все пакеты в окружающей среде , включая те , которые вы не используете в текущем проекте

How to create a vagrant VM from a libvirt vm/image

It cost's me some nerves and time to figure out how to create a vagrant image from a libvirt kvm vm and how to modify an existing one. Thanks to pl_rock from stackexchange for the awesome start. First of all you have to install a new vm as usual. I've installed a new vm with Ubuntu 16.04 LTS. I'm not sure if it's really neccessary but set the root password to "vagrant", just to be sure. Connect to your VM via ssh or terminal and do the following steps. Create a new user for vagrant: adduser vagrant Vagrant user should be able to run sudo commands without a password prompt: sudo visudo -f /etc/sudoers.d/vagrant vagrant ALL=(ALL) NOPASSWD:ALL Install ssh-server if that's not already done: sudo apt-get install -y openssh-server Create a home directory for your vagrant user and also get the master key: mkdir -p /home/vagrant/.ssh chmod 0700 /home/vagrant/.ssh wget --no-check-certificate \ https://raw.github.com/mitchellh/vagrant/master/keys/vag...

Testing Ansible Roles using Molecule and Vagrant

Ansible Ansible is a radically simple IT automation engine that automates cloud provisioning , configuration management , application deployment , intra-service orchestration , and many other IT needs. TestInfra With Testinfra you can write unit tests in Python to test actual state of your servers AND/OR ServerSpec With Serverspec, you can write RSpec tests for checking your servers are configured correctly. And Molecule Molecule is designed to aid in the development and testing of Ansible roles including support for multiple instances, operating system distributions, virtualization providers and test frameworks. Getting started with molecule Installing molecule $ pip install molecule molecule --version Create an Ansible Role $ molecule init test-role-vagrant Successfully initialized new role in ./test-role-vagrant This will create an ansible role with the following directory structure test-role-vagrant ├── README.md ├── defaults │ └...

Testing your Ansible roles with Vagrant

In ansible , development , vagrant Travis.ci offers a simple and free way to test your Ansible roles but that’s after you’ve pushed and published your code. What if you want to verify how a change looks on a machine or easily see that build error without using an existing machine? This led me down the path of locally provisioning a virtual machine and outside of a normal virtual machine that I have running, I just wanted a standalone build just for a role. I first went down the Docker route since that’d give me a good starting point but I still enjoy the simplicity of a Vagrant controlled virtual machine. The CLI is incredibly simple and you can easily swap out the base box to test on different distros if you’d like. Also, Vagrant has an ansible_local provisioner that makes it as simple as pointing it at your test playbook to run which I already have in place for Travis.ci. The setup for this is based ...

LXD Adjusting size of root device

lxc config show openvpn   architecture: x86_64  config:   image.architecture: amd64   image.description: ubuntu 16.04 LTS amd64 (release) (20180306)   image.label: release   image.os: ubuntu   image.release: xenial   image.serial: "20180306"   image.version: "16.04"   raw.lxc: lxc.cgroup.devices.allow = c 10:200 rwm   volatile.base_image: c5bbef7f4e1c19f0104fd49b862b2e549095d894765c75c6d72775f1d98185ec   volatile.eth0.hwaddr: 00:16:3e:88:32:82   volatile.eth0.name: eth0   volatile.idmap.base: "0"   volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":165536,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":165536," Nsid":0,"Maprange":65536}]'   volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":165536,"Nsid":0,"Maprange":65536},{"Isuid...

OpenVPN in LXD Container

https://github.com/Angristan/OpenVPN-install https://github.com/Nyr/openvpn-install wget https://raw.githubusercontent.com/Angristan/OpenVPN-install/master/openvpn-install.sh chmod +x openvpn-install.sh # On the host ============= lxc config set openvpn raw.lxc 'lxc.cgroup.devices.allow = c 10:200 rwm' lxc config device add openvpn tun unix-char path=/dev/net/tun # In the container ================== 1. mknod /dev/net/tun c 10 200 2. install OpenVPN (https://github.com/Nyr/openvpn-install or manual) 3. edit /lib/systemd/system/openvpn@.service -- comment out/remove `LimitNPROC=10` 4. systemctl daemon-reload or reboot container

Installing LXC with a web interface on Ubuntu 16.04

Linux Containers are insanely useful. Whether it be for stopping an application from cluttering your filesystem with it's configuration, or packaging an application for deployment anywhere, they are truly one of the most useful technologies in linux to date, and are only just coming into the limelight. This tutorial will show you how to install LXC with a web interface for VM-like management. A quick google search told me that LXC Web Panel looked to be the best solution for this. The only problem was that their project hadn't been updated in quite a while, and was lacking many features. I was lucky to find a fork of LWP on github which had been updated much more recently, available at  https://github.com/claudyus/LXC-Web-Panel . Step 1 - Installing LXC sudo apt-get install lxc Step 2 - Installing from the claudyus ppa As per the instructions accessible from the github page, install the author's package repository to your system. Personally I don't l...

All-In-One Single LXC Container

This guide walks you through the process of deploying OpenStack using devstack in an LXC container instead of a VM. The primary benefits to running devstack inside a container instead of a VM is faster performance and lower memory overhead while still providing a suitable level of isolation. This can be particularly useful when you want to simulate running OpenStack on multiple nodes. Warning Containers do not provide the same level of isolation as a virtual machine. Note Not all OpenStack features support running inside of a container. See   Limitations   section below for details.   OpenStack in a VM   is recommended for beginners. Prerequisites ¶ This guide is written for Ubuntu 14.04 but should be adaptable for any modern Linux distribution. Install the LXC package: sudo apt - get install lxc You can verify support for containerization features in your currently running kernel using the   lxc-checkconfig   com...