cmur2 / openvpn-status-web

Small Rack (Ruby) application serving OpenVPN status file
https://mycroba.se/mirror-redirect/openvpn-status-web
Apache License 2.0
13 stars 1 forks source link

Guide to install in docker #100

Closed 2003flo closed 1 year ago

2003flo commented 1 year ago

Hello,

I want to install this project in a Docker container. But it just does not want to work. What am I doing wrong?

This is how I proceeded: Started Portainer. Click on Images. Click on Build a new image. Gave an arbitrary name. Pasted the code from the readme ( https://github.com/cmur2/openvpn-status-web/blob/master/docs/Dockerfile ) into the web editor. Clicked Build the image. Portainer then told me the following output:

Step 1/5 : FROM alpine:3.16

 ---> bfe296a52501

Step 2/5 : EXPOSE 8081

 ---> Running in b01041d6932f

Removing intermediate container b01041d6932f

 ---> 938a103cb94c

Step 3/5 : ENV VERSION=3.4.0

 ---> Running in c154992b692e

Removing intermediate container c154992b692e

 ---> e2cd76ffb532

Step 4/5 : RUN apk --no-cache add openssl ca-certificates &&     apk --no-cache add ruby ruby-etc ruby-webrick &&     apk --no-cache add --virtual .build-deps ruby-dev build-base tzdata &&     gem install --no-document openvpn-status-web -v ${VERSION} &&     cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime &&     apk del .build-deps

 ---> Running in 26fbe89152ff

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz

(1/2) Installing ca-certificates (20220614-r0)

(2/2) Installing openssl (1.1.1t-r0)

Executing busybox-1.35.0-r17.trigger

Executing ca-certificates-20220614-r0.trigger

OK: 7 MiB in 16 packages

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz

(1/10) Installing gmp (6.2.1-r2)

(2/10) Installing libffi (3.4.2-r1)

(3/10) Installing ncurses-terminfo-base (6.3_p20220521-r0)

(4/10) Installing ncurses-libs (6.3_p20220521-r0)

(5/10) Installing readline (8.1.2-r0)

(6/10) Installing libucontext (1.2-r0)

(7/10) Installing yaml (0.2.5-r0)

(8/10) Installing ruby-libs (3.1.3-r0)

(9/10) Installing ruby (3.1.3-r0)

(10/10) Installing ruby-webrick (1.7.0-r1)

Executing busybox-1.35.0-r17.trigger

OK: 24 MiB in 26 packages

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz

fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz

(1/27) Upgrading musl (1.2.3-r1 -> 1.2.3-r2)

(2/27) Installing ruby-rdoc (3.1.3-r0)

(3/27) Installing libgcc (11.2.1_git20220219-r2)

(4/27) Installing libstdc++ (11.2.1_git20220219-r2)

(5/27) Installing libgmpxx (6.2.1-r2)

(6/27) Installing pkgconf (1.8.1-r0)

(7/27) Installing gmp-dev (6.2.1-r2)

(8/27) Installing libucontext-dev (1.2-r0)

(9/27) Installing ruby-dev (3.1.3-r0)

(10/27) Installing binutils (2.38-r3)

(11/27) Installing libmagic (5.41-r0)

(12/27) Installing file (5.41-r0)

(13/27) Installing libgomp (11.2.1_git20220219-r2)

(14/27) Installing libatomic (11.2.1_git20220219-r2)

(15/27) Installing isl22 (0.22-r0)

(16/27) Installing mpfr4 (4.1.0-r0)

(17/27) Installing mpc1 (1.2.1-r0)

(18/27) Installing gcc (11.2.1_git20220219-r2)

(19/27) Installing musl-dev (1.2.3-r2)

(20/27) Installing libc-dev (0.7.2-r3)

(21/27) Installing g++ (11.2.1_git20220219-r2)

(22/27) Installing make (4.3-r0)

(23/27) Installing fortify-headers (1.1-r1)

(24/27) Installing patch (2.7.6-r7)

(25/27) Installing build-base (0.5-r3)

(26/27) Installing tzdata (2022f-r1)

(27/27) Installing .build-deps (20230215.112714)

Executing busybox-1.35.0-r17.trigger

OK: 214 MiB in 52 packages

Successfully installed webrick-1.8.1
Successfully installed rack-3.0.4.1
Successfully installed rackup-2.1.0
Building native extensions. This could take a while...

Successfully installed hitimes-1.3.1
Building native extensions. This could take a while...

This gem has been deprecated and merged into Concurrent Ruby (http://concurrent-ruby.com).
Successfully installed atomic-1.1.101
Successfully installed avl_tree-1.2.1
Successfully installed metriks-0.9.9.8
Successfully installed openvpn-status-web-3.4.0
8 gems installed

WARNING: 

Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.16/main: No such file or directory

WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.16/community: No such file or directory

(1/26) Purging .build-deps (20230215.112714)
(2/26) Purging ruby-dev (3.1.3-r0)

(3/26) Purging ruby-rdoc (3.1.3-r0)

(4/26) Purging gmp-dev (6.2.1-r2)

(5/26) Purging libgmpxx (6.2.1-r2)
(6/26) Purging libucontext-dev (1.2-r0)

(7/26) Purging build-base (0.5-r3)
(8/26) Purging file (5.41-r0)
(9/26) Purging g++ (11.2.1_git20220219-r2)

(10/26) Purging gcc (11.2.1_git20220219-r2)

(11/26) Purging binutils (2.38-r3)

(12/26) Purging libatomic (11.2.1_git20220219-r2)
(13/26) Purging libgomp (11.2.1_git20220219-r2)
(14/26) Purging libstdc++ (11.2.1_git20220219-r2)

(15/26) Purging make (4.3-r0)
(16/26) Purging libc-dev (0.7.2-r3)
(17/26) Purging musl-dev (1.2.3-r2)

(18/26) Purging fortify-headers (1.1-r1)
(19/26) Purging patch (2.7.6-r7)
(20/26) Purging tzdata (2022f-r1)

(21/26) Purging libgcc (11.2.1_git20220219-r2)
(22/26) Purging pkgconf (1.8.1-r0)
(23/26) Purging libmagic (5.41-r0)

(24/26) Purging isl22 (0.22-r0)
(25/26) Purging mpc1 (1.2.1-r0)
(26/26) Purging mpfr4 (4.1.0-r0)

Executing busybox-1.35.0-r17.trigger

OK: 24 MiB in 26 packages

Removing intermediate container 26fbe89152ff

 ---> b2ab238b9594

Step 5/5 : ENTRYPOINT ["openvpn-status-web", "/etc/openvpn-status-web/config.yml"]

 ---> Running in 4a363c4597d8

Removing intermediate container 4a363c4597d8

 ---> 2527818aa81a

Successfully built 2527818aa81a

Successfully tagged ovpnweb:latest

Now I chose Containers in Portainer. Click "add Container". Typed in the image's name. Gave another arbitrary name to the container. And clicked deploy. After that the container gets deployed but imediatley stops. Log says:

Config file not found!

I am wondering about this, as I put the yml file in /etc/openvpn-status-web/config.yml

cmur2 commented 1 year ago

What you wrote looks like the correct approach so far.

I am wondering about this, as I put the yml file in /etc/openvpn-status-web/config.yml

How did you do this exactly? It seems to be the crucial point.

2003flo commented 1 year ago

I created that file new. On the Host.

Am 15.02.2023 um 22:58 schrieb Christian Nicolai @.***>:

 What you wrote looks like the correct approach so far.

I am wondering about this, as I put the yml file in /etc/openvpn-status-web/config.yml

How did you do this exactly? It seems to be the crucial point.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

cmur2 commented 1 year ago

I created that file new. On the Host.

Then please read up on how Portainer and the container technology you use works. Containers are isolated from the host and do not have (by default) access to e.g. files or other resources on the host. Just because /etc/openvpn-status-web/config.yml exists on the host, it does not exist in the container.

There is extra effort needed to make that work, maybe documentation like https://docs.portainer.io/user/docker/volumes/add can help

2003flo commented 1 year ago

Cant you add to the readme howto and where to put that config?

Am 16.02.2023 um 10:04 schrieb Christian Nicolai @.***>:

 I created that file new. On the Host.

Then please read up on how Portainer and the container technology you use works. Containers are isolated from the host and do not have (by default) access to e.g. files or other resources on the host. Just because /etc/openvpn-status-web/config.yml exists on the host, it does not exist in the container.

There is extra effort needed to make that work, maybe documentation like https://docs.portainer.io/user/docker/volumes/add can help

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

cmur2 commented 1 year ago

Since I'm using https://docs.docker.com/compose/ I added an example for that to https://github.com/cmur2/openvpn-status-web/blob/master/README.md#startup

I don't know if or how that can be done with Portainer, sorry.