Naviserver on ubuntu image using S6

Table of Contents
Login

About

This is Naviserver on ubuntu base docker image (version 20.04) using s6-overlay. For install the Naviserver was used some 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.

Installation

Download from dockerhub

docker pull oupfiz5/naviserver-s6:latest
docker pull oupfiz5/naviserver-s6:4.99.20

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 one step (install-ns.sh from Gustaf Neumann):

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

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

docker build -t oupfiz5/naviserver-s6 -f ./Dockerfile.multisteps .

In both cases will get naviserver docker image. But mulit steps image will have smaller size.

Build from github

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

One step build image (using install-ns.sh from Gustaf Neumann):

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

Multi steps build image (using build docker oupfiz5/tcl-build):

docker build -t oupfiz5/naviserver-s6 -f ./Dockerfile.multisteps .

In both cases will get naviserver docker image. But mulit steps image will have smaller size.

Contfiguration

Build arguments

Arguments Default Description
BUILD_DATE none Set build date for label
NS_VERSION 4.99.20 Define version for Naviserver
NS_MODULE_VERSION 4.99.20 Define version for Naviserver modules
TCL_VERSION 8.6.11 Define version for tcl
TCLLIB_VERSION 1.1.20 Define version for tcllib
TDOM_VERSION 0.9.1 Define version for tdom
THREAD_VERSION 2.8.6 Define version for thread
XOTCL_VERSION 2.3.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.20 \
        --build-arg TCL_VERSION=8.6.11 \
        -t oupfiz5/naviserver-s6:4.99.20 \
        -f ../Dockerfile.multisteps \
         ../.

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 \
       --env 'TZ=Europe/Moscow' \
       -p 127.0.0.1:8090:8080 \
       oupfiz5/naviserver-s6:latest

HTTP listen port

Set the http listen port for the container -p 127.0.0.1:18090:8080. In this case the Naviserver 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:latest

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-s6  \
           -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-s6:latest
    

Quickstart

Start Naviserver using CLI:

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

Start Naviserver using script start.sh:

./start.sh

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

CI/CD

For build and push docker images we use Github Actions workflow.

Maintenance

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