Naviserver on ubuntu image using S6

Table of Contents
Login

About

This is NaviServer on ubuntu base docker image (version 22.04) using s6-overlay. To install the NaviServer I used code from Gustaf Neumann script install-ns.sh. The base image is oupfiz5/ubuntu-s6.

Naviserver-S6 is self-hosting at https://chiselapp.com/user/oupfiz5/repository/naviserver-s6.

If you are reading this on GitHub, then you are looking at a Git mirror of the self-hosting Naviserver-S6 repository. The purpose of that mirror is to test and exercise Fossil's ability to export a Git mirror and using Github CI/CD (Github Actions). Nobody much uses the GitHub mirror, except to verify that the mirror logic works. If you want to know more about Naviserver-S6, visit the official self-hosting site linked above.

Prerequisite

Tools

  1. *nix operation system
  2. Install Docker
  3. Install git (optional)
  4. Install fossil (optional)

Third party tools

They are using for testing and scanning:

  1. Bats
  2. Shellcheck
  3. Hadolynt
  4. Dockle
  5. Snyk - not necessarily
  6. Trivy - not necessarily

Installation

Download from dockerhub

docker pull oupfiz5/naviserver-s6:4.99.24

Build from chiselapp (fossil)

fossil clone https://chiselapp.com/user/oupfiz5/repository/naviserver-s6   naviserver-s6.fossil
mkdir naviserver-s6
cd naviserver-s6
fossil open ../naviserver-s6.fossil

Build image using multi steps (by means of docker from oupfiz5/tcl-build):

docker build -t oupfiz5/naviserver-s6:4.99.24 -f ./Dockerfile .

Build from github

git clone https://github.com/oupfiz5/naviserver-s6.git
cd naviserver-s6
docker build -t oupfiz5/naviserver-s6 .

Build image using multi steps (by means of docker from oupfiz5/tcl-build):

docker build -t oupfiz5/naviserver-s6:4.99.24 -f ./Dockerfile .

Configuration

Build arguments

Arguments Default Description
BUILD_DATE none Set build date for label
NS_VERSION 4.99.24 Define version for Naviserver-S6
NS_MODULE_VERSION 4.99.24 Define version for Naviserver-S6 modules
TCL_VERSION 8.6.13 Define version for tcl
TCLLIB_VERSION 1.1.20 Define version for tcllib
TDOM_VERSION 0.9.1 Define version for tdom
RL_JSON_VERSION= 0.12.2 Define version for rl_json
XOTCL_VERSION 2.4.0 Define version for xotcl

Example of build

docker build --no-cache \
        --build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
        --build-arg NS_VERSION='4.99.24' \
        --build-arg TCL_VERSION='8.6.13' \
        -t oupfiz5/naviserver-s6:4.99.24 \
        -f ../Dockerfile \
         ../.

Configuration options

General options

Option Default Description
TZ UTC Set timezone, example Europe/Moscow
HTTP 8090 Set http listen port, example 18090
Configuration file nsd-config.tcl Configuration file for Naviserver

Timezone

Set the timezone for the container, defaults to UTC. To set the timezone set the desired timezone with the variable TZ.

docker run -itd \
       --restart always \
       --name=naviserver-s6-s6 \
       --env 'TZ=Europe/Moscow' \
       -p 127.0.0.1:8090:8080 \
       oupfiz5/naviserver-s6:4.99.24

HTTP listen port

Set the http listen port for the container -p 127.0.0.1:18090:8080. In this case the Naviserver-S6 is accessible by URL http://localhost:18090.

docker run -itd \
       --restart always \
       --name=naviserver-s6 \
       -p 127.0.0.1:18090:8080 \
       oupfiz5/naviserver-s6:4.99.24

Configuration file

The default configuration file is rootfs/usr/local/ns/conf/nsd-config.tcl. For using own configuration file you can apply docker mount option:

  1. Create own configuration file with name nsd-config.tcl
  2. Put it to some directory (for example rootfs/usr/local/ns/conf/test)
  3. Mount the the directory from item 2 as /usr/local/ns/conf

    docker run -itd \
           --restart always \
           --name=naviserver  \
           -p 127.0.0.1:8090:8080 \
           --mount type=bind,src=$(pwd)/rootfs/usr/local/ns/conf/test,destination=/usr/local/ns/conf \
           oupfiz5/naviserver:4.99.24
    

Quickstart

Start Naviserver using CLI:

docker run -itd \
       --restart always \
       --name=naviserver-s6 \
       -p 127.0.0.1:8090:8080 \
       oupfiz5/naviserver-s6:4.99.24

Start Naviserver using script start.sh:

./start.sh

After start open the naviserver will be accessible by url http://localhost:8090

Continues integration

For build and push docker images using Github Actions workflow. Flow process is GitHub flow.

Troubleshooting

Log output

For debugging and maintenance purposes you may want access the output log. If you are using Docker version 1.3.0 or higher you can access a running containers shell by starting bash using docker interactive:

docker run -it --rm \
       --name=naviserver-s6 \
       -p 127.0.0.1:8090:8080 \
       oupfiz5/naviserver-s6:latest

Shell access

For debugging and maintenance purposes you may want access the containers shell. If you are using Docker version 1.3.0 or higher you can access a running containers shell by starting bash using docker exec:

docker exec -it naviserver-s6 /bin/bash