Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ target
.vite
venv
.venv
.vagrant

temporary_files
testing/go_cli_api/ainarictl
testing/ansible_deploy/.vagrant/

Expand All @@ -24,6 +26,7 @@ src/sdk/python/ainari_sdk/ainari_messages
gitIdentityChange.sh
proto3_pb2.py
CMakeLists.txt.user*
ainari_docker_files.tar

*.proto3.pb.go
*.qmake2cmake
Expand All @@ -38,3 +41,4 @@ CMakeLists.txt.user*
*.whl
*.orig
*.egg-info

11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [Unreleased]

### Added

- Vagrantfile with ansible playbook to deploy multiple virtual machines with a kubernestes with fully deployed ainari-setup and sdk-api-test
- image pull-policy can now be changed by the helm-values

### Changed

- changed the image-build process for the new vagrant-test-setup

## v0.10.0

(Changes since v0.9.0)
Expand Down
63 changes: 63 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright 2022 Tobias Anker <tobias.anker@kitsunemimi.moe>
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Run host-side script first in "vagrant up"-command
if ARGV.any? { |arg| arg == "up" }
puts "Building Docker images before vagrant up..."
system("./scripts/build_docker_images.sh") or abort("build_docker_images.sh failed, stopping!")
end

Vagrant.configure("2") do |config|
# There is no official debian 13 image for vagrant, because of the license-change
# Used this alternative images instead: https://github.com/alchemy-solutions/vagrant-cloud-images
config.vm.box = "cloud-image/debian-13"

nodes = {
"server" => "192.168.56.10",
"agent1" => "192.168.56.11",
"agent2" => "192.168.56.12"
}

nodes.each do |name, ip|
config.vm.define name do |node|
# Add three extra disks of 5G each in addition to the root disk for the onsen
node.vm.provider :libvirt do |libvirt|
libvirt.storage :file, size: "5G", name: "ainari-#{name}-vdb.qcow2"
end

node.vm.hostname = name
node.vm.network "private_network", ip: ip
node.vm.provider "libvirt" do |vb|
vb.memory = 4096
vb.cpus = 4
vb.storage :file, size: 10
end
end
end

# Run provision.yml for the 'ainari-test' group
config.vm.provision "ansible" do |ansible|
ansible.playbook = "testing/vagrant/playbook.yaml"
ansible.become = true

ansible.extra_vars = {
ansible_python_interpreter: "/usr/bin/python3"
}
# ansible.verbose = "vvv"
ansible.groups = {
"k3s_server" => ["server"],
"k3s_agents" => ["agent1", "agent2"]
}
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
containers:
- name: dashboard
image: {{ .Values.docker.registry }}/ainari_dashboard:{{ .Values.docker.tag }}
imagePullPolicy: Always
imagePullPolicy: {{ .Values.docker.pull_policy }}
env:
- name: RUST_LOG
value: "debug"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
containers:
- name: hanami
image: {{ .Values.docker.registry }}/hanami:{{ .Values.docker.tag }}
imagePullPolicy: Always
imagePullPolicy: {{ .Values.docker.pull_policy }}
env:
- name: RUST_LOG
value: "debug"
Expand Down
8 changes: 4 additions & 4 deletions deploy/k8s/ainari/templates/miko/miko-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ data:
file_path = "/etc/ainari/miko/miko_db"

[endpoints.hanami]
public_address = "https://local-hanami:443"
public_address = "https://{{ .Values.api.domain_hanami }}:443"
internal_address = "https://hanami-tls-service.default.svc.cluster.local:8443"

[endpoints.ryokan]
public_address = "https://local-ryokan:443"
public_address = "https://{{ .Values.api.domain_ryokan }}:443"
internal_address = "https://ryokan-tls-service.default.svc.cluster.local:8443"

[endpoints.torii]
public_address = "https://local-torii:443"
public_address = "https://{{ .Values.api.domain_torii }}:443"
internal_address = "https://torii-tls-service.default.svc.cluster.local:8443"

[endpoints.omamori]
public_address = "https://local-omamori:443"
public_address = "https://{{ .Values.api.domain_omamori }}:443"
internal_address = "https://omamori-tls-service.default.svc.cluster.local:8443"

kind: ConfigMap
2 changes: 1 addition & 1 deletion deploy/k8s/ainari/templates/miko/miko-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
containers:
- name: miko
image: {{ .Values.docker.registry }}/miko:{{ .Values.docker.tag }}
imagePullPolicy: Always
imagePullPolicy: {{ .Values.docker.pull_policy }}
env:
- name: AINARI_ADMIN_ID
value: {{ required "user.id is required!" .Values.user.id }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
containers:
- name: omamori
image: {{ .Values.docker.registry }}/omamori:{{ .Values.docker.tag }}
imagePullPolicy: Always
imagePullPolicy: {{ .Values.docker.pull_policy }}
env:
- name: RUST_LOG
value: "debug"
Expand Down
2 changes: 1 addition & 1 deletion deploy/k8s/ainari/templates/onsen/onsen-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
containers:
- name: onsen
image: {{ .Values.docker.registry }}/onsen:{{ .Values.docker.tag }}
imagePullPolicy: Always
imagePullPolicy: {{ .Values.docker.pull_policy }}
env:
- name: RUST_LOG
value: "debug,h2=info"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
containers:
- name: ryokan
image: {{ .Values.docker.registry }}/ryokan:{{ .Values.docker.tag }}
imagePullPolicy: Always
imagePullPolicy: {{ .Values.docker.pull_policy }}
env:
- name: RUST_LOG
value: "debug,h2=info"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
containers:
- name: sakura
image: {{ .Values.docker.registry }}/sakura:{{ .Values.docker.tag }}
imagePullPolicy: Always
imagePullPolicy: {{ .Values.docker.pull_policy }}
env:
- name: RUST_LOG
value: "debug,h2=info"
Expand Down
2 changes: 1 addition & 1 deletion deploy/k8s/ainari/templates/torii/torii-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
containers:
- name: torii
image: {{ .Values.docker.registry }}/torii:{{ .Values.docker.tag }}
imagePullPolicy: Always
imagePullPolicy: {{ .Values.docker.pull_policy }}
env:
- name: RUST_LOG
value: "debug"
Expand Down
1 change: 1 addition & 0 deletions deploy/k8s/ainari/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ token:
docker:
tag: "develop"
registry: "kitsudaiki"
pull_policy: "Always"

api:
domain_sakura: local-sakura
Expand Down
29 changes: 29 additions & 0 deletions dockerfiles/Dockerfile_build_base
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2022 Tobias Anker <tobias.anker@kitsunemimi.moe>
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM debian:12.12-slim@sha256:78d2f66e0fec9e5a39fb2c72ea5e052b548df75602b5215ed01a17171529f706

ARG DEBIAN_FRONTEND=noninteractive

RUN set -e && \
apt-get update && \
apt-get install --no-install-recommends -y \
protobuf-compiler \
gcc \
curl \
pkg-config \
libssl-dev \
libsqlite3-dev \
ca-certificates
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
17 changes: 15 additions & 2 deletions dockerfiles/Dockerfile_dashboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Step 1: Build the app
FROM node:24-alpine AS build
# Copyright 2022 Tobias Anker <tobias.anker@kitsunemimi.moe>
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM node:24-alpine@sha256:c921b97d4b74f51744057454b306b418cf693865e73b8100559189605f6955b8 AS build

WORKDIR /app

Expand Down
39 changes: 25 additions & 14 deletions dockerfiles/Dockerfile_hanami
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
FROM debian:12.12-slim@sha256:78d2f66e0fec9e5a39fb2c72ea5e052b548df75602b5215ed01a17171529f706 AS builder

ARG DEBIAN_FRONTEND=noninteractive
# Copyright 2022 Tobias Anker <tobias.anker@kitsunemimi.moe>
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM kitsudaiki/ainari_build_base:0.1.0@sha256:24467cc617f19791b20719d1c826dd8f2db34aac55ed54dbb6263e6c64d29c74 AS builder

WORKDIR /app

RUN apt-get update && \
apt-get install -y protobuf-compiler \
gcc \
curl \
pkg-config \
libssl-dev \
libsqlite3-dev && \
curl https://sh.rustup.rs -sSf | sh -s -- -y

COPY . .
COPY src src
COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock

RUN ~/.cargo/bin/cargo build --release -p hanami
RUN ~/.cargo/bin/cargo build --release
RUN cp target/release/hanami /app/
RUN cp target/release/miko /app/
RUN cp target/release/omamori /app/
RUN cp target/release/onsen /app/
RUN cp target/release/ryokan /app/
RUN cp target/release/sakura /app/
RUN cp target/release/torii /app/

# ---------------------------------------------------

Expand Down
39 changes: 25 additions & 14 deletions dockerfiles/Dockerfile_miko
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
FROM debian:12.12-slim@sha256:78d2f66e0fec9e5a39fb2c72ea5e052b548df75602b5215ed01a17171529f706 AS builder

ARG DEBIAN_FRONTEND=noninteractive
# Copyright 2022 Tobias Anker <tobias.anker@kitsunemimi.moe>
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM kitsudaiki/ainari_build_base:0.1.0@sha256:24467cc617f19791b20719d1c826dd8f2db34aac55ed54dbb6263e6c64d29c74 AS builder

WORKDIR /app

RUN apt-get update && \
apt-get install -y protobuf-compiler \
gcc \
curl \
pkg-config \
libssl-dev \
libsqlite3-dev && \
curl https://sh.rustup.rs -sSf | sh -s -- -y

COPY . .
COPY src src
COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock

RUN ~/.cargo/bin/cargo build --release -p miko
RUN ~/.cargo/bin/cargo build --release
RUN cp target/release/hanami /app/
RUN cp target/release/miko /app/
RUN cp target/release/omamori /app/
RUN cp target/release/onsen /app/
RUN cp target/release/ryokan /app/
RUN cp target/release/sakura /app/
RUN cp target/release/torii /app/

# ---------------------------------------------------

Expand Down
Loading