-
Notifications
You must be signed in to change notification settings - Fork 0
Support infrastructure
This page is not up-to-date
This page explains how to setup the deployment infrastructure.
Different topologies can be implemented depending on whether you rely on Internet or not for Alpine mirrors.
If you will be using Internet to provide Alpine and Safecor mirrors you will only need to host you own products packages on standard HTTP server.
If your systems are offline with no access to Internet, or if you want to implement local mirrors for better performance, you will have to provide a standard HTTP server for Alpine and Safecor packages, and for your own packages.
Two profiles are available:
-
local mirroris used to synchronize the dependencies automatically with the Internet repositories. That includesAlpine LinuxandSafecor. -
offlineis used to provide the dependencies to a local network and is synchronized manually by an administrator.
If your system will boot on the network you will have to deploy DHCP, TFTP and NFS servers.
This section summarizes the cases and the services to provide locally.
| Use case | DHCP | TFTP | NFS | HTTP | ADMIN |
|---|---|---|---|---|---|
| Network boot | Yes | Yes | Yes (1) | No (2) | Yes |
| USB / embedded boot | No | No | No (2) | No | Yes |
| Local mirror | No | No | No | Yes | Yes |
| Offline (no Internet) | No | No | No | Yes | Yes |
- (1) If you want to manage user or specific hardware configurations.
- (2) Only for your own products' packets.
In all the cases you will have to implement the following services on your local area network (LAN):
| Name | IPv4 Address | Description |
|---|---|---|
| DHCP | 192.168.10.1 |
DHCP server for PXE boot |
| TFTP | 192.168.10.1 |
TFTP server for PXE boot |
| HTTP | 192.168.10.2 |
HTTP server serving the configurations of the system (apkovl) |
| NFS | 192.168.10.2 |
NFS server allowing the integrator to store or modify white stations configurations |
| REPOSITORIES | 192.168.10.3 |
HTTP server serving Alpine packages (APK) |
| ADMIN | 192.168.10.250 |
Machine enabling the administrator to install and configure the deployment infrastructure |
The infrastructure can be created with docker-compose for development and testing.
The folder setup/infrastructure/Docker/Safecor contains all the files needed to create an ad-hoc infrastructure.
| File | Description |
|---|---|
| docker-compose.yml | The infrastructure descriptor file |
| safecor.env | This file contains the variables used to configure the deployment |
| conf/ | This directory contains configuration files for the services. |
The configuration of the deployment and the services is made with the file safecor.env. The configuration files of the conf/ folder use the variables of safecor.env so the only file to mofify is safecor.env
The type of deployement (see Summay) is chosen using a profile, for example $ docker compose --profile offline --env-file safecor.env up.
The profiles are:
| Profile | Description |
|---|---|
| network_boot | All the services needed to boot a system from the network |
| local_mirror | All the services needed to make an Alpine local cache |
| offline | All the services needed to boot totally offline |
The assisted deployment offers a simple way to create the support infrastructure using the deployment system Ansible.
The operations consist in describing the configuration (services and machines) in an Ansible file in a format derived from JSON, and execute the deployment which runs automatically. This process can also be used to update the support infrastructure.
The Ansible scripts are available in the directory setup/infractructure/ansible.
The first step is to decide which topology you want to implement (see Topologies) and continue with the next chapter.
The repository must deployed firt.
In this use case you must create the virtual machines by yourself or have physical machines available. The repository can be server that has HTTP server capability (web server, NAS, etc).
If you need to setup a new server or virtual machine you can use any Linux distribution you like, we suggest Debian Linux or Alpine Linux with apache or nginx configured to server files (see index option in their respective documentation). At the end you should be able to navigate thru the repository files in you web browser.
Look at the chapters Alpine mirror and Safecor mirror in order to feed the repository.
The other virtual machines (DHCP, TFTP, etc) need to be setup with Alpine Linux.
Create a specific user for the deployment, for example ansible. This user must be able to install packages and modify configuration files (use sudo or change the permissions on the files).
This user must be disabled at the end of the deployment.
On each server do the following:
- Log in the server
- Setup the repository URL in the file
/etc/apk/repositories:http://<your repository name/ip>/<alpine repository path>/v3.21/mainhttp://<your repository name/ip>/<alpine repository path>/v3.21/community
- Install python3 :
$ sudo apk add python3
The configuration of Ansible consists in defining the topology of your infrastructure in the Ansible inventory.
The first step is to copy inventory.yml.dist to inventory.yml. Then you can personalize the infrastrcture by changing the values in the files.
The following table explains the fields of the inventory:
| Field | Description | Default |
|---|---|---|
install_dhcp |
Defines whether the DHCP server must be installed | Yes |
install_tftp |
Defines whether the TFTP server must be installed | Yes |
install_http |
Defines whether the HTTP server must be installed | Yes |
install_nfs |
Defines whether the NFS server must be installed | Yes |
alpine_repository |
Defines the Alpine's local mirror repository URL (probably on the HTTP server) | Yes |
alpine_kernels |
Defines the Kernel's local mirror repository URL (probably on the HTTP server) | Yes |
alpine_version |
Defines the Alpine version to be used | Yes |
dhcp_domain |
Defines the network domain that will be used on the LAN and broadcasted by the DHCP | safecor.lan |
lan_subnet |
Defines the LAN IPv4 subnet | 192.168.10.0 |
lan_netmask |
Defines the LAN IPv4 netmask | 255.255.255.0 |
lan_ip_start |
Defines the first IP address attributed by the DHCP server | 192.168.10.10 |
lan_ip_end |
Defines the last IP address attributed by the DHCP server | 192.168.10.253 |
lan_ip_broadcast |
Defines the IPv4 broadcast address | 192.168.10.255 |
http_server |
Defines the parameters of the HTTP server | 192.168.10.2 |
nfs_server |
Defines the parameters of the NFS server | 192.168.10.2 |
tftp_server |
Defines the parameters of the HTTP server | 192.168.10.2 |
dhcp_server |
Defines the parameters of the HTTP server | 192.168.10.1 |
The sections dhcp_host, http_host, nfs_host and tftp_host are used to defined specific configuration for these hosts. The user and password used by Ansible during the deployment must by defined in the fields ansible_user and ansible_password.
Please notice that the HTTP Server mentioned in the infrastructure differs from the repository web server, they don't host the same files.
Before starting the deployment, please verify the following points:
- The servers are ready and have an IP address and a user for the deployment (
ansiblefor example). - The servers are running.
- The deployment user has sudo permissions.
- The IP addresses are correctly defined in the file
inventory.yml. - The user and passwords are correctly defined in the file
inventory.yml. - The URL of the Ansible and Safecor repositories are correctly defined in the file
inventory.yml.
The deployment can be executed with the following command:
$ ansible-playbook deploy-infra-pxe.yml -i inventory.yml
The mirrors should be kept up-to-date as frequently as possible (daily to weekly) in order to benefit from the bug and security fixes. Scripts are available to ease the local mirror updates.
The script setup/infrastructure/scripts/sync_alpine_repository.sh is dedicated to updating a local Alpine mirror. It should be placed in the path of the mirror on the HTTP server.
Run the script: ./sync_alpine_repository.sh [arch] [version] where arch is x86_64, armv7 or aarch64 and version is the version of Alpine to update, for example 3.22.
The following command will update the local mirror:
$ ./sync_alpine_repository.sh x86_64 3.22
It will update all files in the folder ./alpine/v3.22/main/x86_64 and ./alpine/v3.22/community/x86_64. The local mirror will be an exact copy of the remote, meaning that all files removed from the official repository will be removed from the local mirror and all files added on the official repository will be added in the local mirror.
The script setup/infrastructure/scripts/sync_safecor_repository.sh will update the local Safecor repository while the script setup/infrastructure/scripts/sync_safecor_iso.sh will update the local Safecor ISO images.