Skip to content

Commit

Permalink
CI Localenv -> Initial automation of backend rollout.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbfm committed Jan 22, 2025
1 parent 250fe4f commit e2c9264
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .ci/deploy/localenv/ansible/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## How to use

1. Install Ansible on your machine, e.g on Debian-based systems:
```sh
sudo apt install ansible
```

2. Define an inventory.ini with parameters for your hosts.

3. Make sure you have entries in your SSH config for all the hosts declared in the inventory.ini.

4. Run the script like so:
```sh
./playbook.yaml -i inventory.ini
```
2 changes: 2 additions & 0 deletions .ci/deploy/localenv/ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[defaults]
stdout_callback=debug
23 changes: 23 additions & 0 deletions .ci/deploy/localenv/ansible/playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env ansible-playbook
---
- name: Roll out openDuT Backend
# Setup steps as documented here: https://opendut.eclipse.dev/book/user-manual/carl/setup.html
hosts: backend
tasks:
- name: Checkout openDuT repo
ansible.builtin.git:
repo: "https://github.com/eclipse-opendut/opendut/"
dest: "{{ repo_dir }}"
version: "development"
force: true # Avoid "would clobber existing tag" error for canary-tag

- name: Provision secrets
ansible.builtin.shell:
cmd: "docker compose --file .ci/deploy/localenv/docker-compose.yml up --build provision-secrets"
chdir: "{{ repo_dir }}"
creates: "{{ repo_dir }}/.ci/deploy/localenv/data/secrets/.env"

- name: Start containers
ansible.builtin.shell:
cmd: "docker compose --file .ci/deploy/localenv/docker-compose.yml --env-file .ci/deploy/localenv/data/secrets/.env up --detach --build"
chdir: "{{ repo_dir }}"

0 comments on commit e2c9264

Please sign in to comment.