diff --git a/.gitlab/ci_scripts/create_vps.sh b/.gitlab/ci_scripts/create_vps.sh index 0df99e4f6d5fcbfa7c3e4f6af5ce1bfe1c57814a..01d612ac3071c41a4f63dc7d88ff258bc3a6b4a2 100644 --- a/.gitlab/ci_scripts/create_vps.sh +++ b/.gitlab/ci_scripts/create_vps.sh @@ -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}" \ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 864401c706da93547bf0b7c52edc73861ca93e08..3b75e62c902bee2734bd6b2281e7df70f160e0e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/ansible/roles/pre-configure/tasks/main.yml b/ansible/roles/pre-configure/tasks/main.yml index b94ac12557188039b4c510ec4a4e46fdb57be051..18191f3acfb1dbf15daa6545dd3c1d7186be6cc5 100644 --- a/ansible/roles/pre-configure/tasks/main.yml +++ b/ansible/roles/pre-configure/tasks/main.yml @@ -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 diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst index 955404d1039a4f139ea1bbb389ce885ffde54dd2..650f482bc0486561a4000f895a806a168bef836e 100644 --- a/docs/troubleshooting.rst +++ b/docs/troubleshooting.rst @@ -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