packaging_apps_advanced_packagers

This commit is contained in:
yalh76 2021-03-13 16:59:37 +01:00
parent 12c1957642
commit 4d5b4e6c99

View file

@ -1,4 +1,4 @@
# Packing Applications : Advanced
# Packing Applications : Advanced Packagers
Here comes the time:
- you know all the [YEPs](/packaging_apps_guidelines)
@ -17,7 +17,7 @@ Usually, there are things that slow you down:
The idea is to use YunoHost stuffs to help you improve this lost time.
## Building your infrastructure
First idea is to build several VMs or LXCs with YunoHost to let you parallelize actions, like having the first one installing an apps, the second installing another apps, the third one debugging an apps upgrade, etc...
First idea is to build several VMs, LXCs or VirtualBoxs with YunoHost to let you parallelize actions, like having the first one installing an app, the second installing another app, the third one debugging an app upgrade, etc...
After first installation of those VMs/LXCs, each one has to be reacheable with its domain name, like for example:
- ynh1.mydomain.org
@ -27,6 +27,8 @@ After first installation of those VMs/LXCs, each one has to be reacheable with i
For that you will need a public IP for each one or reverse proxy...
If your are lucky enough to have IPV6 and a /64 IPV6 scope, it won't be a problem to assign a public IPV6 to each YunoHost.
Another way the DNS stuff is to simply use an hosts file.
In addition, it's helpfull to have several domains names for each YunoHost, for example:
- ynh1.mydomain.org
- test11.mydomain.org
@ -47,13 +49,98 @@ When your infrastructure is up and ready, you will have to do snapshots of each
Don't forget to regularly upgrade your YunoHosts VMs/LXCs to the last release doing: revert back to last happy/healthy YunoHost snapshot and doing `yunohost domain cert-renew --no-check && yunohost tools update && yunohost tools upgrade --apps && yunohost tools upgrade --system && apt autoremove`. Take a snapshot after that successfull full upgrade. And after some testings or one week later, remove old snapshot. PS: that can be automated...
Example of a script to upgrade a master VirtualBox VM
```
#!/bin/bash
# printers
normal="\e[0m"
bold="\e[1m"
white="\e[97m"
blue="\e[34m"
echo_info()
{
echo -e "[${bold}${blue}INFO${normal}] ${bold}${white}$1${normal}"
}
echo_info "### Update host"
sudo apt update
sudo apt dist-upgrade
sudo yunohost settings set security.password.user.strength -v -1
sudo yunohost settings set security.password.admin.strength -v -1
echo_info "### Update package_check"
( cd package_check; git pull)
echo_info "### Update LXC container"
package_check/sub_scripts/lxc_upgrade.sh
echo_info "### Clean hosts"
sudo apt autoclean
sudo apt autoremove
echo_info "### Fill free space with zero"
cat /dev/zero > zeros ; sync ; rm zeros
echo_info "### Run 'VBoxManage modifyhd --compact file.vdi' to reduce the size of this VM"
```
Example of a script to customize a cloned VM
```
#!/bin/bash
master_domain=domain1.fr
domainX=domain2.fr
master_ip=70
ipX=68
sudo yunohost --admin-password admin domain add $domainX
sudo yunohost --admin-password admin domain add sous.$domainX
sudo yunohost --admin-password admin tools maindomain -n $domainX
sudo yunohost --admin-password admin domain remove $master_domain
sudo yunohost --admin-password admin domain remove sous.$master_domain
sudo sed -i "s/address 192.168.1.$master_ip/address 192.168.1.${ipX}/" /etc/network/interfaces
sudo reboot
```
Doing that you will have all the time a full/ready to go YunoHosts infrastructure for advanced packagers. And if require, you can have some VMs/LXCs runnning the YunoHost testing or YunoHost next Debian main version.
## Having your packages/commits available in each VMs/LXCs
There are several ways to have your freshly created package available from each VMs/LXCs
1- Do an ssh from the YunoHost VM/LXC to a central repository on your computer
2- rsync you central repository to each VM/LXC
3- use [syncthing](https://github.com/YunoHost-Apps/syncthing_ynh) to syncrhonise you main repository on each VM/LXC
2- Having a shared directory available from each VMs, LXCs VirtualBoxs
3- Rsync you central repository to each VM/LXC
4- Use [syncthing](https://github.com/YunoHost-Apps/syncthing_ynh) to syncrhonise you main repository on each VM/LXC
Example of a script to mount as shared directory a packaging directory into a VirtualBox VM
```
#!/bin/bash
shared_folder=my_directory
# printers
normal="\e[0m"
bold="\e[1m"
white="\e[97m"
blue="\e[34m"
echo_info()
{
echo -e "[${bold}${blue}INFO${normal}] ${bold}${white}$1${normal}"
}
# Create the main directory for the mount
sudo mkdir -p "./$shared_folder"
# Mount ynh-dev directory from the host
echo_info "Mount shared directory $shared_folder"
sudo mount -o defaults -t vboxsf $shared_folder "./$shared_folder"
```
## Shortcuts
Use and abuse of `yunohost app install` `--args` argument
@ -103,10 +190,9 @@ With that, you will be able to launch different actions on differents YunoHost V
With advanced packaging comes [CI_package_check](https://github.com/YunoHost/CI_package_check), it lets you serialize and automate package_check.
## Managing all the parallel packaging you are doing
## Managing all the parallel packaging you are working on
When you do several things at the same time, sometimes you don't remember what is the next step for this or that app.
A good tool to keep your TODO list organized is to use a kaban like:
A good tool to keep your TODO list organized is to use a kaban like apps:
- [kanboard](https://github.com/YunoHost-Apps/kanboard_ynh)
- [wekan](https://github.com/YunoHost-Apps/wekan_ynh)