installation

Conzept installation (written for Ubuntu 2020.04 LTS)

OS setup

- Install Ubuntu 20.04 LTS

- Set the hostname:

sudo su
vi /etc/hostname
reboot now

- Install additional packages:

sudo su
apt update
apt install apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.4 libapache2-mod-php libapache2-mod-uwsgi php-fpm snapd nodejs npm sed jq

webserver setup

Install Certbot

snap install core; sudo snap refresh core
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot
certbot --apache
certbot renew --dry-run

setup Apache2 with PHP and HTTP/2

a2enmod proxy proxy_http headers expires proxy_fcgi setenvif && service apache2 restart
a2enconf php7.4-fpm && service apache2 restart
a2dismod php7.4 && service apache2 restart
a2dismod mpm_prefork && a2enmod mpm_event && service apache2 restart && service php7.4-fpm restart
cd /etc/apache2/sites-enabled/
wget -O 000-default-le-ssl.conf https://raw.githubusercontent.com/waldenn/conzept/master/000-default-le-ssl.conf.example

Change the YOUR_SERVER_NAME and YOUR_SERVER_HOST values:

vi 000-default-le-ssl.conf
a2enmod http2
apachectl configtest
service apache2 restart

Remove the default Apache-server HTML file:

rm /var/www/html/index.html

Node setup

exit
cd
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
logout

(then log in again, to reload the shell environment)

Install the node version manager (note: you can check for newer LTS vresions by running: nvm ls-remote):

nvm install v16.13.1
logout

(then log in again, to reload the shell environment)

sudo npm install -g minify minify-json clean-css-cli @swc/cli @swc/core webpack webpack-cli esbuild

Conzept setup

git clone https://github.com/waldenn/conzept.git
cd conzept
sudo su
cp -r * /var/www/html/
cp .htaccess /var/www/html/
chown -R www-data:www-data /var/www/html
chmod -R g+rw /var/www/html

Add yourself to the “www-data” group (so you can make edits as yourself):

usermod -a -G www-data YOUR_USER_ID
logout

(then log in again, to reload the shell environment)

cd /var/www/html/app/explore2
npm install
npm run build
  • OPTIONAL: edit the settings in “/etc/conzept/settings.conf” and run “npm run build” again
  • NOTE: any modifications to the CONZEPT_WEB_BASE also requires changing:
    • the Apache site config
    • the root .htaccess file
    • the root manifest.json file

Conzept services setup

sudo su

Create a services startup script (using the example below)

vi /etc/rc.local

Example:

#!/bin/sh -e

# read conzept settings
. /etc/conzept/settings.conf

# JSON CORS-proxy (with secret-API-key support, port 50001 on localhost only)
su conzept -s /bin/sh -c '$CONZEPT_SERVICES_DIR/json-proxy/bin/json-proxy -p 50001 -c $CONZEPT_SERVICES_DIR/json-proxy.json &'

# any-file CORS-proxy (port 1458 on localhpst only)
su conzept -s /bin/sh -c 'cd "$CONZEPT_SERVICES_DIR/allorigins" && npm start app.js &'

exit 0;

Make it executable:

chmod +x /etc/rc.local

Setup crontab for periodic commands:

crontab -e

Example:

# check every day at 10:30 if a certificate renewal is needed
30 10 * * * sudo certbot renew >> /tmp/certbot-cron.log > /dev/null 2>&1

# read conzept settings daily
0 5 * * * . /etc/conzept/settings.conf

# fetch conzept-cover-data for the previous month (we wait until the second day of the month, so the Wikipedia stats are available)
0 0 2 * * su - www-data -s /bin/sh -c cd $CONZEPT_WEB_DIR$CONZEPT_BASE_DIR/app/explore2/tools/ && sh ./get_previous_month_covers.sh

Manually fetch the initial covers once:

. /etc/conzept/settings.conf && sudo su - www-data -s /bin/sh -c "cd $CONZEPT_WEB_DIR$CONZEPT_BASE_DIR/app/explore2/tools/ && sh ./get_previous_month_covers.sh"

Startup the services by rebooting:

sudo reboot now

Conzept-extra setup (optional)

This setup part is only required if you want to build and modify certain NPM-build conzept apps (there are currently seven apps and one library in this repo).

git clone https://github.com/waldenn/conzept-extra.git
cd conzept-extra

You can now modify, build and deploy out-of-tree Conzept apps. Just “cd” into each directory and follow the build instructions. Then use the “npm run conzept-deploy” within each app directory, to insert the build-artifacts into the Conzept web directory.

TODO: read Conzept environment file and use these settings for the “conzept-deploy” action.