X-CASH-official / xcash-dpops

🗳 Delegated-Proof-of-Private-Stake: First DPoS implementation on a Monero-based coin
https://xcash.foundation
MIT License
48 stars 17 forks source link

New LXC Installer - X-Cash node autoinstaller new features and fixes - Maintenance script new features and fixes #36

Closed n3me5is-git closed 4 years ago

n3me5is-git commented 4 years ago

Description

I created a new version of the autoinstaller.sh adding the following features:

new_autoinstaller png

The code is based on the new rradu modifications, so include also the timers stuff for autostart (needed also for the X-Cash container). I fixed also some bugs and tested the features. Added also the fixes for some other known bugs (swap generation issue, switch shared/solo delegate...) and other small bugs I found myself.

I modified the script to support the installation inside a LXC container, especially a container with bind-mounted data (and service files) so if the script runs inside a lxc container ($container variable is "lxc") is uses the correct modifications (like setting autostart to YES and other things). So now there is compatibility with host install and with container (LXC) install.

I modified also the xcash-maintenance script fixing some things:

Finally I created a LXC autoinstaller that has the following features:

screen

The LXC container uses bind-mounted folders to save personal data on the host (a xcash-shared-node folder will be created on your home, containing everything you have to NOT share). This is managed automatically by the autoinstaller. In the host data folder there will be the wallets, the service files (containing password and keys), the logs, the DPOPS DB and the blockchain DB. If you delete/update the container, this data will be left untouched. And if you create an image and share it (pre-built image) all your personal data and DB will remain on your system (and not inside the image).

The LXC containers uses the LXC "proxy device" for port forwarding, this doesn't use NAT but everything passes from user-land (INPUT of iptables). This has been already tested and working by @zachhildreth if I remember correctly (using this as reference: https://github.com/X-CASH-official/xcash-dpops/tree/559fdfd13d53874f509fba504e2a29c29800c051#how-to-setup-an-lxc-container).

A tutorial about how to use the LXC installer is here: https://github.com/n3me5is-git/xcash-dpops/tree/master/scripts/autoinstaller

I created/modified these main files:

I also modified the templates where needed to match the ones used in the autoinstaller (systemd and firewall). So if the things are good I can create a pull request and everything should be updated in the correct way.

I tested a couple of times all the features of the LXC installer on a VM and everything should work as expected (maybe some minor bug). I tested, during beta first run, the LXC configuration, but the network stopped so I was able to test it only for a short period of time. I was the block producer 3-4 times during that interval without issues. I hope to confirm this during the next beta run. If someone want to join trying my LXC installer...

I created a pre-built image yesterday evening that should be updated and ready for the next beta run. The handle in the installer tutorial is for that image.

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist:

n3me5is-git commented 4 years ago

A note: my LXC installer currently uses Opacity Storage (see Opacity project) as storage option for fast downloading the pre-built LXC image. If the X-Cash team intends to provide a pre-built "official" image (not built by a community member) can chose to to use Opacity as well (if interested) or simply disabling the feature in the scripts and using wget to download the image from a given url. The script supports both (just set DOWNLOAD_USE_OPACITY_DOWNLOADER to "NO" and provide the image url in DIRECT_DOWNLOAD_URL). I used Opacity because it's cheap and fast (even if still in development), and I like privacy projects.

n3me5is-git commented 4 years ago

Thanks Zach! I remembered that in my script I still have the URL pointing to my github. Now that the script in on the xcash official github it's better to point to the scripts on the official branch. I will change the url as soon as I have time (I need to check the FW too for some improvements).

There is also this note: my LXC installer currently uses Opacity Storage (see Opacity project) as storage option for fast downloading the pre-built LXC image. If the X-Cash team intends to provide a pre-built "official" image (not built by a community member) can chose to to use Opacity as well (if interested) or simply disabling the feature in the scripts and using wget to download the image from a given url. The script supports both (just set DOWNLOAD_USE_OPACITY_DOWNLOADER to "NO" and provide the image url in DIRECT_DOWNLOAD_URL). I used Opacity because it's cheap and fast (even if still in development), and I like privacy projects.

Let me know what do you prefer! If we need to keep this setting (or maybe add a selector, so the user can choose what download method and the source url)