Skip to content

Commit 9da001a

Browse files
committed
docs(#711): add basic documentation for vagrant-setup
For the new test-installation with vagrant some basic documentation was added. Signed-off-by: Tobias Anker <tobias.anker@kitsunemimi.moe>
1 parent 89d9c7c commit 9da001a

9 files changed

Lines changed: 195 additions & 36 deletions

File tree

docs/deployer/config/hanami_config.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313
### `api` Configuration
1414

15-
| Parameter | Type | Default | Description |
16-
| ------------------ | ------- | ----------- | ----------------------------------------- |
17-
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
18-
| `public_port` | integer | `11418` | Port for public API access. |
19-
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
20-
| `internal_port` | integer | `10418` | Port for internal API access. |
15+
| Parameter | Type | Default | Description |
16+
| --------------- | ------- | ----------- | ----------------------------------- |
17+
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
18+
| `public_port` | integer | `11418` | Port for public API access. |
19+
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
20+
| `internal_port` | integer | `10418` | Port for internal API access. |
2121

2222
### `database` Configuration
2323

docs/deployer/config/miko_config.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
### `api` Configuration
1313

14-
| Parameter | Type | Default | Description |
15-
| ------------------ | ------- | ----------- | ----------------------------------------- |
16-
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
17-
| `public_port` | integer | `11417` | Port for public API access. |
18-
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
19-
| `internal_port` | integer | `10417` | Port for internal API access. |
14+
| Parameter | Type | Default | Description |
15+
| --------------- | ------- | ----------- | ----------------------------------- |
16+
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
17+
| `public_port` | integer | `11417` | Port for public API access. |
18+
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
19+
| `internal_port` | integer | `10417` | Port for internal API access. |
2020

2121
### `database` Configuration
2222

docs/deployer/config/omamori_config.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313
### `api` Configuration
1414

15-
| Parameter | Type | Default | Description |
16-
| ------------------ | ------- | ----------- | ----------------------------------------- |
17-
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
18-
| `public_port` | integer | `11421` | Port for public API access. |
19-
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
20-
| `internal_port` | integer | `10421` | Port for internal API access. |
15+
| Parameter | Type | Default | Description |
16+
| --------------- | ------- | ----------- | ----------------------------------- |
17+
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
18+
| `public_port` | integer | `11421` | Port for public API access. |
19+
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
20+
| `internal_port` | integer | `10421` | Port for internal API access. |
2121

2222
### `miko` Configuration
2323

docs/deployer/config/ryokan_config.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313
### `api` Configuration
1414

15-
| Parameter | Type | Default | Description |
16-
| ------------------ | ------- | ----------- | ----------------------------------------- |
17-
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
18-
| `public_port` | integer | `11416` | Port for public API access. |
19-
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
20-
| `internal_port` | integer | `10416` | Port for internal API access. |
15+
| Parameter | Type | Default | Description |
16+
| --------------- | ------- | ----------- | ----------------------------------- |
17+
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
18+
| `public_port` | integer | `11416` | Port for public API access. |
19+
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
20+
| `internal_port` | integer | `10416` | Port for internal API access. |
2121

2222
### `database` Configuration
2323

docs/deployer/config/sakura_config.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313

1414
### `api` Configuration
1515

16-
| Parameter | Type | Default | Description |
17-
| ------------------ | ------- | ----------- | ----------------------------------------- |
18-
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
19-
| `public_port` | integer | `11420` | Port for public API access. |
20-
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
21-
| `internal_port` | integer | `10420` | Port for internal API access. |
16+
| Parameter | Type | Default | Description |
17+
| --------------- | ------- | ----------- | ----------------------------------- |
18+
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
19+
| `public_port` | integer | `11420` | Port for public API access. |
20+
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
21+
| `internal_port` | integer | `10420` | Port for internal API access. |
2222

2323
### `database` Configuration
2424

docs/deployer/config/torii_config.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313
### `api` Configuration
1414

15-
| Parameter | Type | Default | Description |
16-
| ------------------ | ------- | ----------- | ----------------------------------------- |
17-
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
18-
| `public_port` | integer | `11419` | Port for public API access. |
19-
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
20-
| `internal_port` | integer | `10419` | Port for internal API access. |
15+
| Parameter | Type | Default | Description |
16+
| --------------- | ------- | ----------- | ----------------------------------- |
17+
| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. |
18+
| `public_port` | integer | `11419` | Port for public API access. |
19+
| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. |
20+
| `internal_port` | integer | `10419` | Port for internal API access. |
2121

2222
### `database` Configuration
2323

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Build base-image
2+
3+
- Enable QEMU (for cross-architecture builds)
4+
5+
```bash
6+
docker run --privileged --rm tonistiigi/binfmt --install all
7+
```
8+
9+
This lets your x64 machine build ARM images locally
10+
11+
- Verify
12+
13+
```bash
14+
docker buildx ls
15+
```
16+
17+
( You should see linux/amd64 and linux/arm64. )
18+
19+
- Create and use a Buildx builder
20+
21+
```bash
22+
docker buildx create --name multi-builder --use
23+
docker buildx inspect --bootstrap
24+
```
25+
26+
- Login to Docker Hub
27+
28+
```bash
29+
docker login
30+
```
31+
32+
- Build new base-image
33+
34+
```bash
35+
docker buildx build \
36+
--platform linux/amd64,linux/arm64 \
37+
-f dockerfiles/Dockerfile_build_base \
38+
-t kitsudaiki/ainari_build_base:0.1.0 \
39+
--push .
40+
```
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Local testing
2+
3+
## Testing in multi-node kubernetes
4+
5+
In the repository there is a Vagrantfile with connected minimalistic playbook, which creates 3
6+
locally hosted libvirt virtual machines, installes a k3s-kubernetes within these instances,
7+
configures and installes ainari in there and runs the sdk-api-test against the setup. This
8+
test-setup doesn't require docker-hub. At the beginning of the setup it build docker-images from the
9+
local source code and pushes these local images direcly into the k3s-kubernetes without any
10+
additional registry and also uses the local helm chart for the deployment within the kubernetes.
11+
That way the code, dockerfiles, helm-charts and sdk-lib are tested in single automated workflow in a
12+
virtual multi-node environment.
13+
14+
### Minimal Requirements
15+
16+
- **CPU**: 8 threads (better 16 threads to avoid cpu-overcommit)
17+
- **Memory**: 14 GiB
18+
19+
### Installation
20+
21+
This installation uses Vagrant with libvirt as provider to deploy the virtual machines.
22+
23+
- Install apt-packages necessary for libvirt and the libvirt-provider
24+
25+
```bash
26+
sudo apt update
27+
sudo apt install -y \
28+
qemu-kvm \
29+
libvirt-daemon-system \
30+
libvirt-clients \
31+
virtinst \
32+
bridge-utils \
33+
cpu-checker
34+
build-essential \
35+
ruby-dev \
36+
pkg-config \
37+
libvirt-dev \
38+
libxml2-dev \
39+
libxslt-dev \
40+
zlib1g-dev \
41+
rsync
42+
```
43+
44+
- Enable and start libvirt:
45+
46+
```bash
47+
sudo systemctl enable --now libvirtd
48+
```
49+
50+
- So you don’t need sudo every time
51+
52+
```bash
53+
sudo usermod -aG libvirt,kvm $USER
54+
```
55+
56+
( after this you have to logout and login again )
57+
58+
- Install the libvirt provider plugin
59+
60+
```bash
61+
vagrant plugin install vagrant-libvirt
62+
```
63+
64+
- Update `/etc/hosts` by adding the content
65+
66+
```plain
67+
192.168.56.10 local-vagrant-hanami
68+
192.168.56.10 local-vagrant-miko
69+
192.168.56.10 local-vagrant-ryokan
70+
192.168.56.10 local-vagrant-sakura
71+
192.168.56.10 local-vagrant-torii
72+
192.168.56.10 local-vagrant-omamori
73+
192.168.56.10 local-vagrant-onsen
74+
192.168.56.10 local-vagrant-ainari
75+
```
76+
77+
- Install local ansible required to execute the playbook
78+
79+
```bash
80+
python3 -m venv venv
81+
source venv/bin/activate
82+
pip3 install ansible
83+
```
84+
85+
### Usage
86+
87+
#### Vagrant-actions:
88+
89+
- create a complete new test-installation
90+
91+
`vagrant up`
92+
93+
- in case a run failed and you want to run it again or with updated playbooks against the same
94+
already existing vagrant environment
95+
96+
`vagrant provision`
97+
98+
- ssh into server of the virtual machines
99+
100+
`vagrant ssh server`
101+
102+
with this you will enter the machine with the kubernetes api. It is only a minimalistic shell, so
103+
run `/bin/bash` at first in there to get a real bash shell. There you can also run `kubectl` and
104+
`helm` commands.
105+
106+
- delete previous vagrant environment
107+
108+
`vagrant destroy -f`
109+
110+
#### access the dashboard
111+
112+
After a finished `vagrant up`, enter the address `https://local-vagrant-ainari` into your browser
113+
and you should see the dashboard
114+
115+
Login:
116+
117+
- **user**: `asdf`
118+
- **password**: `asdfasdf`

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ nav:
6969
- Repo:
7070
- developer/repo/repo_structure.md
7171
- developer/repo/build_guide.md
72+
- developer/repo/local_testing.md
7273
- developer/repo/development.md
7374
- developer/repo/dependencies.md
7475
- developer/repo/git_workflow.md

0 commit comments

Comments
 (0)