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

finish first draft of documentation changes

parent f548d9e3
No related branches found
No related tags found
1 merge request!419Resolve "Update installation docs for flux2"
......@@ -103,119 +103,20 @@ inside the containers). However, it is possible to mount persistent volumes to
specific directories in the container, basically adding a persistent layer on
top of the containerised application. To provide this in OAS's simple setup, we
use a [local storage
provisioner](https://github.com/rancher/local-path-provisioner) that
provisioner](https://github.com/greenhost/local-path-provisioner) that
automatically provides persistent data on the VPS running OAS to an application
that requests it.
## Automatic updates
OpenAppStack has an auto-update mechanism that performs unattended upgrades to
applications. [Flux](https://fluxcd.io/) is the system running in the cluster
applications. [Flux 2](https://fluxcd.io/) is the system running in the cluster
that is responsible for these updates.
Technically, flux is split up in two components: `flux` and `helm-operator`.
`flux` watches a git repository (or subdirectory thereof) for [source
files](https://docs.fluxcd.io/projects/helm-operator/en/latest/references/helmrelease-custom-resource.html)
that prescribe which application versions should be installed, and stores a copy
of those prescriptions inside the cluster as a Kubernetes manifest (of kind
`HelmRelease`).
`helm-operator` watches those in-cluster `HelmRelease` manifests, checks whether
the listed applications are already installed – including correct versions and
other settings – and performs any actions that are necessary to make sure that
the cluster state matches the prescriptions: installing new applications,
upgrading others.
Which git repository is watched by flux, is configurable. For typical
production OpenAppStack deployments, this is set to be
`https://open.greenhost.net/openappstack/openappstack` – the `HelmRelease` files
are stored in the `flux` directory. The OpenAppStack team considers available
upstream updates (say an update to Nextcloud). If the new Nextcloud version
passes our tests, the team changes the corresponding application description
file in the git repository (in this case `flux/nextcloud.yaml`) to reference the
new version. OpenAppStack deployments that are configured to watch this git
repository will see the change, record it in the in-cluster `HelmRelease`
manifest, and have their `helm-operator` perform the Nextcloud upgrade.
### Customising which applications are installed
The `HelmRelease` files in the `flux` directory form the applications that are
available for installation. There is an additional mechanism though, to allow
the cluster administrator to choose which applications are actually installed.
You might want to leave out some apps that you think you won't use, and save
some resources that way. You can choose which apps to enable/disable by modifying the `enabled_applications` list in `CLUSTERDIR/group_vars/all/settings.yml`, and afterwards running the OAS install procedure.
Every `HelmRelease` file should have a corresponding Kubernetes Secret, which
we call a "settings secret". For the apps that are part of OpenAppStack, these
secrets are created by the OpenAppStack installation procedure, so you don't
need to handle them unless you want to customise the set of installed
applications.
The subdirectory of `/flux` where the `HelmRelease` file is located corresponds
to the namespace of the secret. For example, the `HelmRelease` file
`/flux/oas-apps/nextcloud.yml` corresponds to the Kubernetes secret
`nextcloud-settings` in the namespace `oas-apps`.
This Kubernetes secret contains two keys:
* `enabled`: this should contain a simple string: `true` to enable the application, or
`false` to disable it;
* `values.yaml`: this contains a yaml-formatted string with Helm values that
are supplied to Helm when the application is installed.
### Local development
**NOTE**: Local flux was removed. Documentation will be updated soon.
When developing OpenAppStack, it's nice to be able to change the application
versions for your development cluster only, without affecting production
clusters. One way to do that is to set the `flux_source.repo` and/or
`flux_source.branch` ansible variables to point to another branch of the
`open.greenhost.net/openappstack/openappstack` repository, or to a different
repository.
To make this easier, we included a way to serve up a git repository with
`HelmRelease` manifests from the cluster itself, so you don't need an external
Gitlab or Github project. This feature is disabled by default, and can be
enabled by setting the `local_flux` ansible variable to `true`. If enabled, this
will change several things:
* when you run the OpenAppStack installation ansible playbook from your
workstation, the current contents of the `flux` directory from your
workstation are copied to a directory (`/var/lib/OpenAppStack/local-flux`) on
the OpenAppStack host machine; also, a git commit is created in that directory
on the host machine from these updated contents;
* as part of the OpenAppStack installation, an nginx instance is deployed that
serves up the contents of `/var/lib/OpenAppStack/local-flux` over http;
* `flux` is configured to read the `HelmRelease` files from that git repository,
served by the in-cluster nginx. In particular, the `flux_source` variables are
ignored if `local_flux` is enabled.
The `local-flux` feature is also used by our CI pipeline, in order to be as
similar as possible to a production installation, in particular using `flux` and
`helm-operator` for the installation process, while still being completely
separate from the production applications versions as prescribed by the master
repository at `open.greenhost.net/openappstack/openappstack`.
#### Triggering an update
Both `flux` and `helm-operator` check at regular intervals (currently 1 hour
and 20 minutes, respectively) whether there is an upgrade to perform. If you
don't want to wait for that after making a change, you can trigger an update:
* to let `flux` re-read the `HelmRelease` files from the git repo (be it the
OpenAppStack master one, a `local-flux` one, or yet another one), log in to
the host machine and do
$ fluxctl --k8s-fwd-ns=oas sync
If there are any changes to `HelmRelease` manifests, `helm-operator` is
notified of that through the Kubernetes API and should act on them more or
less instantly (though the actual installation or upgrade could take quite a
while, depending on what needs to be done).
* If, for some reason, the `HelmRelease` manifests are still in sync between git
repository and cluster, but you'd still like to let `helm-operator` check
whether these `HelmRelease`s match what's actually installed, you can force
that by deleting the `helm-operator` pod:
$ kubectl delete pod -n oas -l app=helm-operator
A new `helm-operator` pod should be created automatically, and in our
experience will do a reconciliation run soon.
Flux 2 tracks all the files in the `flux2` directory of the [OpenAppStack code
repository](https://open.greenhost.net/openappstack/openappstack). Once changes
are pushd the branch that Flux tracks, the changes are applied to the cluster.
We use Flux 2 in "read only" mode, which means that your OpenAppStack cluster
does not push changes to our Git repository. You can read more about Flux 2 and
its components in the [flux 2 documentation](https://fluxcd.io/docs).
......@@ -8,9 +8,6 @@ created:
- `/var/lib/OpenAppStack/local-storage`: all application data (e.g., Nextcloud
files) are stored here.
- `/var/lib/OpenAppStack/source`: On development setups, this contains the
`local-flux` git repository.
- `/var/lib/rancher/k3s`: this contains the files related to your "Kubernetes"
cluster.
- The kubectl configuration file is located at `/etc/rancher/k3s/k3s.yaml`
......
......@@ -2,16 +2,16 @@
## General considerations before upgrading
Include all potential new values of `ansible/group_vars/all/settings.yml.example`
in your `clusters/YOUR_CLUSTERNAME/group_vars/all/settings.yml`.
To find the differences (requires [python yq package](https://pypi.org/project/yq/)):
## Upgrading from 0.5.0 to 0.6.0
yq -y -rS . clusters/YOURCLUSTER/group_vars/all/settings.yml > /tmp/mine.yml
yq -y -rS . ansible/group_vars/all/settings.yml.example > /tmp/upstream.yml
diff /tmp/mine.yml /tmp/upstream.yml
Because we don't know about any OAS users between these versions, we have not
written an upgrade procedure for this version.
Before you upgrade please look at the `CHANGELOG.md` file to review what changed
between the versions.
Please read the section below on how to do an upgrade by installing a the new
OAS version from scratch after backing up your data.
Please [reach out to us](https://openappstack.net/contact.html) if you are
using, or plan to use OAS in production.
## Upgrading from 0.4.0 to 0.5.0
......@@ -112,8 +112,3 @@ intervention.
`pvc`s that are left behind. Flux will not re-use the database PVCs created
for these applications. Find all the pvcs by running `kubectl get pvc
--namespace oas-apps` and `kubectl get pvc --namespace oas`
## Troubleshooting
If you encounter problems when you upgrade your cluster, please try again
running the installation procedure before reporting an issue.
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