Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QA-4202 Add lxc deploy scripts #1

Merged
merged 8 commits into from
Sep 14, 2023
Merged

QA-4202 Add lxc deploy scripts #1

merged 8 commits into from
Sep 14, 2023

Conversation

Berkof
Copy link
Contributor

@Berkof Berkof commented Sep 11, 2023

No description provided.

lxc/Deploy.sh Outdated
# size: 30GiB
# description: ""
# name: default
# driver: zfs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is zfs a default storage driver for LXC/Jepsen? Does it need additional kernel modules to be installed? AFAIK, it's not shipped with vanilla Linux kernel.

Copy link
Contributor Author

@Berkof Berkof Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made config as example, not mandatory. What storage can you recommend?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something available by default in the most popular distributions (like Ubuntu)

lxc/Deploy.sh Outdated Show resolved Hide resolved
lxc/Deploy.sh Outdated Show resolved Hide resolved
lxc/Deploy.sh Outdated Show resolved Hide resolved
lxc/Deploy.sh Outdated
#export USER=abelyak

export CONTAINERS=10
export NETPREF=192.168.122
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more hardcoded value. It wouldn't work for any user with different network. Prefix must be either detected automatically or - most probably - passed from the outside as a script argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add notice into README.md to keep the script simple with fewer parameters.

lxc/Deploy.sh Outdated

#export USER=abelyak

export CONTAINERS=10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, we should also pass this parameter from the outside of the script

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add notice into README.md to keep the script simple with fewer parameters.

lxc/Deploy.sh Outdated

function setup {
echo "01. Create"
for (( i=1; i<=$CONTAINERS; i++ )) do lxc-create -n n$i -t debian -- --release buster; done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about user's privileges for lxc-command and other commands? Does a user require sudo for them, or does it need to belong to some group? These commands are not available for everybody in the system.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md: requires root privileges

lxc/Deploy.sh Outdated Show resolved Hide resolved
lxc/Deploy.sh Outdated Show resolved Hide resolved
lxc/Deploy.sh Outdated
service networking restart

echo "07. Copy keys to the lxc containers"
export KEYFILE=/home/$USER/.ssh/id_rsa.pub

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this variable near the top of the script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

lxc/Deploy.sh Outdated
@@ -0,0 +1,188 @@
#!/bin/bash

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since almost every step require that all previous steps are executed successfully, I believe we should add set -e exit the script on any error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE

lxc/Deploy.sh Outdated

function start {
echo "09. Start lxc containers"
set -xe

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Place on top?

lxc/README.md Outdated
Comment on lines 60 to 75
# Possible errors:

# 1) If you get keyring error like: The specified keyring /var/cache/lxc/debian/archive-key.gpg may be incorrect or out of date
# Just download the new keys and import it with:
#
# wget "https://ftp-master.debian.org/keys/release-10.asc"
# sudo gpg --no-default-keyring --keyring /var/cache/lxc/debian/archive-key.gpg --import release-10.asc

# 2) If you get an error tryint to run virsh commands like:
# error: failed to connect to the hypervisor
# error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
#
# Install kvm with:
# sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system virtinst bridge-utils
# sudo systemctl enable libvirtd
# sudo systemctl start libvirtd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Berkof Berkof merged commit 301ed29 into main Sep 14, 2023
@Berkof Berkof deleted the qa-4202_lxc branch September 14, 2023 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants