g3w-suite/g3w-suite-docker

Https Configuration, Certbot don't work

bard0x opened this issue ยท 9 comments

Checklist

  • I've searched through the existing issues and this bug has never been reported before

Subject of the issue

Hi, I tried to configure the https following the guide that I found on the official documentation.
When I try to lunch this command ./run_certbot.sh the console show me this error message:

/var/www does not exist or is not a directory

The full command that runs is:

docker run -it --rm --name certbot \
  -v source=${WEBGIS_DOCKER_SHARED_VOLUME}/certs/letsencrypt,target=/etc/letsencrypt,type=bind \
  -v source=${WEBGIS_DOCKER_SHARED_VOLUME}/var/www/.well-known,target=/var/www/.well-known,type=bind \
  certbot/certbot -t certonly \
  --agree-tos --renew-by-default \
  --no-eff-email \
  --webroot -w /var/www \
  -d ${WEBGIS_PUBLIC_HOSTNAME}

and the script is stopped when the script try to execute --webroot -w /var/www \ command.

I tried to create the www directory inside the folder var but the issue is still alive,

Any suggestions?

Steps to reproduce

  1. Explained above

Environment

  • g3w-admin:3.5.x
  • g3w-client: 3.8.0-alpha.1
  • browser: chrome
  • operating system: ubuntu server 22

Link to your project

No response

Additional info

No response

Hi @bard0x,

the script is stopped when the script try to execute --webroot -w /var/www \ command.

Just to know, have you already tried to change that line as follows?

--webroot -w ${WEBGIS_DOCKER_SHARED_VOLUME}/var/www \

Taking a quick look at the current docker volumes, there should also be a folder with the same name:

# Letsencrypt certs
certbot:
image: certbot/certbot
volumes:
- ${WEBGIS_DOCKER_SHARED_VOLUME}/var/www/certbot:/var/www/certbot
- ${WEBGIS_DOCKER_SHARED_VOLUME}/certs/letsencrypt:/etc/letsencrypt

Greetings,
Raruto

Hi @bard0x,

the script is stopped when the script try to execute --webroot -w /var/www \ command.

Just to know, have you already tried to change that line as follows?

--webroot -w ${WEBGIS_DOCKER_SHARED_VOLUME}/var/www \

Taking a quick look at the current docker volumes, there should also be a folder with the same name:

# Letsencrypt certs
certbot:
image: certbot/certbot
volumes:
- ${WEBGIS_DOCKER_SHARED_VOLUME}/var/www/certbot:/var/www/certbot
- ${WEBGIS_DOCKER_SHARED_VOLUME}/certs/letsencrypt:/etc/letsencrypt

Greetings, Raruto

Yes, I tried to change the lines as above but don't work... I don't know how resolve this issue

--webroot -w ${WEBGIS_DOCKER_SHARED_VOLUME}/var/www

It is not right, because the declaration --webroot ids relative to interna docker volume.

@bard0x check in your permanent g3w-suite data and check if /var/www forlder is created.

--webroot -w ${WEBGIS_DOCKER_SHARED_VOLUME}/var/www

It is not right, because the declaration --webroot ids relative to interna docker volume.

@bard0x check in your permanent g3w-suite data and check if /var/www forlder is created.

Hi,

image

I have the folder var/www in my shared-volume data but the error occurs.

@bard0x try with sudo:

sudo ./run_certbot.sh

@bard0x try with sudo:

sudo ./run_certbot.sh

Hi,

Unfortunately every my operations are executed with sudo

image

check in your permanent g3w-suite data and check if /var/www forlder is created.

@bard0x Did you also check that those folders exist inside the docker container?

Just in case, here are the steps to follow to open a shell terminal for your container:

# 0 - open a new terminal session in your remote host (ie. ubuntu server)

# 1 - find your docker container ("name" or "id")
docker ps

# 2 - start interactive shell within your docker container
docker exec -it container-name-or-id sh

# 3 - do any further checks inside your docker container
# ls /var/www
# ...

Just to be sure, please also attach your current .env and docker-compose.yml configuration files.


@wlorenzetti ๐Ÿ˜‚

--webroot -w ${WEBGIS_DOCKER_SHARED_VOLUME}/var/www

- ${WEBGIS_DOCKER_SHARED_VOLUME}/var/www/certbot:/var/www/certbot
- ${WEBGIS_DOCKER_SHARED_VOLUME}/certs/letsencrypt:/etc/letsencrypt

It is not right, because the declaration --webroot ids relative to interna docker volume.

You are right ๐Ÿ‘‰, I was just looking ๐Ÿ‘€ at the left side ๐Ÿ‘ˆ,
those double colons are so damn hidden in the ๐Ÿ”Ž docker-compose.yml file...

check in your permanent g3w-suite data and check if /var/www forlder is created.

@bard0x Did you also check that those folders exist inside the docker container?

Just in case, here are the steps to follow to open a shell terminal for your container:

# 0 - open a new terminal session in your remote host (ie. ubuntu server)

# 1 - find your  docker container ("name" or "id")
docker ps

# 2 - start interactive shell within your  docker container
docker exec -it container-name-or-id sh

# 3 - do any further checks inside your docker container
# ls /var/www
# ...

Just to be sure, please also attach your current .env and docker-compose.yml configuration files.

@wlorenzetti ๐Ÿ˜‚

--webroot -w ${WEBGIS_DOCKER_SHARED_VOLUME}/var/www

- ${WEBGIS_DOCKER_SHARED_VOLUME}/var/www/certbot:/var/www/certbot
- ${WEBGIS_DOCKER_SHARED_VOLUME}/certs/letsencrypt:/etc/letsencrypt

It is not right, because the declaration --webroot ids relative to interna docker volume.

You are right ๐Ÿ‘‰, I was just looking ๐Ÿ‘€ at the left side ๐Ÿ‘ˆ, those double colons are so damn hidden in the ๐Ÿ”Ž docker-compose.yml file...

Hi, I check and I have the folder var/www...

Sure, I attach my .env & docker-compose.yml
file.zip

Thank's in advance for the support

I found the solution:

I rewrited the script in this way:

docker run -it --rm --name certbot \
  -v source=${WEBGIS_DOCKER_SHARED_VOLUME}/certs/letsencrypt,target=/etc/letsencrypt,type=bind \
  -v source=${WEBGIS_DOCKER_SHARED_VOLUME}/var/www/.well-known,target=/var/www/.well-known,type=bind \
  certbot/certbot -t certonly \
  --agree-tos --renew-by-default \
  --no-eff-email \
  --webroot
  -w /var/www \
  -d ${WEBGIS_PUBLIC_HOSTNAME}

If -w /var/www is on the new line all working fine.

I close the issue, thank's again for your support