Skip to content

Installation

Romke van Dijk edited this page Jun 17, 2023 · 40 revisions

Setup

Docker Setup

With the release of version 0.14.0 the default installation method for Hashtopolis has been changed from using the bundled version to using Docker images. The official Docker images are published at: https://hub.docker.com/u/hashtopolis

Requirements:

Using Docker hub

  1. Create a folder mkdir hashtopolis and change into the folder cd hashtopolis
  2. wget https://raw.githubusercontent.com/hashtopolis/server/master/docker-compose.yml
  3. wget https://raw.githubusercontent.com/hashtopolis/server/master/env.example -O .env
  4. Edit the .env file and change the settings to your likings nano .env
    1. Optional: if you want to test the new API and new UI, set the HASHTOPOLIS_APIV2_ENABLE to 1 inside the .env file. NOTE: The APIv2 and UIv2 are a technical preview. Currently when enable everyone through the new API will be fully admin!
  5. docker compose up
  6. Access the Hashtopolis UI through: http://127.0.0.1:8080 and the new Hashtopolis UI through http://127.0.0.1:4200 using the credentials (user=admin, password=hashtopolis)

Build it yourself

When using WSL2, please enable Docker Compose V2 and WSL Integration in Dokter Desktop

  1. Clone the web-ui repo: git clone https://github.com/hashtopolis/web-ui.git
  2. cd web-ui
  3. Build the web-ui repo and tag it docker build . -t hashtopolis-web-ui:latest
  4. Move one directory back cd ..
  5. Clone the server repo: git clone https://github.com/hashtopolis/server.git
  6. cd server
  7. Optional: Check output of file docker-entrypoint.sh if it mentions 'with CRLF line terminators' your git checkout is converting line-ending on checkout, which is causing issues for files within the docker container. This is common behaviour for example within Windows (WSL) instances, to fix:
    1. git config core.eol lf
    2. git config core.autocrlf input
    3. git rm -rf --cached .
    4. git reset --hard HEAD
    5. Check output of file docker-entrypoint.sh is should output: 'docker-entrypoint.sh: Bourne-Again shell script, ASCII text executable'
  8. Copy the env.example and edit the values to your likings cp env.example .env
    1. Optional: if you want to test the new API and new UI, set the HASHTOPOLIS_APIV2_ENABLE to 1 inside the .env file. NOTE: The APIv2 and UIv2 are a technical preview. Currently when enable everyone through the new API will be fully admin!
  9. Build the server docker image docker compose build
  10. Start everything docker compose up
  11. Access the Hashtopolis UI through: http://127.0.0.1:8080 and the new Hashtopolis UI through http://127.0.0.1:4200 using the credentials (user=admin, password=hashtopolis)

Without Docker

This method is not supported and only here to give some guidance. It recommended way to deploy Hashtopolis from version 0.14.0 is to use Docker.

OS Ubuntu 22.04

Install the requirements

sudo apt update && sudo apt upgrade
sudo apt install mysql-server
sudo apt install apache2
sudo apt install libapache2-mod-php php-mysql php php-gd php-pear php-curl
sudo apt install git unzip curl
sudo a2enmod rewrite

Secure the mysql installation by running mysql_secure_installation

Setup database

sudo mysql 
CREATE DATABASE hashtopolis;
CREATE USER 'hashtopolis'@'localhost' IDENTIFIED BY '<PASSWORD HERE>';
GRANT ALL PRIVILEGES ON hashtopolis.* TO 'hashtopolis'@'localhost' WITH GRANT OPTION;
exit

Configuration

You may want to increase these PHP parameters to accommodate your intended usage.

sudo nano /etc/php/8.1/apache2/php.ini
...
memory_limit = ...
upload_max_filesize = ...
post_max_size = ...
...

In order to leverage the usage of TCP sessions in the python client, the timeout of the server needs to be set to something higher than your status update time (5s by default) (in Apache2 the timeout is 5s by default). For Apache2 you need to add/modify following setting:

sudo nano /etc/apache2/apache2.conf
...
KeepAliveTimeout 10
...

Install Hashtopolis

Download the release bundle from: https://github.com/hashtopolis/server/releases

wget https://github.com/hashtopolis/server/archive/refs/tags/v0.14.0.zip -O server-0.14.0.zip

Unzip the release zip to and change the ownership

sudo unzip server-x.x.x.zip
sudo mv server-x.x.x/src/ /var/www/hashtopolis-backend
sudo chown -R www-data:www-data /var/www/hashtopolis-backend

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo composer install --working-dir=/var/www/hashtopolis-backend

Point your Apache config towards your Hashtopolis instance

sudo nano /etc/apache2/sites-enabled/000-default.conf
...
    DocumentRoot /var/www/hashtopolis-backend/src
...

Set the database password in a config file

sudo nano /var/www/hashtopolis-backend/src/inc/conf.php
<?php
//START CONFIG
$CONN['user'] = 'hashtopolis';
$CONN['pass'] = 'hashtopolis';
$CONN['server'] = 'localhost';
$CONN['db'] = 'hashtopolis';
$CONN['port'] = '3306';

$DIRECTORIES = [
  "files" => "/var/www/hashtopolis-backend/files/",
  "import" => "/var/www/hashtopolis-backend/import/",
  "log" => "/var/www/hashtopolis-backend/log/",
  "config" => "/var/www/hashtopolis-backend/config/",
];
//END CONFIG

Create the Hashtopolis user

sudo php -f /var/www/hashtopolis-backend/src/inc/load.php

New Angular web-ui

The new web-ui is currently in preview! You need to manually enable it by setting an environment variable.

Insite you apache2 virtualhost config

nano /etc/apache2/sites-enabled/000-default.conf

<VirtualHost :80>
   ...
   SetEnv HASHTOPOLIS_APIV2_ENABLE 1
   ...
</VirtualHost>

Download the web-ui release via https://github.com/hashtopolis/web-ui/releases Unzip the release and open a terminal inside the web-ui folder

unzip web-ui-x.x.x.zip
cd web-ui
# Install nodejs, see https://github.com/nodesource/distributions#debinstall
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# Install Angular and the dependencies
npm install

# Edit the application file to point it to the hashtopolis server:
sed -i 's/localhost:8080/<ip of hashtopolis backend server>:8080/g' src/config/default/app/main.ts

# Build a package to be used with apache
npm run build
sudo mkdir -p /var/www/hashtopolis-web-ui/
sudo cp -r dist/* /var/www/hashtopolis-web-ui/
sudo chown -R www-data:www-data /var/www/hashtopolis-web-ui/

sudo vi /etc/apache2/site-enabled/000-default.conf
# Replace the file with roughly the following contents
<VirtualHost *:8080>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/hashtopolis-server/src

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Directory "/var/www/hashtopolis-server/src/">
            AllowOverride All
        </Directory>
</VirtualHost>

<VirtualHost *:4200>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/hashtopolis-web-ui

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
sudo vi /etc/apache2/ports.conf
# Replace the file with roughly the following contents:
Listen 8080
Listen 4200
sudo service apache2 restart

Video Tutorial (Thanks to winxp5421)

This is for Ubuntu 16.10 and for Hashtopolis release 0.13.1

Hashtopolis Install video