Skip to content
Snippets Groups Projects
Commit e9b5cc97 authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

Merge branch '973-update-ci-droplet-image' into 'master'

Resolve "Update CI droplet image"

Closes #973

See merge request openappstack/openappstack!549
parents 3709664c 01ed7f36
No related branches found
No related tags found
No related merge requests found
......@@ -3,19 +3,23 @@
set -ve
# shellcheck disable=SC2039
VPS_HOSTNAME="$HOSTNAME"
# Delete old machine if it still exists
echo "Deleting old machine"
python3 -c "import greenhost_cloud; greenhost_cloud.terminate_droplets_by_name(\"^${HOSTNAME}$\")"
python3 -c "import greenhost_cloud;
greenhost_cloud.terminate_droplets_by_name(\"^${VPS_HOSTNAME}$\")"
echo "Creating new machine"
# Uses a custom disk image built with 42aa12b on 2021-09-14. See
# Uses a custom disk image built with 1f2bee2 on 2021-10-19. See
# CONTRIBUTING.md#ci-pipeline-image for more info.
python3 -m openappstack $HOSTNAME create \
--create-droplet $DOMAIN \
--create-hostname $HOSTNAME \
--ssh-key-id $SSH_KEY_ID \
python3 -m openappstack "$VPS_HOSTNAME" create \
--create-droplet "$DOMAIN" \
--create-hostname "$VPS_HOSTNAME" \
--ssh-key-id "$SSH_KEY_ID" \
--create-domain-records \
--subdomain $SUBDOMAIN \
--disk-image-id '-8751' \
--subdomain "$SUBDOMAIN" \
--disk-image-id '-9102' \
--truncate-subdomain \
--docker-mirror-server="${CI_DEPENDENCY_PROXY_SERVER}" \
--docker-mirror-endpoint="${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}" \
......
......@@ -77,32 +77,48 @@ the k3s version in use, you'll want to generate a new disk image template and
use it. This is a manual process for now. Follow these steps:
1. Create a new VPS
2. Run the following to install *only kubernetes* on the VPS:
```
$ python3 -m openappstack <cluster> install
export HOST_NAME=baseimage$(date +'%Y%m%d')
# Make sure you use your private ssh key id, 411 is the ssh key used in CI
export SSH_ID=411
python -m openappstack ${HOST_NAME} create --create-droplet --create-hostname ${HOST_NAME}.openappstack.net --ssh-key-id $SSH_ID --create-domain-records --subdomain ${HOST_NAME} openappstack.net
```
3. Log into your machine and clean up the k3s server, then delete the cluster
2. Accept ssh host key
```
ssh root@${HOST_NAME}.openappstack.net
```
3. Run the following to install *only kubernetes* on the VPS:
```
python3 -m openappstack ${HOST_NAME} install
```
4. Log into your machine and clean up the k3s server, then delete the cluster
data:
```
# Clean up running containers and firewall
/usr/local/bin/k3s-killall.sh
# Remove k3s state
rm -rf /var/lib/rancher/k3s
ssh root@${HOST_NAME}.openappstack.net
# Clean up running containers and firewall
/usr/local/bin/k3s-killall.sh
# Remove k3s state
rm -rf /var/lib/rancher/k3s
```
3. Log into Cosmos with the OpenAppStack account
4. Go to VPS Cloud -> VPS and shut down your VPS
5. Go to VPS Cloud -> Disk Images and click edit for your VPSs disk image
1. Change the Disk Label to something like `k3s-template`
5. Log into Cosmos with the OpenAppStack account
6. Go to VPS Cloud -> VPS and shut down your VPS
7. Go to VPS Cloud -> Disk Images and click `Manage` for your VPSs disk image
1. Change the Disk Label to something like `k3s-template-DATE`
2. Set VPS to `-- not assigned --`
3. Click 'make template'
4. Choose "Linux Latest LTS" as the kernel
5. Choose OS type Debian 11 (bullseye)
6. Remember the disk image ID that you can see in the current URL as `id=...`
7. Click save
6. Change the `--disk-image-id` argument in `.gitlab/ci_scripts/create_vps.sh`
3. Click save
4. `Manage` the same image again
5. Click 'make template'
6. Choose "Linux Latest LTS" as the kernel
7. Choose OS type Debian 11 (bullseye)
8. Remember the disk image ID that you can see in the current URL as `id=...`
9. Click save
8. Change the `--disk-image-id` argument in `.gitlab/ci_scripts/create_vps.sh`
to your current disk-image-id **with a minus in front of it**. This is
because custom images are negative integers, whereas Greenhost's disk images
are positive integers
9. Remove the droplet
You are now ready to merge the changes you made to the `install-kubernetes`
playbook
......@@ -6,14 +6,12 @@
import_tasks: journald.yml
- name: Update apt packages cache and install needed packages
# apt-transport-https is needed for docker apt repo
# curl and git is needed for helm plugin install
tags:
- firewall
apt:
state: present
name:
- apt-transport-https
- curl
- git
- haveged
......
......@@ -411,7 +411,7 @@ That can mean that one of your values contains a double quote (``"``) or that
you quoted a value in ``.flux.env`` during the :ref:`flux_config`. Make sure
that ``.flux.env`` does not contain any values that are quoted.
If you need to change ``.flux.env``, run the following commands:
If you need to change ``.flux.env``, run the following commands:
.. code:: bash
......@@ -439,5 +439,5 @@ OAS installation in order to start from scratch:
cluster$ /usr/local/bin/k3s-killall.sh
cluster$ systemctl disable k3s
cluster$ rm -rf /var/lib/{rancher,OpenAppStack,kubelet,cni,docker,etcd} /etc/{kubernetes,rancher} /var/log/{OpenAppStack,containers,pods} /tmp/k3s /etc/systemd/system/k3s.service
cluster$ rm -rf /var/lib/{rancher,OpenAppStack,kubelet} /etc/rancher /var/log/{OpenAppStack,containers,pods} /tmp/k3s /etc/systemd/system/k3s.service
cluster$ systemctl reboot
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment