From dc91c4167e38fcd88ab109c235dc1ee36cd09a74 Mon Sep 17 00:00:00 2001 From: Platinium Date: Tue, 27 Feb 2024 22:16:15 +0100 Subject: [PATCH] rm ansible --- README.md | 67 +-------- .../kubo_systemd_registration.toml | 12 -- .../ansible/bare_metal_install/playbook.yml | 46 ------- deploy/ansible/copy_ssh_key/playbook.yml | 50 ------- deploy/ansible/docker_install/playbook.yml | 130 ------------------ deploy/docker-compose/docker-compose.yml | 76 ---------- deploy/index-flag | 1 - 7 files changed, 3 insertions(+), 379 deletions(-) delete mode 100644 deploy/ansible/bare_metal_install/kubo_systemd_registration.toml delete mode 100644 deploy/ansible/bare_metal_install/playbook.yml delete mode 100644 deploy/ansible/copy_ssh_key/playbook.yml delete mode 100644 deploy/ansible/docker_install/playbook.yml delete mode 100644 deploy/docker-compose/docker-compose.yml delete mode 100644 deploy/index-flag diff --git a/README.md b/README.md index ca7edf9..d257f30 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,7 @@ # VSC Node -< fill in > +The VSC node is the core of the VSC ecosystem, holding the code necessary for keeping the VSC network operational. -## Installation +## Getting Involved -### Docker compose - -Install [Docker](https://docs.docker.com/get-docker/) and [Docker compose](https://docs.docker.com/compose/install/). - -Download the Docker compose file [here](https://raw.githubusercontent.com/vsc-eco/vsc-node/main/deploy/docker-compose/docker-compose.yml). - -Assure that the Docker user has write permissions in the directory you startup the Docker compose file. - -Create an `.env` file according to the schema specified in the [.env.example](https://raw.githubusercontent.com/vsc-eco/vsc-node/main/.env.example) file and put it next to the docker compose file. - -``` txt -# Fill these in with your hive account details -HIVE_ACCOUNT= -HIVE_ACCOUNT_POSTING= -HIVE_ACCOUNT_ACTIVE= - - -# Leave untouched unless instructed otherwise. -MULTISIG_ACCOUNT=vsc.beta -MULTISIG_ANTI_HACK=did:key:z6Mkj5mKz5EBnqqsyV2qBohYFuvTXpCuxzNMGSpa1FJRstze -MULTISIG_ANTI_HACK_KEY= -``` - -Launch via `docker-compose up -d`. - -### Ansible - -Ansible is a [deployment automation](https://opensource.com/resources/what-ansible) tool. - -You can install the VSC node via an ansible playbook. [Follow the instructions](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#pip-install) to install ansible on your machine. Sshpass is also a requirement (`apt install sshpass`). Note: it is only available on linux (you can also use it in WSL). - -The installation has been tested on **ubuntu**. - -To use the supplied ansible script you will need to define a target node. This can be done by creating an `inventory.yml` file and dropping it in the root of this project. -```yml ---- -vsc_nodes: - hosts: - raspberrypi: - ansible_host: 192.168.0.100 #changeme - ansible_user: pi #changeme - ansible_password: #changeme - ansible_become_pass: #changeme - -``` - -The ansible playbook can then be launched via the command shown below. - -`ansible-playbook deploy/ansible/docker_install/playbook.yml -i inventory.yml` - -You will be prompted for various hive keys that need to be entered in order for your node to function properly. - -Note: the last step of the script takes really long for the first time as it needs to fetch node modules. If you wanna check if your node is actively doing something check the `top` command. - -On a high level the script - -1. installs docker and its prequesites -1. copies over relevant files -1. starts up the docker-compose file to launch the node -1. register the update.sh script as a crown job to automatically keep the node up to date - -The bare_metal installation is currently not completed. +If you are interested in operating the VSC node yourself and contributing to our growing network, explore the [deployment repository](https://github.com/vsc-eco/vsc-deployment) for all the details you need to get started. diff --git a/deploy/ansible/bare_metal_install/kubo_systemd_registration.toml b/deploy/ansible/bare_metal_install/kubo_systemd_registration.toml deleted file mode 100644 index c6f5bd6..0000000 --- a/deploy/ansible/bare_metal_install/kubo_systemd_registration.toml +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=IPFS daemon -After=network.target - -[Service] -### Uncomment the following line for custom ipfs datastore location -# Environment=IPFS_PATH=/path/to/desired/location/of/datastore -ExecStart=/usr/local/bin/ipfs daemon -Restart=on-failure - -[Install] -WantedBy=default.target diff --git a/deploy/ansible/bare_metal_install/playbook.yml b/deploy/ansible/bare_metal_install/playbook.yml deleted file mode 100644 index dd0e57b..0000000 --- a/deploy/ansible/bare_metal_install/playbook.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- name: install vsc node bare metal - hosts: vsc_nodes - become: true - tasks: - - name: Disable ipfs service if running - systemd: - name: ipfs.service - enabled: false - ignore_errors: true - - - name: Download ipfs binary - get_url: - url: "{{ IPFS_URL }}" - dest: /tmp/ipfs_binary.tar.gz - - - name: Extract ipfs binary - unarchive: - src: /tmp/ipfs_binary.tar.gz - dest: /tmp/ - remote_src: yes - - - name: Execute the kubo installation - shell: /tmp/kubo/install.sh >> /tmp/kubo_install_log.txt - - - name: Verify kubo installation - shell: ipfs --version - register: output - - - debug: - var: output - - - name: Initialize ipfs - shell: ipfs init --profile=lowpower - ignore_errors: true - - - name: Copy over the systemd registration file - copy: - src: kubo_systemd_registration.toml - dest: /etc/systemd/system/ipfs.service - - - name: Enable and start ipfs service - systemd: - name: ipfs.service - enabled: true - state: started diff --git a/deploy/ansible/copy_ssh_key/playbook.yml b/deploy/ansible/copy_ssh_key/playbook.yml deleted file mode 100644 index d242a17..0000000 --- a/deploy/ansible/copy_ssh_key/playbook.yml +++ /dev/null @@ -1,50 +0,0 @@ ---- -- name: upload ssh key to node - hosts: vsc_nodes - become: true - vars_prompt: - - name: ssh_key_path - prompt: "Enter path for ssh key of your github account. If no path is entered no ssh key is copied over.\nPath should be relative to this playbook!" - default: "" - private: false - tasks: - - name: Creates ssh directory - file: - path: /home/{{ ansible_user }}/.ssh/ - state: directory - - - name: Copy over ssh file - copy: - src: "{{ ssh_key_path }}" - dest: "/home/{{ ansible_user }}/.ssh/github_private.key" - mode: 0400 - owner: "{{ ansible_user }}" - when: ssh_key_path != "" - - - name: Append configuration to ~/.ssh/config - lineinfile: - path: "/home/{{ ansible_user }}/.ssh/config" - create: true - line: | - Host github.com - HostName github.com - User git - PreferredAuthentications publickey - IdentityFile "/home/{{ ansible_user }}/.ssh/github_private.key" - - - name: Check if host key already exists in known_hosts - shell: grep "{{ inventory_hostname }}" /home/{{ ansible_user }}/.ssh/known_hosts - register: grep_output - ignore_errors: yes - - - name: Fetch public key for target host - shell: ssh-keyscan github.com - register: ssh_keyscan_output - when: grep_output.rc != 0 - - - name: Add host to known_hosts - lineinfile: - line: "{{ ssh_keyscan_output.stdout }}" - dest: "/home/{{ ansible_user }}/.ssh/known_hosts" - create: true - when: ssh_keyscan_output.stdout != '' and grep_output.rc != 0 \ No newline at end of file diff --git a/deploy/ansible/docker_install/playbook.yml b/deploy/ansible/docker_install/playbook.yml deleted file mode 100644 index 114e7cd..0000000 --- a/deploy/ansible/docker_install/playbook.yml +++ /dev/null @@ -1,130 +0,0 @@ ---- -- name: install vsc node - hosts: vsc_nodes - become: true - vars: - NODEJS_VERSION: "18" - IPFS_URL: "https://dist.ipfs.tech/kubo/v0.19.1/kubo_v0.19.1_linux-amd64.tar.gz" - vars_prompt: - - name: hive_account - prompt: "Enter hive account name. If no account is provided the parameterization .env file will not be created." - default: "" - private: false - - name: hive_account_posting - prompt: "Enter hive account posting key. If no key is provided the parameterization .env file will not be created.\n(Input is hidden)" - default: "" - private: true - - name: hive_account_active - prompt: "Enter hive account active key. If no key is provided the parameterization .env file will not be created.\n(Input is hidden)" - default: "" - private: true - tasks: - - name: Update and upgrade apt packages - become: true - apt: - upgrade: yes - update_cache: yes - cache_valid_time: 86400 #One day - - - name: Install the gpg key for nodejs LTS - apt_key: - url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" - state: present - - - name: Install the nodejs LTS repos - apt_repository: - repo: "deb https://deb.nodesource.com/node_{{ NODEJS_VERSION }}.x {{ ansible_distribution_release }} main" - state: present - update_cache: yes - - - name: Install the nodejs and other prerequisites - apt: - name: - - nodejs - - git - - apt-transport-https - - ca-certificates - - curl - - software-properties-common - - python3-pip - - virtualenv - - python3-setuptools - - postfix - state: latest - - - name: Add Docker GPG apt Key - apt_key: - url: https://download.docker.com/linux/ubuntu/gpg - state: present - - - name: Add Docker Repository - apt_repository: - repo: deb https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable - state: present - - - name: Update apt and install docker - apt: - name: - - docker-ce - - docker-compose - state: latest - update_cache: true - - - name: Install Docker Module for Python - pip: - name: docker - - - name: Add user to "docker" group - user: - name: "{{ ansible_user }}" - groups: "docker" - append: yes - - - name: Add the safe directory setting to ~/.gitconfig - git_config: - name: safe.directory - scope: system - value: "/app/node" - - - name: Changing perm of vsc-node dir - file: "dest=/app/ owner={{ ansible_user }} recurse=yes" - - - name: Git checkout vsc-node - become_user: "{{ ansible_user }}" - git: - repo: 'https://github.com/vsc-eco/vsc-node.git' - dest: /app/node - version: main - force: false - accept_newhostkey: true - # key_file: "/home/{{ ansible_user }}/.ssh/github_private.key" - - - name: Create parameterization .env file - lineinfile: - path: "/app/node/.env" - state: present - search_string: "{{ item.search_string }}" - create: true - line: "{{ item.line }}" - when: hive_account_active != "" and hive_account_posting != "" and hive_account != "" - loop: - - { search_string: 'ACCOUNT=', line: "HIVE_ACCOUNT={{ hive_account }}" } - - { search_string: 'ACTIVE=', line: "HIVE_ACCOUNT_ACTIVE={{ hive_account_active }}" } - - { search_string: 'POSTING=', line: "HIVE_ACCOUNT_POSTING={{ hive_account_posting }}" } - - { search_string: 'MULTISIG_ACCOUNT=', line: "MULTISIG_ACCOUNT=vsc.beta" } - - { search_string: 'MULTISIG_ANTI_HACK=', line: "MULTISIG_ANTI_HACK=did:key:z6Mkj5mKz5EBnqqsyV2qBohYFuvTXpCuxzNMGSpa1FJRstze" } - - { search_string: 'MULTISIG_ANTI_HACK_KEY=', line: "MULTISIG_ANTI_HACK_KEY=" } - - - name: register vsc's 'update.sh' as a cron job - cron: - name: vsc-node - minute: "0" - user: "{{ ansible_user }}" - job: "/app/node && /app/node/update.sh" - - - name: Start up the vsc node - docker_compose: - build: true - project_src: /app/node - files: - - docker-compose.yml diff --git a/deploy/docker-compose/docker-compose.yml b/deploy/docker-compose/docker-compose.yml deleted file mode 100644 index aa965c5..0000000 --- a/deploy/docker-compose/docker-compose.yml +++ /dev/null @@ -1,76 +0,0 @@ -version: "3.3" - -services: - vsc-node: # name of the service - image: vaultec/vsc-node:main - container_name: vsc-node # what to label the container for docker ps - restart: always # restart if failed, until we stop it ourselves - #external_links: - #- mongo - depends_on: - - ipfs - networks: - - vsc-node - ports: - - 1337:1337 - environment: - IPFS_HOST: http://ipfs:5001 - MONGO_HOST: mongo:27017 - volumes: - - node-modules-store:/home/github/app/node_modules - - ./data/vsc-node:/root/.vsc-node - - ./seed-backup.json:/root/.vsc-seed-backup.json - - ./.git/refs/heads/main:/root/git_commit - logging: - driver: "json-file" - options: - max-file: "5" - max-size: "10m" - - mongo: - container_name: mongo_vsc - image: mongo:4.4.18 - restart: always - ports: - - 127.0.0.1:27021:27017 - networks: - - vsc-node - volumes: - - ./data/vsc-db:/data/db - logging: - driver: "json-file" - options: - max-file: "5" - max-size: "5m" - - ipfs: - container_name: ipfs-vsc - image: ipfs/kubo:v0.18.1 - restart: always - command: - - daemon - - --enable-pubsub-experiment - - --init-profile - - server - networks: - - vsc-node - ports: - - "4001:4001" - - "127.0.0.1:5001:5001" - environment: - IPFS_PATH: /etc/ipfs - volumes: - - ./data/ipfs:/etc/ipfs - logging: - driver: "json-file" - options: - max-file: "5" - max-size: "5m" - -volumes: - node-modules-store: {} - mongodb: {} - -networks: - vsc-node: - driver: bridge diff --git a/deploy/index-flag b/deploy/index-flag deleted file mode 100644 index bf0d87a..0000000 --- a/deploy/index-flag +++ /dev/null @@ -1 +0,0 @@ -4 \ No newline at end of file