testnet-ops/service-provider-setup
2024-09-26 10:16:47 +05:30
..
templates Add playbook to setup and start webapp-ui 2024-09-23 16:51:57 +05:30
vars Add playbook for setting up service provider 2024-09-24 15:32:50 +05:30
.gitignore Add playbook for setting up service provider 2024-09-24 15:32:50 +05:30
deploy-backend.yml Add playbook for setting up service provider 2024-09-24 15:32:50 +05:30
deploy-frontend.yml Add playbook to setup and start webapp-ui 2024-09-23 16:51:57 +05:30
README.md Add task to setup passwordless sudo for user 2024-09-26 10:16:47 +05:30
run-laconic-console.yml Add playbook to setup and start webapp-ui 2024-09-23 16:51:57 +05:30
run-laconicd.yml Add playbooks to setup fixturenet-laconicd and laconic-console 2024-09-20 14:11:12 +05:30
service-provider-setup.yml Add playbook for setting up service provider 2024-09-24 15:32:50 +05:30
setup-container-registry.yml Add directory for vars files 2024-09-23 14:38:49 +05:30
setup-dns.yml Update README 2024-09-23 18:59:16 +05:30
setup-k8s.yml Add task to setup passwordless sudo for user 2024-09-26 10:16:47 +05:30
setup-user.yml Add task to setup passwordless sudo for user 2024-09-26 10:16:47 +05:30

service-provider-setup

Setup Ansible

To get started, follow the installation guide to setup ansible on your machine

Setup User dev

  • Create a new hosts.ini file:

    cp ../hosts.example.ini hosts.ini
    
  • Edit the hosts.ini file to run the playbook on a remote machine:

    [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:

    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"
    # }
    
  • Setup user-vars.yml using the example file

    cd vars
    cp user-vars.example.yml user-vars.yml
    
  • Edit the following vars:

    # name of the user you want to setup on the target host
    username: ""
    
    # password of the user you want to setup on the target host
    password: ""
    
    # path to the ssh key on your machine
    path_to_ssh_key: "
    
  • Execute the setup-user.yml Ansible playbook to create a user with passwordless sudo permissions:

    ansible-playbook setup-user.yml -i hosts.ini --extra-vars='{ "target_host": "deployment_host" }'
    

Become a Service Provider

Prerequisites

  • Buy a domain and configure nameservers to DigitalOcean

  • Generate a DigitalOcean access token

  • Create a PGP key on your target host

    gpg --full-generate-key
    
  • List the secret keys

    gpg --list-secret-keys --keyid-format=long
    
  • This will output something like this

    [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. This will be required later.

  • Copy the vars files:

    cd vars
    cp dns-vars.example.yml dns1-vars.yml
    cp k8s-vars.example.yml k8s1-vars.yml
    cp container-vars.example.yml container1-vars.yml
    cp webapp-vars.example.yml webapp-vars.yml
    
  • Update the following values in the respective variable files:

    # vars/dns-vars.yml
    domain: ""                    # eg: laconic.com
    subdomain_prefix: ""          # eg: lcn-cad
    cluster_control_ip: ""        # eg: 23.111.78.179
    do_api_token: ""              # eg: dop_v1...
    
    # vars/k8s-vars.yml
    target_host: "deployment_host"
    gpg_key_id: ""                # The sequence obtained in the previous step, eg: 0AFB10B643944C22
    vault_passphrase: ""          # passphrase for GPG key
    org_id: ""                    # eg: lcn
    location_id: ""               # eg: cad
    dns_domain: ""                # eg: laconic.com
    
    # vars/container-vars.yml
    container_registry_username: "" # username to login to the container registry
    container_registry_password: "" # password to login to the container registry
    
    # vars/webapp-vars.yml
    authority_name: "" # eg: my-org-name
    
  • Update ansible_user in the hosts.ini file to the user on target host

  • 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

    ansible-playbook service-provider-setup.yml -i hosts.ini --extra-vars='{ target_host: "deployment_host" }' --user $USER