Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
gitlab_to_aptly [2021/05/29 14:51] okias created |
gitlab_to_aptly [2021/06/29 20:36] (current) okias english |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Creating repository from automated Debian Salsa builds ====== | ====== Creating repository from automated Debian Salsa builds ====== | ||
| + | {{ : | ||
| ===== Motivation ===== | ===== Motivation ===== | ||
| I'm not an Debian maintainer. Nor I want to be in future. | I'm not an Debian maintainer. Nor I want to be in future. | ||
| - | My reasons to do all this is that: | + | My reasons to do all this is: |
| - I want some specific software to be packaged for Debian | - I want some specific software to be packaged for Debian | ||
| - | - when I update packaging on salsa.debian.org I want to have available package for computers and phones | + | - when I update packaging on salsa.debian.org I want to have available package for my devices |
| - | - I don't want to bother | + | - I don't want to bother |
| - I want also others to be able use my packages | - I want also others to be able use my packages | ||
| These reasons motivated me to look into [[salsa.debian.org/ | These reasons motivated me to look into [[salsa.debian.org/ | ||
| + | |||
| + | ==== Advantages ==== | ||
| + | * package build process is handled by salsa, no need to worry about it | ||
| + | * ecologic - it's build only once | ||
| + | |||
| + | ==== Disadvantages ==== | ||
| + | * no control about build process than offered by salsa-ci.yml configuration file | ||
| + | |||
| + | ===== Predisposition ===== | ||
| + | - You did correctly setup **debian/ | ||
| + | - you build for achitectures you'll be distributing with aptly | ||
| + | |||
| + | You can look at project configuration of [[https:// | ||
| ===== Where to start ===== | ===== Where to start ===== | ||
| Line 21: | Line 34: | ||
| Then it's a time to create user and generate your repository replated GPG key. | Then it's a time to create user and generate your repository replated GPG key. | ||
| + | ==== Aptly ==== | ||
| < | < | ||
| useradd -m repo && export USER=repo # create user repo | useradd -m repo && export USER=repo # create user repo | ||
| Line 53: | Line 66: | ||
| TOKEN= # watch https:// | TOKEN= # watch https:// | ||
| - | ARCHS=" | + | ARCHS=" |
| - | JOBS=" | + | JOBS=" |
| ARTIF_UNPACK=debian/ | ARTIF_UNPACK=debian/ | ||
| Line 91: | Line 104: | ||
| get_artifacts() { | get_artifacts() { | ||
| for job in $JOBS; do | for job in $JOBS; do | ||
| - | curl -o ${id}_${job}.zip -H ' | + | BRANCH=" |
| + | curl -o ${id}_${job}.zip -H ' | ||
| unzip ${id}_${job}.zip && \ | unzip ${id}_${job}.zip && \ | ||
| rm ${id}_${job}.zip && \ | rm ${id}_${job}.zip && \ | ||
| Line 108: | Line 122: | ||
| aptly repo add ${REPO_NAME} ${ARTIF_UNPACK} # add files | aptly repo add ${REPO_NAME} ${ARTIF_UNPACK} # add files | ||
| aptly publish drop unstable # first we get rid of previously published repo | aptly publish drop unstable # first we get rid of previously published repo | ||
| - | | + | APTLY_ARCHS=`echo $ARCHS | tr " " ,` |
| + | aptly publish repo -batch -architectures | ||
| } | } | ||
| Line 115: | Line 130: | ||
| publish | publish | ||
| + | </ | ||
| + | |||
| + | ==== Nginx ==== | ||
| + | |||
| + | Test script with < | ||
| + | |||
| + | **/ | ||
| + | < | ||
| + | server { | ||
| + | include ssl.conf; | ||
| + | server_name repo.ixit.cz; | ||
| + | ssl_certificate / | ||
| + | ssl_certificate_key / | ||
| + | |||
| + | location / { | ||
| + | root / | ||
| + | autoindex on; | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | systemctl reload nginx and check URL, if you see the repository. | ||
| + | |||
| + | ==== Testing it ==== | ||
| + | |||
| + | In that case, you can try add it to the first device. Replace ixit with your repository name: | ||
| + | |||
| + | < | ||
| + | echo "deb https:// | ||
| + | curl -o / | ||
| + | apt update # shouldn' | ||
| + | </ | ||
| + | now you can install package you desire and test. | ||
| + | |||
| + | ==== Repository refreshing ==== | ||
| + | |||
| + | Most likely, you'll want to regenerate your repository at least every hour. | ||
| + | |||
| + | This is how can look **/ | ||
| + | < | ||
| + | [Unit] | ||
| + | Description=Radioalarm service | ||
| + | |||
| + | [Service] | ||
| + | User=repo | ||
| + | WorkingDirectory=/ | ||
| + | ExecStart=/ | ||
| + | </ | ||
| + | and **/ | ||
| + | < | ||
| + | [Unit] | ||
| + | Description=Update aptly repository every hour | ||
| + | |||
| + | [Timer] | ||
| + | OnBootSec=60min | ||
| + | OnUnitActiveSec=60min | ||
| + | Unit=gitlab_to_aptly.service | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=timers.target | ||
| </ | </ | ||