testnet-ops/service-provider-setup/README.md

104 lines
3.3 KiB
Markdown
Raw Normal View History

2024-09-18 07:48:48 +00:00
# service-provider-setup
2024-09-18 10:08:38 +00:00
## Setup Ansible
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine
## Become a Service Provider
### Prerequisites
- Buy a domain and configure nameservers to DigitalOcean
- Generate a DigitalOcean access token
- Copy the vars files:
2024-09-20 04:34:16 +00:00
```bash
2024-09-23 13:29:16 +00:00
cd vars
cp user-vars.example.yml user-vars.yml
cp dns-vars.example.yml dns-vars.yml
2024-09-27 07:33:36 +00:00
cp gpg-vars.example.yml gpg-vars.yml
cp k8s-vars.example.yml k8s-vars.yml
cp container-vars.example.yml container-vars.yml
cp webapp-vars.example.yml webapp-vars.yml
2024-09-23 13:29:16 +00:00
```
2024-09-20 04:34:16 +00:00
- Update the following values in the respective variable files:
2024-09-20 04:34:16 +00:00
2024-09-23 13:29:16 +00:00
```bash
# vars/user-vars.yml
username: "" # name of the user you want to setup on the target host
password: "" # password of the user you want to setup on the target host
path_to_ssh_key: "" # path to the ssh key on your machine
# vars/dns-vars.yml
full_domain: "" # eg: laconic.com
subdomain_prefix: "" # eg: lcn-cad
cluster_control_ip: "" # eg: 23.111.78.179
do_api_token: "" # eg: dop_v1...
2024-09-23 13:29:16 +00:00
2024-09-27 07:33:36 +00:00
# vars/gpg-vars.yml
gpg_user_name: "" # Full name of the user for the GPG key
gpg_user_email: "" # Email address associated with the GPG key
gpg_passphrase: "" # Passphrase for securing the GPG key
# vars/k8s-vars.yml
target_host: "deployment_host"
org_id: "" # eg: lcn
location_id: "" # eg: cad
base_domain: "" # eg: laconic
support_email: "" # eg: support@laconic.com
2024-09-23 13:29:16 +00:00
# vars/container-vars.yml
container_registry_username: "" # username to login to the container registry
container_registry_password: "" # password to login to the container registry
2024-09-23 13:29:16 +00:00
# vars/webapp-vars.yml
authority_name: "" # eg: my-org-name
cpu_reservation: "" # Minimum number of cpu cores to be used, eg: 2
memory_reservation: "" # Minimum amount of memory in GB to be used, eg: 4G
2024-09-20 04:34:16 +00:00
```
2024-09-23 13:29:16 +00:00
- 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
[root_host]
<host_name> ansible_host=<target_ip> ansible_user=root ansible_ssh_common_args='-o ForwardAgent=yes'
[deployment_host]
<host_name> ansible_host=<target_ip> ansible_user=<new_username> ansible_ssh_common_args='-o ForwardAgent=yes'
```
- Replace `<host_name>` with the desired `hostname` of the remote machine
- Replace `<target_ip>` with the IP address or hostname of the target machine
- Under `deployment_host`, Replace `<ansible_user>` with the name of the user you want to create
- Verify that you are able to connect to the host using the following command:
```bash
ansible all -m ping -i hosts.ini
# Expected output:
# <host_name> | SUCCESS => {
# "ansible_facts": {
# "discovered_interpreter_python": "/usr/bin/python3.10"
# },
# "changed": false,
# "ping": "pong"
# }
```
2024-09-23 13:29:16 +00:00
- Run the `service-provider-setup.yml` ansible-playbook to DNS records, deploy k8s, setup container registry, deploy the webapp-deployer API and webapp-deployer UI
2024-09-23 13:29:16 +00:00
```bash
LANG=en_US.utf8 ansible-playbook service-provider-setup.yml -i hosts.ini --extra-vars='{ target_host: "deployment_host" }' --user $USER
2024-09-23 13:29:16 +00:00
```