Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelS committed Jun 4, 2024
1 parent e9110f9 commit cd9a97f
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 2 deletions.
10 changes: 10 additions & 0 deletions ansible/provider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ Adjust role-specific variables in `group_vars/all.yml` and `host_vars/*.yml` to
## Deployment
The deployment process involves setting directly configuring Docker networks, generating necessary configuration claims, and managing Docker containers through Docker Compose.

### Prepare VM on clean system

If you plan to deploy on a clean Debian or Ubuntu system without an installed Docker engine, use the `prepare` tag to install additional software:
```bash
ansible-playbook main.yml --tags prepare
```
![lava_prepare_gifsicle.gif](https://github.com/svetek/lava-ansible-deployment/blob/main/guides/lava_prepare_gifsicle.gif)

### Deploy the Service
To deploy the RPC Provider Service:

Expand All @@ -75,6 +83,8 @@ ansible-playbook main.yml --tags deploy

> Note that by default ```anisble-playbook main.yml``` command deploys and runs the service.

![lava_cache_provider_gifsicle.gif](https://github.com/svetek/lava-ansible-deployment/blob/main/guides/lava_cache_provider_gifsicle.gif)

## Managing

Start the Service: Ensure the service is up and running:
Expand Down
2 changes: 1 addition & 1 deletion ansible/provider/inventory/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ansible_user: root
ansible_port: 22
project_name: lava
project_type: provider
project_unique_name: "{{ project_name }}-{{ provider_name }}-{{ project_type }}"
project_unique_name: "{{ project_name }}-{{ project_type }}"
service_path: /opt/services # The docker-compose.yml and a variables file are located at this path.
project_path: "{{ service_path }}/{{ project_unique_name }}" # Configuration files and a wallet are located at this path.
volume_path: "{{ container.volume_path }}"
6 changes: 5 additions & 1 deletion ansible/provider/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
- name: Deploying and managing the RPC Provider Service
hosts: all
become: true
gather_facts: false
gather_facts: true
roles:
- role: prepare
tags:
- never
- prepare
- role: deploy
tags:
- deploy
Expand Down
Empty file.
21 changes: 21 additions & 0 deletions ansible/provider/roles/prepare/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# roles/prepare/meta/main.yml
---
dependencies: []
galaxy_info:
author: Michael
description: The role for deploying the lava cache service
company: Impulse Expert | https://impulse.expert
license: GPL
min_ansible_version: "2.9"
platforms:
- name: Ubuntu
versions:
- xenial
- bionic
- focal
- name: Debian
versions:
- buster
- bullseye
- bookworm

64 changes: 64 additions & 0 deletions ansible/provider/roles/prepare/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# roles/prepare/tasks/main.yml
---
- name: Update the apt cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600

# Turn off: need other role process for update runtime systems
#- name: Upgrade all apt packages
# ansible.builtin.apt:
# upgrade: dist

- name: Install necessary packages
ansible.builtin.apt:
name:
- software-properties-common
- apt-transport-https
- ca-certificates
- sudo
- aria2
- curl
- htop
- wget
- jq
- lz4
- rsync
state: present

- name: Add Docker Repository for Debian
when: ansible_facts['distribution'] == "Debian"
ansible.builtin.shell: |
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- name: Add Docker Repository for Ubuntu
when: ansible_facts['distribution'] == "Ubuntu"
ansible.builtin.shell: |
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- name: Update apt and install docker-ce
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
update_cache: true
7 changes: 7 additions & 0 deletions ansible/provider/roles/prepare/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# roles/prepare/vars/main.yml

# In Ansible, the priority of variable values is determined by
# the order in which they are defined, known as variable precedence.
# Variables defined in roles/deploy/vars/main.yml can override the values set in the inventory
# if they are specified later in the precedence order.

0 comments on commit cd9a97f

Please sign in to comment.