Skip to content

pixilab/net-blocks

Repository files navigation

IMPORTANT

While we attempt to keep the installation method described here up to date and working for the desired target audience and platform, this is not an official PIXILAB product.

If you need help setting up Blocks in the cloud, or on some other suitable server, we may be able to assist you for a fee. However, ongoing maintenance, security and backups will need to be managed by other means. Contact info@pixilab.se for more information.

Scripts for building a Blocks server

These scripts and files helps with installing PIXILAB Blocks on a VPS (Virtual Private Server) as well as some other "plain vanilla" server environments based on Debian 10/11 or similar operating systems (e.g. Ubuntu). It was initially devised for a Digital Ocean Debian droplet, but has been used successfully with other hosting providers including Microsoft Azure, Linode and Vultr.

The scripts and instructions presented here assume familiarity with VPSes in general, the concept of private/public keys, domain names, DNS entries and the linux terminal. Items within angle brackets shown below are placeholders, to be substituted with your own values/names as appropriate. Items in monospaced font are to be entered, one line at a time, at the server's command prompt. The initial installation is assumed to be done by the root user. If that user account is not available, an account that is member of the sudoers group must be used and you will need to prepend some commands with sudo.

Instructions

The installation is done in three separate steps.
Please inspect and make yourself familiar with the steps inside each script.

Step 1
Installs Blocks, OpenJDK (java runtime environment), Codemeter(for licensing) and some administrative tools. This step leaves you with a server listening on port 8080. Once done, http://ip-address-of-your-server:8080/edit will open Blocks' editor. If this is all you need no further action is required.
Install Blocks

Step 2
Installs and configure NGINX to act as a reverse proxy in front of Blocks, resulting in a server listening on port 80, with nginx serving static files, thereby offloading this duty from Blocks.
Once done, http://ip-address-of-your-server/edit will open Blocks' editor. Install NGINX

Step 3
Adds a domain name, an SSL certificates and makes NGINX listen on port 443. This enables encrypted https access to blocks. Once done, https://your-domain-name/edit will open Blocks' editor. Note that for this step to succeed, your server must be accessible from the internet on port 80 using your-domain-name.
Add your domain name

Set up a computer

Create a virtual server running Debian-based Linux. The installation scripts is tested on Ubuntu 22.04LTS minimized server version running in HyperV virtualisation environment. The script can also be used to configure a droplet with a 3rd party provider such as Digital Oscean or equivalent.

Install Blocks

Log in to the server using ssh as the root (or a sudoer) user.

ssh <username>@<ip-of-your-server>

Once logged in, run the following commands:

sudo apt update

sudo apt -y upgrade

sudo apt -y install git

git clone https://github.com/pixilab/net-blocks.git

Enter your credentials if requested.

cd net-blocks

chmod u+x *.sh

sudo ./install-blocks.sh

Make sure the script makes it all the way to "••• DONE!". If not, examine the output for errors and correct script and files as necessary to complete the installation.
If the output shown at the end of the script run does not include your Blocks license number, you must obtain a cloud license from PIXILAB.
The license is delivered as a file, which is then transferred to the server and imported to the license system.

To transfer a license file use scp in the terminal of the computer where you corrently keep the license file:

scp <your-local-file> <user>@<ip-of-your-server>:./net-blocks

In the terminal of the remote computer you shold now be able to see the copied file inside the net-blocks directory.

After successfully upload of the license file, run the import with this command from the directory where the file is uploaded:

cmu --import --file <filename>

Verify that the license is imported OK using the command cmu --list, which should now show your license number.
Set a password for the blocks user using the command:

passwd blocks

Enable the server, start now and on boot

Log out of the root account by enter this command:

exit

Log back in, now as the blocks user.

ssh blocks@<ip-of-your-server>

Enable and start Blocks

systemctl --user enable --now blocks

Verify blocks was started OK

systemctl --user status blocks

Looking for its status being Active: active (running)

Install NGINX

To install NGINX as reverse proxy in front of Blocks server, first exit any previous SSH session, then log in to the server using ssh as the root (or a sudoer) user.

ssh <username>@<ip-of-your-server>

Then run the install-nginx script:

sudo ./install-nginx.sh

Set up a domain name

Set up the domain name to be used, along with a SSL certificate (HTTPS) for your domain. This assumes that a DNS entry has been established, as mentioned above, pointing your domain name to your newly created server. It is recommend to run preflight test of the domain name for http-01 challenge (the we we identify us as having control over the webserver) over at https://letsdebug.net/ before running the script.

sudo ./add-domain.sh <blocks-server-domain-name>

Enter your email address and other preferences when prompted by the certbot.

Make sure the script makes it all the way to "••• Domain added."

Firewall

Depending on the final setup the firewall may need further configuration.
Please review the current firewall settings after the final step above to make sure it fits your needs and your organisations policies using this command:

sudo ufw status

Blocks default user

Finally, log into your new Blocks server with a browser using a URL as described in the installation steps above. User name admin, with the initial password pixi, and then change the admin user's password to your liking on the Manage page.

Some further details related to using nginx as a reverse proxy for Blocks can be found here:

https://pixilab.se/docs/blocks/server/nginx

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •