Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues getting letsencrypt section up and running. #4144

Closed
thisaccountname opened this issue Jun 15, 2020 · 5 comments
Closed

Issues getting letsencrypt section up and running. #4144

thisaccountname opened this issue Jun 15, 2020 · 5 comments
Labels

Comments

@thisaccountname
Copy link

Describe the bug
Trying to get Monica with letsencrypt up and running via docker compose, monica_proxy_1 and monica_letsencrypt-companion are failing.

Screenshots
image

Which version are you using:
I am doing this on Docker for Windows, as you can see in the screenshot I am attempting to use a different port for my webui as the default is already taken.

I have tried various settings for the port mapping, for both mysql and the webui.

No matter my settings I run into an error saying:

app_1                    | Waiting for mysql-monica:33061...

Here's my docker compose:


version: "3.4"

services:
  app:
    image: monicahq/monicahq:fpm
    env_file: .env
    volumes:
      - C:\DockerStuff\Monica\data
    restart: always
    depends_on:
      - mysql-monica
      - redis
    ports:
      - 8018:80
    environment:
      - PUID=1030
      - PGID=101
      - TZ="America/Los_Angeles"
  mysql-monica:
    image: mysql:5.7
    container_name: mysql-monica
    environment:
      - MYSQL_ROOT_PASSWORD=this_is_my_password
      - MYSQL_DATABASE=monica
      - MYSQL_USER=monica
      - MYSQL_PASSWORD=this_is_my_password
      - PUID=1030
      - PGID=101
      - TZ="America/Los_Angeles"
    volumes:
      - C:\DockerStuff\Monica\mysql-monica
      
    ports:
      - 33061:3306
    restart: always

  redis:
    image: redis:alpine
    restart: always

  cron:
    image: monicahq/monicahq:fpm
    env_file: .env
    restart: always
    volumes:
      - C:\DockerStuff\Monica\data
    command: cron.sh
    depends_on:
      - mysql-monica
      - redis

  queue:
    image: monicahq/monicahq:fpm
    env_file: .env
    restart: always
    volumes:
      - C:\DockerStuff\Monica\data
    command: queue.sh
    depends_on:
      - mysql-monica
      - redis

  web:
    build: ./web
    restart: always
    environment:
      - VIRTUAL_HOST=192.168.0.182
      - LETSENCRYPT_HOST=192.168.0.182
      - LETSENCRYPT_EMAIL=myemail@gmail.com
    volumes:
      - C:\DockerStuff\Monica\data
    depends_on:
      - app
    networks:
      - proxy-tier
      - default

  proxy:
    build: ./proxy
    restart: always
    ports:
      - 8012:80
      - 4434:443
    labels:
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
    volumes:
      - C:\DockerStuff\Monica\data\nginx\certs
      - C:\DockerStuff\Monica\data\nginx\certs\vhost.d
      - C:\DockerStuff\Monica\data\nginx\html
      - C:\DockerStuff\Monica\data\socks\docker.sock
    networks:
      - proxy-tier

  letsencrypt-companion:
    image: jrcs/letsencrypt-nginx-proxy-companion
    restart: always
    volumes:
      - C:\DockerStuff\Monica\data\nginx\certs
      - C:\DockerStuff\Monica\data\nginx\certs\vhost.d
      - C:\DockerStuff\Monica\data\nginx\html
      - C:\DockerStuff\Monica\data\socks\docker.sock
    networks:
      - proxy-tier
    depends_on:
      - proxy

volumes:
  data:
    name: data
  mysql:
    name: mysql
  certs:
    name: certs
  vhost.d:
    name: vhost.d
  html:
    name: html

networks:
  proxy-tier:

and my .env:

# The URL of your application.
APP_URL=http://192.168.0.182

# Database information
# To keep this information secure, we urge you to change the default password
DB_CONNECTION=mysql
DB_HOST=mysql-monica
DB_PORT=33061
DB_DATABASE=monica
DB_USERNAME=monica
DB_PASSWORD=this_is_my_password
DB_PREFIX=

This is my current and closest iteration, I know the fact that it's a windows attempt complicates things with paths, but I am hoping someone can offer some advice.

Thank you.

@thisaccountname
Copy link
Author

thisaccountname commented Jun 15, 2020

Okay, update

My compose file now looks like this:

version: "3.4"

services:
  app:
    image: monicahq/monicahq:fpm
    env_file: .env
    volumes:
      - .\Monica\storage
    restart: always
    depends_on:
      - db
      - redis

  db:
    image: mysql:5.7
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=true
      - MYSQL_DATABASE=monica
      - MYSQL_USER=homestead
      - MYSQL_PASSWORD=my_password
    volumes:
      - .\lib\mysql
    ports:
      - 33061:3306
    restart: always

  redis:
    image: redis:alpine
    restart: always

  cron:
    image: monicahq/monicahq:fpm
    env_file: .env
    restart: always
    volumes:
      - .\Monica\storage
    command: cron.sh
    depends_on:
      - db
      - redis

  queue:
    image: monicahq/monicahq:fpm
    env_file: .env
    restart: always
    volumes:
      - .\Monica\storage
    command: queue.sh
    depends_on:
      - db
      - redis

  web:
    build: .\web
    restart: always
    environment:
      - VIRTUAL_HOST=monica.b.box
      - LETSENCRYPT_HOST=monica_lets.b.box
      - LETSENCRYPT_EMAIL=myemail@gmail.com
    volumes:
      - .\Monica\storage
    depends_on:
      - app
    networks:
      - proxy-tier
      - default



  proxy:
    build: .\proxy
    restart: always
    ports:
      - 8017:80
      - 4432:443
    labels:
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
    volumes:
      - .\nginx\certs
      - .\nginx\vhost.d
      - .\nginx\html
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - proxy-tier

  letsencrypt-companion:
    image: jrcs/letsencrypt-nginx-proxy-companion
    restart: always
    volumes:
      - certs:/etc/nginx/certs
      - vhost.d:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - proxy-tier
    depends_on:
      - proxy

volumes:
  data:
    name: data
  mysql:
    name: mysql
  certs:
    name: certs
  vhost.d:
    name: vhost.d
  html:
    name: html

networks:
  proxy-tier:

my .env now looks like:

# The URL of your application.
APP_URL=https://b.box/monica

# Database information
# To keep this information secure, we urge you to change the default password
DB_CONNECTION=mysql
DB_HOST=192.168.0.182
DB_PORT=33061
DB_DATABASE=monica
DB_USERNAME=homestead
DB_PASSWORD=my_password
DB_PREFIX= 

and my containers all show as up and running now:

image

But there's nothing I can enter to see a webui still. Any guesses?

@asbiin
Copy link
Member

asbiin commented Jun 15, 2020

There are some odds in your docker-compose file.
See our reference here: https://github.com/monicahq/monica/blob/master/scripts/docker/.examples/nginx-proxy/docker-compose.yml

  • VIRTUAL_HOST and LETSENCRYPT_HOST must have the same value. It must be the real domain
  • proxy and letsencrypt-companion container must have the same mounted volumes
  • DB_HOST should be set with the name of the container, like db, and not with an ip address.
  • if you want to use redis, you have to set REDIS_HOST=redis, CACHE_DRIVER=redis and QUEUE_CONNECTION=redis in your .env file

Why using a different port number for mysql?

@thisaccountname
Copy link
Author

@asbiin

Alright lots of changes made here, decided to give up on letsencrypt. I was trying to use a duckdns address, then tried an address I had on namecheap. Neither of them wanted to pass a DNS test from letsencrypt. Honestly just want to see Monica with my own eyes at this point.

Here's my compose file:

version: "3.4"

services:
  app:
    image: monicahq/monicahq:fpm
    env_file: .env
    volumes:
      - data:/var/www/monica/storage
    restart: always
    depends_on:
      - db1
      - redis

  db1:
    image: mysql:5.7

    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=true
      - MYSQL_DATABASE=monicaSelf
      - MYSQL_USER=homestead
      - MYSQL_PASSWORD=password_here
    volumes:
      - db1:/var/lib/mysql
    restart: always


  redis:
    image: redis:alpine
    restart: always

  cron:
    image: monicahq/monicahq:fpm
    env_file: .env
    restart: always
    volumes:
      - data:/var/www/monica/storage
    command: cron.sh
    depends_on:
      - db1
      - redis

  queue:
    image: monicahq/monicahq:fpm
    env_file: .env
    restart: always
    volumes:
      - data:/var/www/monica/storage
    command: queue.sh
    depends_on:
      - db1
      - redis

  web:
    build: ./web
    restart: always
    environment:
      - VIRTUAL_HOST=monica.b.box 
#'b.box' resolves to = my local ip address, is this where my headache is coming from?
    volumes:
      - data:/var/www/monica/storage:ro
    depends_on:
      - app
    networks:
      - proxy-tier
      - default

  proxy:
    build: ./proxy
    restart: always
    ports:
      - 80:80
      - 443:443
    volumes:
      - certs:/etc/nginx/certs:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - proxy-tier
    depends_on:
      - omgwtfssl

  omgwtfssl:
    image: paulczar/omgwtfssl
    restart: "no"
    volumes:
      - certs:/certs
    environment:
      - SSL_SUBJECT=monica.b.box
      - CA_SUBJECT=myemail@gmail.com
      - SSL_KEY=/certs/monica.b.box.key
      - SSL_CSR=/certs/monica.b.box.csr
      - SSL_CERT=/certs/monica.b.box.crt
    networks:
      - proxy-tier

volumes:
  data:
    name: data
  db1:
    name: db1
  certs:
    name: certs

networks:
  proxy-tier:

Here's my new .env (thank you for pointers on db host btw):

APP_ENV=production
APP_URL=monica.b.box
APP_TRUSTED_PROXIES=*
COMPOSE_CONVERT_WINDOWS_PATHS=1

DB_HOST=db1
DB_PORT=3306
DB_DATABASE=monicaSelf
DB_USERNAME=homestead
DB_PASSWORD=password_here


REDIS_HOST=redis
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis

I am getting all green boxes now, going to monica.b.box gets me nothing, going to b.box gets me a 503 Service Temporarily Unavailable
nginx/1.17.6

@asbiin asbiin added the support label Dec 19, 2020
@asbiin
Copy link
Member

asbiin commented Jan 3, 2021

I hope you managed how to run this image now

@asbiin asbiin closed this as completed Jan 3, 2021
@github-actions
Copy link

github-actions bot commented Jan 4, 2022

This issue has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants