Skip to content
Snippets Groups Projects
Commit d718bd8b authored by Baptiste DE RENZO's avatar Baptiste DE RENZO
Browse files

Replace quick assisted installation, refs #34214

parent 910c58ff
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env -S bash -euo pipefail
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1; then
against=HEAD
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
changed_files=$(git diff-index --name-only $against)
# Redirect output to stderr.
exec 1>&2
for file in $changed_files; do
if [[ $file =~ \.yml$ ]] && grep -q -E 'skyreach_(system|activation)_key' $file; then
key=$(grep -E 'skyreach_(system|activation)_key' $file | awk '{print $2}')
if [ $key != "changeme" ]; then
echo "error: you are about to commit a secret key in file $file"
grep -E 'skyreach_(system|activation)_key' $file
exit 1
# Get changed files
changed_files=$(git diff-index --name-only ${against})
# Verify files content
for file in ${changed_files}; do
if grep -qiE 'skyreach_(system|activation|api)_key' "${file}"; then
# verify key
key=$(grep -iE 'skyreach_(system|activation|api)_key' "${file}" | grep -woiE '[a-z0-9]{32}')
if [ -n "${key}" ]; then
echo "Error: you are about to commit a secret key in file: ${file}"
echo "Please remove it before committing."
echo -
grep -iE 'skyreach_(system|activation|api)_key' "${file}" | grep -iE '[a-z0-9]{32}'
echo -
exit 1
fi
fi
fi
done
exit 0
done
# vim:ft=sh
......@@ -36,7 +36,7 @@ all: help
## venv: Install python3-venv and create a temporary virtualenv
venv:
-@command -v apt-get >/dev/null && apt-get update && apt-get install -y python3-venv
@command -v $(PIP_BIN) > /dev/null || python3 -m venv $(VENV)
python3 -m venv $(VENV)
## ansible/requirements.txt: Update requirements and their depende.dockeres
## ansible/requirements.dev.txt: Update development requirements and their depende.dockeres
......@@ -49,6 +49,9 @@ venv:
install: venv
$(PIP_BIN) install -U pip wheel
$(PIP_BIN) install -r ansible/requirements.txt
.PHONY: install-galaxy
install-galaxy:
ANSIBLE_CONFIG=$(ANSIBLE_CONFIG) $(ANSIBLE_GALAXY_BIN) install -r ansible/requirements.yml
.PHONY: install-dev
......
......@@ -20,6 +20,12 @@ You can also add the content of `~/.ssh/id_ed25519.pub` to `~/.ssh/authorized_ke
## Inventory
Move to ansible directory
```
cd ./ansible
```
Make a copy of the `example` inventory and eventually customize it with the customer informations.
```sh
......@@ -30,12 +36,21 @@ cp -r inventories/example inventories/customer
cp -r inventories/example-ha inventories/customer
```
There are also inventories for local deployment, you can use one of these lines:
```sh
cp -r inventories/local-full inventories/customer
cp -r inventories/local-mediaserver inventories/customer
cp -r inventories/local-mediaworker inventories/customer
```
### Hosts and Groups
Edit `inventories/customer/hosts` to match your inrastructure.
### Variables
If you use a local-\* inventory, copy `inventories/customer/host_vars/localhost.dist.yml` to `inventories/customer/host_vars/localhost.yml`.
You **must at least** configure:
- `skyreach_system_key` values in `inventories/customer/host_vars/<host>.yml`
......
# Deployment
Move to ansible directory
Move to envsetup root directory
```sh
cd ./ansible
cd /root/envsetup
```
To deploy all components, execute:
```sh
make deploy i=inventories/customer
make deploy i=ansible/inventories/customer
```
If you want to limit and deploy specific part, you can add a `tag`:
```sh
make deploy i=inventories/customer l=<tag>
make deploy i=ansible/inventories/customer l=<tag>
```
The avalaible tags are:
......
# Install required environment
# Prepare deployment environment
This installation has only been tested on Linux. But it should work (with small ajustements) for MacOS or Windows WSL.
This installation has only been tested on Linux. But it should (with some adjustements) work for MacOS or Windows WSL.
There are 2 installations possibilities :
- setup tools
- docker image
## Setup tools
This installation is detailled for a Debian server. All the commands below are executed with root rights.
This installation is detailled for a Debian server. All the commands below are executed with **root rights**.
### Install tools
```
apt update
apt upgrade -y
apt install -y vim git make gcc python3-dev python3-pip
apt install -y vim git make gcc python3-dev
```
### Repository
......@@ -33,20 +33,27 @@ cd envsetup/
To automatically create a temporary virtualenv:
```
make venv
make install
make install-galaxy
```
If you want a permanent venv, create manually a virtual environment with [Python's venv](https://docs.python.org/3/library/venv.html) or with the package [virtualenv](https://virtualenv.pypa.io/en/stable/).
```sh
# create the venv
apt-get install -y python3-venv
python3 -m venv .venv
# activate the venv
source .venv/bin/activate
# install requirements
# install ansible requirements
python3 -m pip install -U pip wheel
python3 -m pip install -r requirements.txt
python3 -m pip install -r ansible/requirements.txt
# install galaxy requirements
ansible-galaxy install -r ansible/requirements.yml
```
## Docker
......
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