Tool to build and export to a ns8 server your module

I made a little wrapper to build and export by ssh to your server your module

on your dev laptop in the dev directory

build-podman webserver:latest <root@server>

on your server

[root@ns8loc3 ~]# podman load -i webserver_latest.tar 
Getting image source signatures
Copying blob d07fb73f482b done  
Copying config d54d7a45dd done  
Writing manifest to image destination
Storing signatures
Loaded image(s): ghcr.io/nethserver/webserver:latest

[root@ns8loc3 ~]#add-module ghcr.io/nethserver/webserver:latest 1

the code:

#!/bin/bash
IMAGE=$1
SERVER=$2
 # toto
if [[  -z $1 ]];then
    echo "#
# usage 
#

build the image podman and upload to the /root of VM:
    build-podman <image-name> <rootr@server>
    build-podman mariadb:latest <root@server>
once scp to the /root of the remote server use : 
    podman load -i image_tag.tar
list all images available to scp
    build-podman ls"
    exit 0
fi
if [[ $1 == 'ls' ]];then
    podman images
    exit 0
fi
if [[ -z $2 ]]; then 
    echo "We have not the user@domain.com"
    exit 0
fi
if [[ -f 'build-images.sh' ]];then
    bash +x build-images.sh
    file=${1//:/_}
    podman save $1 > $file.tar
    scp $file.tar $2:/root
else
    echo "We have not found build-images.sh script"
    exit 0
fi
7 Likes

hello @stephdl i think there is a slight Language barrier. i have read and re-read this post 5 times, each time i understand something different. could you kindly provide more context, or edit the descriptions with more details…
am sorry, am abit lost.

1 Like

build-images.sh is a script in the module project to build the images of the containers, but once built the images are local in your dev computer, you must push them to your test server.

  • Either by pushing them to ghcr.io manually and by downloading them from the test server
  • Or by pushing the image by ssh to the test server (it is what the script does)

There is another way that I do not use, it is to build and develop directly on the test server, in that case the images to install will be also local.

3 Likes

Really interesting! In some cases it is really useful to bypass a public image registry (e.g. ghcr.io). I’m sure @Stll0 will appreciate too!

You could actually just run a plain Bash pipe, with ssh to remote host, e.g.:

podman save ghcr.io/nethserver/webserver:latest | ssh user@remote.com podman load

Or, the other way

ssh dokuwiki4@localhost podman load < <(podman save ghcr.io/nethserver/traefik:latest)
5 Likes

now i understand… Thank you.

1 Like

The first tool I did in November when we were face to face :slight_smile:

I tested the pipe to send directly to the server but I missed something important :

I need the complete string ghcr.io/nethserver/webserver:latest for the add-module and I cannot get it in mind :slight_smile:

1 Like