chiefonboarding / ChiefOnboarding

Free and open-source employee onboarding platform. Onboard new hires through Slack or the web portal.
https://chiefonboarding.com
GNU Affero General Public License v3.0
656 stars 121 forks source link

Welcome to Caddy! #493

Closed MuratDoganer closed 2 months ago

MuratDoganer commented 2 months ago

Hey,

Setting up a new instance for testing via DigitalOcean on a droplet. I've followed the docs for a Docker deployment, all has gone well, except when I go to the domain, I am greeted with a Congratulations page for Caddy, and instructions on how to resolve it.

Except none of the files are where it says they are 😄 I am having some trouble getting it to connect to the app, its weird because my other DigitalOcean deployment has been working flawlessly since 2021!

Any advice?

GDay commented 2 months ago

Except none of the files are where it says they are

What files? Can you locate the Caddyfile? That should probably be your starting point in fixing this.

its weird because my other DigitalOcean deployment has been working flawlessly since 2021!

You have been using ChiefOnboarding since 2021?

MuratDoganer commented 2 months ago

Except none of the files are where it says they are

What files? Can you locate the Caddyfile? That should probably be your starting point in fixing this.

its weird because my other DigitalOcean deployment has been working flawlessly since 2021!

You have been using ChiefOnboarding since 2021?

I've made the caddyfile in the same folder as my docker compose file, I've made sure the domain is the one I'm connecting too!

It's asking me to edit the caddyfile in /etc/caddy and then make changes in /var/www

Which of course this doesn't use since it's containerised!

And yes! Since August or July 2021 :) pre 2.0 days! Many of my features requests made it into 2.0 haha

GDay commented 2 months ago

That sounds like a misconfigured Caddyfile (or not linked for some reason).

Are you using this docker file? https://docs.chiefonboarding.com/deployment/docker.html#caddy-based-deployment

This should link your local file to the one in the container:

- $PWD/Caddyfile:/etc/caddy/Caddyfile
- $PWD/site:/srv

Also tried doing docker compose down and then doing docker compose up -d again? (the old school "did you try to turn it off and on again?", haha).

And yes! Since August or July 2021 :) pre 2.0 days! Many of my features requests made it into 2.0 haha

Oh yes, your name already sounded familiar, now I remember again. Haven't heard from you in a while! Cool to hear that you are still using it!!

MuratDoganer commented 2 months ago

That sounds like a misconfigured Caddyfile (or not linked for some reason).

Are you using this docker file? https://docs.chiefonboarding.com/deployment/docker.html#caddy-based-deployment

This should link your local file to the one in the container:

- $PWD/Caddyfile:/etc/caddy/Caddyfile
- $PWD/site:/srv

Also tried doing docker compose down and then doing docker compose up -d again? (the old school "did you try to turn it off and on again?", haha).

Yup it looks just like that, I did a quick server restart and now suddenly I am getting this error:

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/Caddyfile" to rootfs at "/etc/caddy/Caddyfile": mount /Caddyfile:/etc/caddy/Caddyfile (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

Doing docker compose down / up, seems to alternate between the two issues

And yes! Since August or July 2021 :) pre 2.0 days! Many of my features requests made it into 2.0 haha

Oh yes, your name already sounded familiar, now I remember again. Haven't heard from you in a while! Cool to hear that you are still using it!!

And I absolutely love it, will continue to use for another decade :p

MuratDoganer commented 2 months ago

Here's a copy of my docker compose and caddy file just be doubly sure:

version: '3'

services:
  db:
    image: postgres:latest
    restart: always
    expose:
      - "5432"
    volumes:
      - pgdata:/var/lib/postgresql/data/
    environment:
      - POSTGRES_DB=[redacted]
      - POSTGRES_USER=[redacted]
      - POSTGRES_PASSWORD=[redacted]
    networks:
      - global

  web:
    image: chiefonboarding/chiefonboarding:latest
    restart: always
    expose:
      - "8000"
    environment:
      - SECRET_KEY=[redacted]
      - DATABASE_URL=postgres://[redacted]:[redacted]@db:5432/chiefonboarding
      - ALLOWED_HOSTS=hello.[redacted]
    depends_on:
      - db
    networks:
      - global

  caddy:
    image: caddy:2.3.0-alpine
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - $PWD/Caddyfile:/etc/caddy/Caddyfile
      - $PWD/site:/srv
      - caddy_data:/data
      - caddy_config:/config
    networks:
      - global

volumes:
  pgdata:
  caddy_data:
  caddy_config:

networks:
  global:

Caddyfile:

hello.[redacted] {
  reverse_proxy web:8000
}
MuratDoganer commented 2 months ago

While I was writing that out I realised I am an idiot.

I tend to make sure I dont run any web apps, or anything really, as a root user, so I have to use sudo. $PWD does not like sudo, so it resorts back to a blank string and thus causes weird issues.

Replaced the $PWD with a . resolved the issue, I can then run sudo docker compose up -d and voila no errors, everything runs like a dream

I've left the explanation above in case others come across a similar issue :)

GDay commented 2 months ago

Good to hear that you got it resolved. I didn't know about the sudo $PWD issue!