Skip to content

Commit

Permalink
Create script to install The Combine on a standalone system (#2976)
Browse files Browse the repository at this point in the history
* Set Kubernetes version in ansible configs
* Add service to write wired ethernet addess to external device
* Remove backend init container
* Check for login credentials when a non-released version is requested
* Install on localhost
* Remove microk8s, fix lookup on user/group on localhost
* create playbook for desktop installation
* Comment out docker installation
* Set link_kubeconfig to true for localhost
* Fix regex for IP address
* Add local.thecombine.app to list of certificates for offline use (#2825)
* Add role to install helm
* Add initial helm repo setup
* Setup makeself to build installation self-extractor
* Add combinectl command to installation
* Add desktop install target
* Rename "docker_install" role to "container_engine"
* Separate hostname from DNS name for The Combine for local install
* Skip test of WiFi access point on desktop
* Move install of base helm charts to installation script
* Make Kubeconfig file only readable to owner
* Update repo for installing kubectl
* Add input arguments; resume from last install step
* Build combinectl from template
* Create readme for installation process
* Specify network management tool
* Add KUBECONFIG to user profile
* Migrate from netplan to network-manager
* Fix pattern for WiFi interfaces
* Assert that there is only one WiFi interface present
* Add state to wait for combine cluster to come up
* Update setting of ~/.kube/config to support local & remote access
* Set k8s_user to current for ansible install; remove debugging output
* Remove unhelpful messages from output when performing a standard installation
* Add script for uninstall
* Remove template for sudoer file - no longer used
* Add ability to print or customize the WiFi passphrase
* Add ability to print/set WiFi Password
* Convert README.md to README.pdf
* Add Desktop configuration for The Combine charts
  • Loading branch information
jmgrady authored Mar 25, 2024
1 parent 1d0ca5c commit 3312b57
Show file tree
Hide file tree
Showing 51 changed files with 1,287 additions and 244 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ src/resources/dictionaries/*.txt
deploy/scripts/semantic_domains/json/*.json
database/semantic_domains/*

# Combine installer
installer/combine-installer.run
installer/makeself-*
installer/README.pdf

# Kubernetes Configuration files
**/site_files/
**/charts/*.tgz
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ A rapid word collection tool. See the [User Guide](https://sillsdev.github.io/Th
6. [Inspect Database](#inspect-database)
7. [Add or Update Dictionary Files](#add-or-update-dictionary-files)
8. [Cleanup Local Repository](#cleanup-local-repository)
9. [Generate Installer Script for The Combine](#generate-installer-script-for-the-combine-linux-only)
3. [Setup Local Kubernetes Cluster](#setup-local-kubernetes-cluster)
1. [Install Rancher Desktop](#install-rancher-desktop)
2. [Install Docker Desktop](#install-docker-desktop)
Expand Down Expand Up @@ -127,6 +128,17 @@ A rapid word collection tool. See the [User Guide](https://sillsdev.github.io/Th
`dotnet tool update --global dotnet-reportgenerator-globaltool --version 5.0.4`
11. [dotnet-project-licenses](https://github.com/tomchavakis/nuget-license)
`dotnet tool update --global dotnet-project-licenses`
12. Tools for generating the self installer (Linux only):
- [makeself](https://makeself.io/) - a tool to make self-extracting archives in Unix
- [pandoc](https://pandoc.org/installing.html#linux) - a tool to convert Markdown documents to PDF.
- `weasyprint` a PDF engine for `pandoc`.
These can be installed on Debian-based distributions by running:
```console
sudo apt install -y makeself pandoc weasyprint
```
### Prepare the Environment
Expand Down Expand Up @@ -505,6 +517,23 @@ of development setup errors. Run from within a Python virtual environment.
python scripts/cleanup_local_repo.py
```

### Generate Installer Script for The Combine (Linux only)

To generate the installer script, run the following commands starting in the project top level directory:

```console
cd installer
./make-combine-installer.sh combine-release-number
```

where `combine-release-number` is the Combine release to be installed, e.g. `v1.2.0`.

To update the PDF copy of the installer README.md file, run the following from the `installer` directory:

```console
pandoc --pdf-engine=weasyprint README.md -o README.pdf
```

## Setup Local Kubernetes Cluster

This section describes how to create a local Kubernetes cluster using either _Rancher Desktop_ or _Docker Desktop_.
Expand Down
14 changes: 12 additions & 2 deletions deploy/ansible/group_vars/nuc/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ image_pull_secret: aws-login-credentials
app_namespace: thecombine

k8s_user: sillsdev
k8s_group: sillsdev

################################################
# Helm Installation
################################################
install_helm: no

################################################
# Support Tool Settings
################################################
install_ip_viewer: yes
install_combinectl: yes

#######################################
# Ingress configuration
Expand All @@ -30,7 +40,7 @@ ingress_namespace: ingress-nginx
# The server name will direct traffic to the production
# server since it is used to get the certificates for the
# NUC.
public_dns_name: "{{ ansible_hostname }}"
k8s_dns_name: "{{ ansible_hostname }}"

################################################
# Ethernet settings
Expand Down
11 changes: 11 additions & 0 deletions deploy/ansible/group_vars/server/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ create_namespaces: []
# k8s namespaces
app_namespace: thecombine

################################################
# Helm Installation
################################################
install_helm: no

################################################
# Support Tool Settings
################################################
install_ip_viewer: no
install_combinectl: no

#######################################
# Ingress configuration
ingress_namespace: ingress-nginx
Expand Down
62 changes: 62 additions & 0 deletions deploy/ansible/host_vars/localhost/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
#################################################
# Host specific configuration items for localhost
################################################

################################################
# Configure Kubernetes cluster
################################################

# Specify which Kubernetes engine to install -
# one of k3s or none.
k8s_engine: k3s

image_pull_secret: aws-login-credentials

# k8s namespaces
app_namespace: thecombine

k8s_user: "{{ ansible_user_id }}"

################################################
# Helm Installation
################################################
install_helm: yes

################################################
# Support Tool Settings
################################################
install_ip_viewer: no
install_combinectl: yes

#######################################
# Ingress configuration
ingress_namespace: ingress-nginx

# For the NUCs we want to use the ansible host name
# since that is how we can connect on the local network
# The server name will direct traffic to the production
# server since it is used to get the certificates for the
# NUC.
k8s_dns_name: "local"

################################################
# Ethernet settings
################################################
eth_optional: yes

################################################
# WiFi access point settings
################################################
has_wifi: yes
ap_domain: thecombine.app
ap_ssid: "thecombine_ap"
ap_passphrase: "Combine2020"
ap_gateway: "10.10.10.1"
ap_hostname: "local"
test_wifi: false
################################################
# hardware monitoring settings
################################################
include_hw_monitoring: no
history_days: 60
5 changes: 5 additions & 0 deletions deploy/ansible/hosts.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
all:
hosts:
localhost:
ansible_connection: local
kubecfgdir: local
combine_server_name: local.thecombine.app
link_kubeconfig: true
children:
nuc:
hosts:
Expand Down
54 changes: 54 additions & 0 deletions deploy/ansible/playbook_desktop_setup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
##############################################################
# Playbook: playbook_desktop_setup.yml
#
# playbook_desktop_setup.yml installs the packages and
# configuration files that are required to run TheCombine
# as containers managed by a Kubernetes cluster on localhost.
#
##############################################################

- name: Configure hardware for The Combine
hosts: localhost
gather_facts: yes
become: yes

vars_files:
- "vars/config_common.yml"

tasks:
- name: Update packages
apt:
update_cache: yes
upgrade: "yes"

- name: Setup WiFi Access Point
import_role:
name: wifi_ap
when: has_wifi

- name: Enable hardware monitoring
import_role:
name: monitor_hardware
when: include_hw_monitoring

- name: Configure Network Interfaces
import_role:
name: network_config

- name: Install Container Engine
import_role:
name: container_engine

- name: Install Kubernetes
import_role:
name: k8s_install

- name: Install Helm
import_role:
name: helm_install
when: install_helm

- name: Setup Support Tool
import_role:
name: support_tools
35 changes: 0 additions & 35 deletions deploy/ansible/playbook_dev_tools.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
##############################################################
# Playbook: playbook_kube_install.yml
# Playbook: playbook_nuc_setup.yml
#
# playbook_kube_install.yml installs the packages and
# playbook_nuc_setup.yml installs the packages and
# configuration files that are required to run TheCombine
# as Docker containers managed by a Kubernetes cluster.
# as Docker containers managed by a Kubernetes cluster on
# a target PC, such as an Intel NUC.
#
##############################################################

- name: Configure hardware for The Combine
hosts: all
hosts: nuc
gather_facts: yes
become: yes

vars_files:
- "vars/config_common.yml"
- "vars/packages.yml"

tasks:
- name: Update packages
Expand All @@ -37,16 +37,14 @@
import_role:
name: network_config

- name: Install Docker Subsystem
- name: Install Container Engine
import_role:
name: docker_install
name: container_engine

- name: Install Kubernetes Tools
import_role:
name: k8s_install

- name: Get Kubernetes Configuration
- name: Setup Support Tool
import_role:
name: k8s_config
tags:
- kubeconfig
name: support_tools
3 changes: 3 additions & 0 deletions deploy/ansible/roles/container_engine/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
container_packages:
- containerd.io
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
---
##############################################################
# Role: docker_install
# Role: container_engine
#
# Install the Docker Engine, Docker Compose and all their
# pre-requisite packages.
# Install the container engine and pre-requisite packages.
#
# The Docker Engine is installed by adding the repo from
# The container engine is installed by adding the repo from
# docker.com to our apt sources and installing the relevant
# package.
# packages.
#
# Docker Compose is installed by downloading the ZIP package
# from GitHub and extracting it to /usr/local/bin
##############################################################
- name: Update apt cache.
apt:
Expand All @@ -27,7 +24,6 @@
- gnupg
- lsb-release
state: present
notify: reboot target

- name: Create keyring directory
file:
Expand All @@ -50,6 +46,16 @@

- name: Install Docker Packages
apt:
name: "{{ docker_packages }}"
name: "{{ container_packages }}"
update_cache: yes
notify: reboot target

- name: Check if reboot is required
stat:
path: /var/run/reboot-required
register: reboot_required

- name: Reboot
reboot:
when:
- reboot_required.stat.exists
- ansible_connection != "local"
6 changes: 0 additions & 6 deletions deploy/ansible/roles/docker_install/defaults/main.yml

This file was deleted.

3 changes: 0 additions & 3 deletions deploy/ansible/roles/docker_install/handlers/main.yml

This file was deleted.

5 changes: 5 additions & 0 deletions deploy/ansible/roles/helm_install/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
helm_version: v3.13.2
helm_arch: linux-amd64

helm_download_dir: /opt/helm-{{ helm_version }}-{{ helm_arch }}
Loading

0 comments on commit 3312b57

Please sign in to comment.