Skip to content

Commit

Permalink
Fixes for 20.04 and new docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-v committed Nov 24, 2022
1 parent aabda0f commit 876915c
Show file tree
Hide file tree
Showing 11 changed files with 178 additions and 99 deletions.
104 changes: 65 additions & 39 deletions installer/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,71 @@
# Introduction
This is a standalone/non-containerized installer for SODA Infrastructure Manager (delfin) project.
It contains a script and options to check the environment feasible for installing delfin. Installs required dependent software/binaries.
# Delfin Installation Guide

The SODA Delfin supports two types of installation
* Installation using Ansible for user experiance with Dashboard
* Installation using scripts

# Supported OS
Ubuntu 16.04, Ubuntu 18.04
## Ansible installer

# Prerequisite
* Supported OS: **Ubuntu 20.04, Ubuntu 18.04**
* Prerequisite: **Python 3.6 or above** should be installed

- #### Ensure the logged-in user has root privileges.
### Install steps

```bash
sudo apt-get update && sudo apt-get install -y git make curl wget libltdl7 libseccomp2 libffi-dev gawk
git clone https://github.com/sodafoundation/delfin.git
# git checkout <delfin-release-version>
cd delfin/installer
chmod +x install_dependencies.sh && ./install_dependencies.sh
cd ansible
export PATH=$PATH:/home/$USER/.local/bin
sudo -E env "PATH=$PATH" ansible-playbook site.yml -i local.hosts -v
```
### Uninstall
```bash
sudo -E env "PATH=$PATH" ansible-playbook clean.yml -i local.hosts -v
```

- #### Setup Python3
Python3 and Pip3 should be installed on the system.

Note: If you don't have python3 in your system, you may follow below steps to setup python3 environment.
### Logs
Delfin processes execution logs can be found in /tmp/ folder
* /tmp/api.log
* /tmp/alert.log
* /tmp/task.log
* /tmp/exporter.log
* /tmp/create_db.log

```sh
apt-get install python3
apt-get install python3-pip
```
### How to use Delfin
Delfin can be used either through dashboard or REST APIs.

Please refer [user guides](https://docs.sodafoundation.io/guides/user-guides/delfin/dashboard/)



## Bash installer
This is a standalone/non-containerized installer for SODA Infrastructure Manager (delfin) project.
It contains a script and options to check the environment feasible for installing delfin. Installs required dependent software/binaries.

- #### Set PYTHONPATH to working directory
* Supported OS: **Ubuntu 20.04, Ubuntu 18.04**
* Prerequisite:
* **Python 3.6 or above** should be installed
* Ensure the logged-in user has **root privileges**.

#### Installation steps
```bash
sudo -i
apt-get install python3 python3-pip
git clone https://github.com/sodafoundation/delfin.git && git checkout <delfin-release-version>
cd delfin
export PYTHONPATH=$(pwd)
./installer/install
```
Refer below for installer options

```sh
export PYTHONPATH=$(pwd)
```
#### Uninstall
```bash
./installer/uninstall
```

- #### [Optional] Setup Prometheus (for monitor performance metric through prometheus)

Expand Down Expand Up @@ -55,13 +97,13 @@ Ubuntu 16.04, Ubuntu 18.04
```sh
root@root:/prometheus/prometheus-2.20.0.linux-amd64$ ./prometheus
```
# Structure of the installer
### Structure of the installer
This installer comes with options of pre-check, install and uninstall
pre-check: This script checks for the components required by delfin to function. If they are not present, precheck will install them.
Install: Installs and starts the delfin process
Uninstall: Uninstalls the delfin. Doesn't uninstall the required components. You may need to uninstall it explicitly using the native approach.
# How to install
### How to install
To get help, execute 'install -h'. It will show help information
Install script can be executed with three different switches to:
Expand Down Expand Up @@ -131,28 +173,12 @@ $ installer/install
Note: Multiple instances of exporter and api is not allowed currently.
#### Post install verification
After delfin installation use the following command to verify all process
of delfin are running.
```sh
ps -aux | grep delfin
```
# Uninstall
Running the uninstall script will stop all delfin processes and do cleanup
```sh
installer/uninstall
# Example
root@root1:~/delfin-demo/delfin$ installer/uninstall
```
# Logs
### Logs
All the installer logs are stored in the /var/log/sodafoundation directory.
The logs can be uniquely identified based upon the timestamp.
# Test the running delfin setup/process
## Test the running delfin setup/process
1. Make sure all delfin process are up and running
```
ps -ef|grep delfin
Expand Down Expand Up @@ -197,5 +223,5 @@ The logs can be uniquely identified based upon the timestamp.
http://localhost:9090/graph
# Limitation
## Limitation
Local installation, unlike Ansible installer, does not support SODA Dashboard integration.
2 changes: 1 addition & 1 deletion installer/ansible/roles/cleaner/scenarios/delfin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- name: Stop delfin containers, if started
shell: "{{ item }}"
with_items:
- docker-compose down
- docker compose down
become: yes
ignore_errors: yes
args:
Expand Down
4 changes: 2 additions & 2 deletions installer/ansible/roles/cleaner/scenarios/srm-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
register: srmtoolchainexisted

- name: Stop and remove Prometheus, Alertmanager, Grafana containers but don't delete the images
shell: docker-compose rm -fs
shell: docker compose rm -fs
args:
chdir: "{{ srm_toolchain_work_dir }}/"
when:
- source_purge == false
- srmtoolchainexisted.stat.isdir is defined and srmtoolchainexisted.stat.isdir

- name: Stop and remove Prometheus, Alertmanager, Grafana containers & delete the images
shell: docker-compose down --rmi all
shell: docker compose down --rmi all
args:
chdir: "{{ srm_toolchain_work_dir }}/"
when:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
shell: "{{ item }}"
with_items:
- docker build -t sodafoundation/delfin .
- DELFIN_METRICS_DIR={{ delfin_exporter_prometheus_metrics_dir }} DELFIN_HOST_IP={{ host_ip }} DELFIN_RABBITMQ_USER={{ delfin_rabbitmq_user }} DELFIN_RABBITMQ_PASS={{ delfin_rabbitmq_pass }} docker-compose up -d
- DELFIN_METRICS_DIR={{ delfin_exporter_prometheus_metrics_dir }} DELFIN_HOST_IP={{ host_ip }} DELFIN_RABBITMQ_USER={{ delfin_rabbitmq_user }} DELFIN_RABBITMQ_PASS={{ delfin_rabbitmq_pass }} docker compose up -d
become: yes
args:
chdir: "{{ delfin_work_dir }}"
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,11 @@

- name: Install RabbitMQ package
apt:
name: "{{ item }}"
name: rabbitmq-server
update_cache: yes
install_recommends: yes
allow_unauthenticated: yes
state: present
with_items:
- apt-transport-https
- rabbitmq-server
become: yes
when:
- rabbitmqservice.stat.exists is undefined or rabbitmqservice.stat.exists == false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
# Start delfin
- name: Install sqlite3 package
apt:
name: "{{ item }}"
name: sqlite3
state: present
with_items:
- sqlite3
- python3-pip
become: yes

- name: Install python virtual environment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@
shell: export PROMETHEUS=True

- name: Stop and remove Prometheus, Alertmanager, Grafana containers, keeping images
shell: docker-compose rm -fs
shell: docker compose rm -fs
args:
chdir: "{{ srm_toolchain_work_dir }}/"

- name: start service
shell: docker-compose up -d
shell: docker compose up -d
args:
chdir: "{{ srm_toolchain_work_dir }}/"

7 changes: 6 additions & 1 deletion installer/ansible/script/create_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@
CONF = cfg.CONF
db_options.set_defaults(cfg.CONF,
connection='sqlite:////var/lib/delfin/delfin.sqlite')


def remove_prefix(text, prefix):
if text.startswith(prefix):
return text[len(prefix):]
return text


def main():
CONF(sys.argv[1:], project='delfin',
version=version.version_string())
Expand All @@ -41,6 +45,7 @@ def main():
if not os.path.exists(path):
os.makedirs(path)
db.register_db()


if __name__ == '__main__':
main()

Loading

0 comments on commit 876915c

Please sign in to comment.