g3w-suite / g3w-suite-docker

Run G3W-SUITE stack with docker-compose
https://g3w-suite.readthedocs.io/en/latest/docker.html
32 stars 34 forks source link

Https Configuration, Certbot don't work #91

Closed bard0x closed 1 year ago

bard0x commented 1 year ago

Checklist

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

Link to your project

No response

Additional info

No response

Raruto commented 1 year ago

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:

https://github.com/g3w-suite/g3w-suite-docker/blob/9475d8260979309e9e583a951306326b016247ea/docker-compose.yml#L96-L101

Greetings, Raruto

bard0x commented 1 year ago

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:

https://github.com/g3w-suite/g3w-suite-docker/blob/9475d8260979309e9e583a951306326b016247ea/docker-compose.yml#L96-L101

Greetings, Raruto

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

wlorenzetti commented 1 year ago

--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.

bard0x commented 1 year ago

--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.

wlorenzetti commented 1 year ago

@bard0x try with sudo:

sudo ./run_certbot.sh
bard0x commented 1 year ago

@bard0x try with sudo:

sudo ./run_certbot.sh

Hi,

Unfortunately every my operations are executed with sudo

image

Raruto commented 1 year ago

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

https://github.com/g3w-suite/g3w-suite-docker/blob/9475d8260979309e9e583a951306326b016247ea/docker-compose.yml#L100-L101

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...

bard0x commented 1 year ago

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

https://github.com/g3w-suite/g3w-suite-docker/blob/9475d8260979309e9e583a951306326b016247ea/docker-compose.yml#L100-L101

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

bard0x commented 1 year ago

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