2024-09-18 07:48:48 +00:00
|
|
|
# service-provider-setup
|
2024-09-18 09:19:40 +00:00
|
|
|
|
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
|
|
|
|
|
2024-09-23 13:29:16 +00:00
|
|
|
## Setup User `dev`
|
|
|
|
|
|
|
|
- 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 desired `hostname` of the remote machine
|
|
|
|
- Replace `<target_ip>` with the IP address or hostname of the target machine
|
|
|
|
- Replace `<ssh_user>` with `root`
|
|
|
|
|
|
|
|
- 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"
|
|
|
|
# }
|
|
|
|
```
|
|
|
|
|
|
|
|
- Execute the `setup-user.yml` Ansible playbook to create a user `dev` with sudo permissions:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
ansible-playbook setup-user.yml -i hosts.ini --extra-vars='{ "target_host": "deployment_host" }'
|
|
|
|
```
|
|
|
|
|
|
|
|
For the following playbooks, Update `ansible_user` in the [`hosts.ini`](./hosts.ini) file to the user that you created
|
|
|
|
|
2024-09-18 09:19:40 +00:00
|
|
|
## Configure DNS
|
|
|
|
|
|
|
|
### Prerequisites
|
|
|
|
|
|
|
|
- Buy a domain and configure nameservers to DigitalOcean
|
|
|
|
|
|
|
|
- Generate a DigitalOcean access token
|
|
|
|
|
|
|
|
### Create DNS entries in DigitalOcean
|
|
|
|
|
2024-09-23 09:08:49 +00:00
|
|
|
- Copy the [`dns-vars.example.yml`](./vars/dns-vars.example.yml) file
|
2024-09-18 09:19:40 +00:00
|
|
|
|
|
|
|
```bash
|
2024-09-23 13:29:16 +00:00
|
|
|
cd vars
|
2024-09-18 09:19:40 +00:00
|
|
|
cp dns-vars.example.yml dns-vars.yml
|
|
|
|
```
|
|
|
|
|
2024-09-23 09:08:49 +00:00
|
|
|
- Set the following values in the `dns-vars.yml` file
|
2024-09-18 09:19:40 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
# primary domain for which DNS records will be managed
|
|
|
|
# eg: laconic.com
|
|
|
|
domain: ""
|
|
|
|
|
|
|
|
# specific prefix for subdomains
|
|
|
|
# eg: lcn-cad
|
|
|
|
subdomain_prefix: ""
|
|
|
|
|
|
|
|
# The IP address to be used for the A record of the cluster control machine
|
|
|
|
# eg: 23.111.78.179
|
|
|
|
cluster_control_ip: ""
|
|
|
|
|
|
|
|
# DigitalOcean access token
|
|
|
|
# eg: dop_v1...
|
|
|
|
do_api_token: ""
|
|
|
|
```
|
|
|
|
|
|
|
|
- Run the [`setup-dns.yml`](./setup-dns.yml) ansible playbook to create the necessary DNS entries in DigitalOcean
|
|
|
|
|
|
|
|
```bash
|
|
|
|
ansible-playbook setup-dns.yml
|
|
|
|
```
|
2024-09-20 04:34:16 +00:00
|
|
|
|
2024-09-23 13:29:16 +00:00
|
|
|
## Setup k8s clusters
|
2024-09-20 04:34:16 +00:00
|
|
|
|
2024-09-23 13:29:16 +00:00
|
|
|
- Create a PGP key on your target host
|
2024-09-20 04:34:16 +00:00
|
|
|
|
2024-09-23 13:29:16 +00:00
|
|
|
```
|
|
|
|
gpg --full-generate-key
|
|
|
|
```
|
2024-09-20 04:34:16 +00:00
|
|
|
|
2024-09-23 13:29:16 +00:00
|
|
|
- List the secret keys
|
2024-09-20 04:34:16 +00:00
|
|
|
|
2024-09-23 13:29:16 +00:00
|
|
|
```
|
|
|
|
gpg --list-secret-keys --keyid-format=long
|
2024-09-20 04:34:16 +00:00
|
|
|
```
|
|
|
|
|
2024-09-23 13:29:16 +00:00
|
|
|
- This will output something like this
|
2024-09-20 04:34:16 +00:00
|
|
|
|
2024-09-23 13:29:16 +00:00
|
|
|
```
|
|
|
|
[keyboxd]
|
|
|
|
---------
|
|
|
|
sec rsa4096/0AFB10B643944C22 2024-05-03 [SC] [expires: 2025-05-03]
|
|
|
|
17B3248D6784EC6CB43365A60AFB10B643944C22
|
|
|
|
uid [ultimate] user <hello@laconic.com>
|
|
|
|
```
|
|
|
|
|
|
|
|
Note the `0AFB10B643944C22` sequence of characters.
|
|
|
|
|
|
|
|
- Copy the [`k8s-vars.example.yml`](./vars/k8s-vars.example.yml) file
|
2024-09-20 04:34:16 +00:00
|
|
|
|
|
|
|
```bash
|
2024-09-23 13:29:16 +00:00
|
|
|
cd vars
|
|
|
|
cp k8s-vars.example.yml k8s-vars.yml
|
|
|
|
```
|
2024-09-20 04:34:16 +00:00
|
|
|
|
2024-09-23 13:29:16 +00:00
|
|
|
- Update `gpg_key_id` in [`k8s-vars.yml`](./vars/k8s-vars.yml) with the the following:
|
2024-09-20 04:34:16 +00:00
|
|
|
|
2024-09-23 13:29:16 +00:00
|
|
|
```bash
|
|
|
|
target_host: "deployment_host"
|
|
|
|
|
|
|
|
# The sequence you obtained in the previous step
|
|
|
|
# eg: 0AFB10B643944C22
|
|
|
|
gpg_key_id: ""
|
|
|
|
|
|
|
|
# The passphrase used while creating the GPG key
|
|
|
|
vault_passphrase: ""
|
|
|
|
|
|
|
|
# Three letter identifier for your organization
|
|
|
|
# eg: lcn
|
|
|
|
org_id: ""
|
|
|
|
|
|
|
|
# Three letter identifier for your location
|
|
|
|
# eg: cad
|
|
|
|
location_id: ""
|
|
|
|
|
|
|
|
# your domain
|
|
|
|
dns_domain: ""
|
2024-09-20 04:34:16 +00:00
|
|
|
```
|
|
|
|
|
2024-09-23 13:29:16 +00:00
|
|
|
- Run the `setup-k8s.yml` ansible playbook:
|
2024-09-20 04:34:16 +00:00
|
|
|
|
|
|
|
```bash
|
2024-09-23 13:29:16 +00:00
|
|
|
ansible-playbook setup-k8s.yml -i hosts.ini --extra-vars='{ target_host: "deployment_host" }' --user $USER
|
|
|
|
```
|
|
|
|
|
|
|
|
## Setup Container Registry
|
|
|
|
|
|
|
|
- Copy the [`container-vars.example.yml`](./vars/container-vars.example.yml) file
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd vars
|
|
|
|
cp container-vars.example.yml container-vars.yml
|
2024-09-20 04:34:16 +00:00
|
|
|
```
|
2024-09-23 13:29:16 +00:00
|
|
|
|
|
|
|
- Update the following in the [`container-vars.yml`](./vars/container-vars.yml) file:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# username for the container registry
|
|
|
|
container_registry_username: ""
|
|
|
|
|
|
|
|
# password for the container registry
|
|
|
|
container_registry_password: ""
|
|
|
|
```
|
|
|
|
|
|
|
|
- Run the `setup-container-registry.yml` ansible playbook
|
|
|
|
|
|
|
|
```bash
|
|
|
|
ansible-playbook setup-container-registry.yml -i hosts.ini --extra-vars='{ target_host: "deployment_host" }' --user $USER
|
|
|
|
```
|
|
|
|
|
|
|
|
## Setup laconicd and laconic console
|
|
|
|
|
|
|
|
-
|