Skip to content

Demo machine setup (Ubuntu)

Bill-Keuntje edited this page Apr 20, 2021 · 3 revisions
apt update
apt upgrade
apt install curl gnupg2 ca-certificates lsb-release
echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
    | tee /etc/apt/sources.list.d/nginx.list
echo "deb http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" \
    | tee /etc/apt/sources.list.d/nginx.list
echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
    | tee /etc/apt/preferences.d/99nginx
curl -o /tmp/nginx_signing.key https://nginx.org/keys/nginx_signing.key
gpg --dry-run --quiet --import --import-options show-only /tmp/nginx_signing.key
mv /tmp/nginx_signing.key /etc/apt/trusted.gpg.d/nginx_signing.asc
apt update
apt install nginx
apt install certbot
adduser rchain

vi /etc/nginx.conf add the line "include /etc/nginx/sites-enabled/*;" before the last brace '}'

cd /etc/nginx
mkdir sites-enabled sites-available
mv conf.d/default.conf sites-available

Create sites-available/demoapi.rhobot.net

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

#


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
server {
       listen 80;
       listen [::]:80;
#
        server_name demoapi.rhobot.net;
#
        root /home/rchain/liquid-democracy/dist;
#       index index.html;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }

    location / {
        proxy_pass http://demo.rhobot.net:40403;
#        proxy_http_version 1.1;
#        proxy_set_header Upgrade $http_upgrade;
#        proxy_set_header Connection 'upgrade';
#        proxy_set_header Host $host;
#        proxy_cache_bypass $http_upgrade;
    }


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/demoapi.rhobot.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/demoapi.rhobot.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}


#server {
#    if ($host = rnodeapi.rhobot.net) {
#        return 301 https://$host$request_uri;
#    } # managed by Certbot


#    server_name demoapi.rhobot.net;
#    listen 80;
#    return 404; # managed by Certbot


#}

Create sites-available/demoadmin.rhobot.net

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

#


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
server {
       listen 80;
       listen [::]:80;
#
        server_name demoadmin.rhobot.net;
#
        root /home/rchain/liquid-democracy/dist;
#       index index.html;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }

    location / {
        proxy_pass http://demo.rhobot.net:40405;
#        proxy_http_version 1.1;
#        proxy_set_header Upgrade $http_upgrade;
#        proxy_set_header Connection 'upgrade';
#        proxy_set_header Host $host;
#        proxy_cache_bypass $http_upgrade;
    }


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/demoadmin.rhobot.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/demoadmin.rhobot.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}


#server {
#    if ($host = rnodeadmin.rhobot.net) {
#        return 301 https://$host$request_uri;
#    } # managed by Certbot


#    server_name demoadmin.rhobot.net;
#    listen 80;
#    return 404; # managed by Certbot


#}
cd sites-enabled
ln -s ../sites-available/demoapi.rhobot.net
ln -s ../sites-available/demoadmin.rhobot.net

apt install net-tools

ifconfig

You should see something like this

inet 74.91.21.202  netmask 255.255.255.248  broadcast 74.91.21.207

Select the "inet" value from the output

go to https://cloud.digitalocean.com/networking/domains and select "rhobot.net" Add a DNS entry for demoapi to the "inet" address from above Add a DNS entry for demoadmin to the "inet" address from above Add a DNS entry for demo to the "inet" address from above

su - rchain -c "git clone http://github.com/rchain-community/liquid-democracy"
su - rchain -c "mkdir ~/liquid-democracy/dist"
certbot certonly -d demoapi.rhobot.net
   Select (1)
certbot certonly -d demoadmin.rhobot.net
   Select (1)

wait until DNS updates (use dig to verify)

certbot --nginx

service nginx start

apt install git
apt install snap
apt install snapd
snap install node --classic

su - rchain

IMPORTANT!!!! follow instructions in https://docs.google.com/document/d/1V5k9tDjztEVDYiXJG1-Hpb0rNtVcV22GrsdXb0pDUx8/edit#heading=h.tzhor7ydmx13 EXCEPT FOR "npm start" at the end.

npx webpack-dev-server --host demo.rhobot.net --port 8888
Clone this wiki locally