Git Product home page Git Product logo

Comments (4)

trueshura avatar trueshura commented on September 16, 2024

If you see a reason to use Vagrant - you can create Vagrantfile and other related stuff. And we'll add it to repo, after tests.
I have no experience with it at all.

from cil-core.

adamjk-dev avatar adamjk-dev commented on September 16, 2024

Vagrant is a CLI tool for talking to hypervisors (like VirtualBox, VMWare Fusion, among many others). The idea would be that you could use a Vagrantfile and have a user stand up a master node on Linux/Windows/etc. from the same base box.

I have a sample Vagrantfile that gets you to step 13 (minus swap space) on the following: https://ubix.wiki/index.php/Launch_a_Masternode

Then, the user would just copy in their Keystore info etc. and run the Docker container.

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # The box to start from
  config.vm.box = "generic/ubuntu2004"
  config.vm.define "ubixmaster"
  config.vm.hostname = "ubixmaster"

  # Port forwarding section
  # config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a forwarded port mapping
  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

  # Create a private network, which allows host-only access to the machine
  # config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # VirtualBox specific configs
  config.vm.provider "virtualbox" do |vb|
      # Display the VirtualBox GUI when booting the machine
      vb.gui = true
  
      # Machine name
      vb.name = "ubixmaster"

      # Customize the amount of memory and CPU on the VM:
      vb.memory = "4096"
      vb.cpus = 2
  end

  # Provision the machine and configure it
  config.vm.provision "shell", inline: <<-SHELL
      # Update
      sudo apt-get update

      # Dependent packages
      sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common

      # Repo def
      sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
      sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

      # Update
      sudo apt-get update

      # Install Docker Community Edition
      sudo apt-get -y install docker-ce

      # Pull master node Docker image
      sudo docker pull trueshura/cil-core-prod

      # Pull helper scripts and untar
      wget -t0 -c https://github.com/SilentNotaryEcosystem/Cil-core/releases/download/v0.7.0-staging/docker-scripts.tgz
      tar fxz docker-scripts.tgz

      # Firewall
      sudo ufw status
      sudo ufw allow 8223
      sudo ufw status
  SHELL
end

  1. You install Vagrant
  2. You install VirtualBox
  3. You drop the Vagrantfile in a directory
  4. You type "vagrant up", let it provision from the Ubuntu 20.04 box, do provisioning customizations, etc.
  5. You type "vagrant ssh" and get into the box and move on from step 13

If you would like to test it out have at it, or I can submit a PR with the Vagrantfile. I think we should also consider a test script to ensure the node will join the concilium as well (so one can validate their master node before joining). The easier it is to stand up a master node and validate it, the more people will. I am happy to help with these items, but we would need a test "keystore" to put in the sample.pk to test with before dropping in the user's info.

from cil-core.

adamjk-dev avatar adamjk-dev commented on September 16, 2024

Or another option, to use a bash starter to install Ansible, then use an Ansible playbook to configure the master node:

  • Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # The box to start from
  config.vm.box = "generic/ubuntu2004"
  config.vm.define "ubixmaster"
  config.vm.hostname = "ubixmaster"

  # Port forwarding section
  # config.vm.network "forwarded_port", guest: 8222, host: 8222
  # Create a forwarded port mapping
  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
  # Create a private network, which allows host-only access to the machine
  # config.vm.network "private_network", ip: "192.168.33.10"
  # Create a public network, which generally matched to bridged network.
  # config.vm.network "public_network"
  # Share an additional folder to the guest VM.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # VirtualBox specific configs
  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
  
    # Machine name
    vb.name = "ubixmaster"

    # Customize the amount of memory and CPU on the VM:
    vb.memory = "4096"
    vb.cpus = 2
  end

  # Sync local folder to /vagrant so Ansible playbook can be found to run locally
  config.vm.synced_folder ".", "/vagrant"

  # Shell provisioner updates and installs Ansible
  config.vm.provision "shell", before: "ansible_local", inline: <<-SHELL
    sudo apt update
    sudo apt-get -y install software-properties-common
    sudo apt-add-repository --yes --update ppa:ansible/ansible
    sudo apt-get -y install ansible
  SHELL

  # Run ansible locally to provision the machine
  config.vm.provision "ansible_local" do |ansible|
    ansible.become = true
    ansible.playbook = "ubix-master-dependencies.yml"
  end
end

  • Ansible playbook:
---
- hosts: all
  name: Master Node Customizations

  tasks:
  - name: Install required packages
    apt:
      pkg:
      - apt-transport-https 
      - ca-certificates 
      - curl 
      - gnupg-agent
      - software-properties-common
    
  - name: Add Docker GPG key
    apt_key:
      url: https://download.docker.com/linux/ubuntu/gpg

  - name: Add Docker Ubuntu Apt Repo
    apt_repository:
      repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
      update_cache: no

  - name: Update all packages to their latest version
    apt:
      name: "*"
      state: latest

  # NOTE: Hit bug using apt pkg play: https://github.com/ansible/ansible/issues/69414
  #       Workaround is to use shell install of packages below
  #- name: Install docker-ce, docker-ce-cli, and containerd packages
  #  apt:
  #    pkg: 
  #    - docker-ce
  #    - docker-ce-cli
  #    - containerd.io
  - name: Install docker-ce
    shell: apt-get install -y docker-ce docker-ce-cli containerd.io
    args:
      warn: false # Ignore warning since this is a workaround to using apt pkg play
    become: true

  - name: Start and enable Docker daemon
    service:
      name: docker
      state: started
      enabled: yes
      
  - name: Pull CIL Core Docker Image
    shell: docker pull trueshura/cil-core-prod

  - name: Download helper scripts
    get_url:
      url: https://github.com/SilentNotaryEcosystem/Cil-core/releases/download/v0.7.0-staging/docker-scripts.tgz
      dest: /tmp
      mode: 0644

  - name: Untar helper scripts
    unarchive:
      src: /tmp/docker-scripts.tgz
      dest: /home/vagrant

  - name: Allow all access to port 8223
    ufw:
      rule: allow
      port: "8223"
      proto: any
  

from cil-core.

Vornado10 avatar Vornado10 commented on September 16, 2024

Hello, I am interested in running a masternode as I am a current ubx holder as well. The process for a non tech guy like myself does seem very intimidating from the instructions on the new website. I want to help and run one, but I don't want to screw anything up or do it wrong. If there is anyway to dumb it down even more, I'm in! Ha ha.

I will add, that I am going to start learning java from scratch this week, so I'm sure that will help.

from cil-core.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.