2024-09-12 04:43:53 +00:00
|
|
|
# stack-orchestrator-setup
|
|
|
|
|
2024-10-23 06:53:07 +00:00
|
|
|
## Prerequisites
|
2024-09-12 04:43:53 +00:00
|
|
|
|
2024-10-23 06:53:07 +00:00
|
|
|
- Setup Ansible: To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine.
|
|
|
|
|
|
|
|
- Setup user with passwordless sudo: Follow steps from [Setup a user](../user-setup/README.md#setup-a-user) to setup a new user with passwordless sudo
|
2024-09-12 04:43:53 +00:00
|
|
|
|
|
|
|
## Setup Stack Orchestrator
|
|
|
|
|
|
|
|
This playbook will install Docker and Stack Orchestrator (laconic-so) on the machine if they aren't already present.
|
|
|
|
|
|
|
|
Run the following commands in the [`stack-orchestrator-setup`](./) directory.
|
|
|
|
|
|
|
|
- Create a new `hosts.ini` file:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cp ../hosts.example.ini hosts.ini
|
|
|
|
```
|
|
|
|
|
|
|
|
- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine:
|
|
|
|
|
|
|
|
```ini
|
|
|
|
[deployment_host]
|
|
|
|
<host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'
|
|
|
|
```
|
|
|
|
|
|
|
|
- Replace `<host_name>` with the alias of your choice
|
|
|
|
- Replace `<target_ip>` with the IP address or hostname of the target machine
|
2024-10-23 06:53:07 +00:00
|
|
|
- Replace `<ssh_user>` with the username of the user that you set up on target machine (e.g. dev, ubuntu)
|
2024-09-12 04:43:53 +00:00
|
|
|
|
|
|
|
- Verify that you are able to connect to the host using the following command
|
|
|
|
|
|
|
|
```bash
|
2024-10-23 06:53:07 +00:00
|
|
|
ansible all -m ping -i hosts.ini
|
2024-09-12 04:43:53 +00:00
|
|
|
|
|
|
|
# Expected output:
|
|
|
|
|
|
|
|
# <host_name> | SUCCESS => {
|
|
|
|
# "ansible_facts": {
|
|
|
|
# "discovered_interpreter_python": "/usr/bin/python3.10"
|
|
|
|
# },
|
|
|
|
# "changed": false,
|
|
|
|
# "ping": "pong"
|
|
|
|
# }
|
|
|
|
```
|
|
|
|
|
2024-10-23 06:53:07 +00:00
|
|
|
- Execute the `setup-laconic-so.yml` Ansible playbook for setting up stack orchestrator and docker on the target machine:
|
2024-09-12 04:43:53 +00:00
|
|
|
|
|
|
|
```bash
|
2024-10-23 06:53:07 +00:00
|
|
|
LANG=en_US.utf8 ansible-playbook setup-laconic-so.yml -i hosts.ini --extra-vars='{ "target_host": "deployment_host"}' --user $USER
|
2024-09-12 04:43:53 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Verify Installation
|
|
|
|
|
2024-10-23 06:53:07 +00:00
|
|
|
Run the following commands on your target machine:
|
|
|
|
|
|
|
|
- After the installation is complete, verify if `$HOME/bin` is already included in the `PATH` by running:
|
2024-09-12 04:43:53 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
echo $PATH | grep -q "$HOME/bin" && echo "$HOME/bin is already in PATH" || echo "$HOME/bin is not in PATH"
|
|
|
|
```
|
|
|
|
If the command outputs `"$HOME/bin is not in PATH"`, you'll need to add it to your `PATH`.
|
|
|
|
|
2024-10-23 06:53:07 +00:00
|
|
|
- To add `$HOME/bin` to your `PATH`, run the following command:
|
2024-09-12 04:43:53 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
export PATH="$HOME/bin:$PATH"
|
|
|
|
```
|
|
|
|
|
|
|
|
- To make this change permanent, add the following line to your shell configuration file (`~/.bashrc` or `~/.zshrc`, depending on your shell):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# For bash users
|
|
|
|
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
|
2024-10-01 12:17:10 +00:00
|
|
|
source ~/.bashrc
|
2024-09-12 04:43:53 +00:00
|
|
|
|
|
|
|
# For zsh users
|
|
|
|
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
|
2024-10-01 12:17:10 +00:00
|
|
|
source ~/.zshrc
|
2024-09-12 04:43:53 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
- Once the PATH is set, verify the installation by running the following commands:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Check version of docker
|
|
|
|
docker --version
|
|
|
|
|
|
|
|
# Check version of docker compose
|
|
|
|
docker compose version
|
|
|
|
|
|
|
|
# Check version of Stack Orchestrator
|
|
|
|
laconic-so version
|
|
|
|
```
|