AmruthPillai / Reactive-Resume

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
https://rxresu.me
MIT License
21.78k stars 2.33k forks source link

[BUG] Self hosted docker instruction and domain #839

Open kgotso opened 2 years ago

kgotso commented 2 years ago

Describe the bug

Product Flavor

To Reproduce

  1. Follow instructions to deploy on docker found at https://docs.rxresu.me/deployment/docker
  2. Point Domain to the IP address of the server
  3. Traefik 404 error screen

Expected behavior

Following the instructions correctly should result in the app reachable from the PUBLIC_SERVER_URL based on the changes made however the instruction do not make it clear that in addition to the manual port changes there are also url host names that need to be amended for the client and server traefik lables without which traefik will be unable to route the traffic correctly

Screenshots

Desktop (please complete the following information):

Additional context

Instructions or docker compose file needs to be amended to make it easier to deploy

ASmartGuy commented 2 years ago

@kgotso before it the documentation gets properly updated, please can you briefly describe what are the changes needed for client and server traefik lables? I got the Traefik 404 error screen by just substituting all the localhost to the IP of the server

djw4 commented 2 years ago

I believe they are referring the fact the documentation says:

Edit the docker-compose.yml file you just pulled in and update the placeholders to your server's public IP (or domain, if applicable). Also, update the .env file that was just created and change variables such as PUBLIC_URL, PUBLIC_SERVER_URL etc. For a clear understanding of what each of the environment variables mean, head over to this section of the docs.

However to get it to work, you also have to edit the traefik labels, such this one.

ASmartGuy commented 2 years ago

Yea, I agree, but I need some guidance into what is wrong with line 73. I had try to replace localhost on line 73 with the server's IP but no luck. Thank you.

pizzaandcheese commented 2 years ago

I am also having this issue. First time attempting an installation and i commented out all the GOOGLE/BUCKET variables as I'm not planning on using those (and it wouldn't boot without me commenting them)

Alas all i get once its running is the dreaded 404.

I attempted to replace every instance of "localhost" in both the docker-compose and .env files with the severs local IP to no avail.

gymnae commented 2 years ago

I'm also trying to self-host, but without traefik. Instead, caddyserver is my go-to reverse proxy. So far, I can reach the client on the web, but the client cannot reach the server, since logging in or registering won't work.

EDIT: Managed to deploy. Here's how.

Notable changes:

  1. Removed traefik in favor of caddyserver as reverse proxy, which means I can remove all the traefik related labels and simply the compose file
  2. Changed docker-compose file version from 3 to 2.4 - since 3.x was designed for swarm/kubernetes and 2.x for single nodes
  3. I use a free S3 object storage bucket from scaleway
  4. No need to fowards ports 3000/3100
  5. Commented out all things google

Here's my docker-compose file, with my private variable values replaced with placeholders:

version: '2.4'

services:
  postgres:
    image: postgres:14.2-alpine
    container_name: reactive_resume_postgres
    environment:
      - POSTGRES_DB=reactive-resume
      - POSTGRES_USER=reactive-resume
      - POSTGRES_PASSWORD=password
    volumes:
      - <host/path/to/sqlstorage:/var/lib/postgresql/data
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U reactive-resume" ]
      start_period: 15s
      interval: 30s
      timeout: 30s
      retries: 3
    networks:
      - mycustomerdockernetwork
    restart: always

  server:
    image: amruthpillai/reactive-resume:server-latest
    # build:
    #   context: .
    #   dockerfile: ./server/Dockerfile
    container_name: rxresu_server
    environment:
      - TZ=UTC
      - PUBLIC_URL=https://rxresu.domaind.tld
      - PUBLIC_SERVER_URL=https://rxresu.domain.tld/api
#      - PUBLIC_GOOGLE_CLIENT_ID=
      - POSTGRES_DB=reactive-resume
      - POSTGRES_USER=reactive-resume
      - POSTGRES_PASSWORD=password
      - SECRET_KEY=secret
      - POSTGRES_HOST=reactive_resume_postgres
      - POSTGRES_PORT=5432
#      - POSTGRES_SSL_CERT=
      - JWT_SECRET=secret
      - JWT_EXPIRY_TIME=604800
#      - GOOGLE_CLIENT_SECRET=
#      - GOOGLE_API_KEY=
#      - SENDGRID_API_KEY=
#      - SENDGRID_FORGOT_PASSWORD_TEMPLATE_ID=
#      - SENDGRID_FROM_NAME=
#      - SENDGRID_FROM_EMAIL=
      - STORAGE_BUCKET=rxresume-domainname
      - STORAGE_REGION=fr-par
      - STORAGE_ENDPOINT=https://s3.fr-par.scw.cloud
      - STORAGE_URL_PREFIX=https://domainname.s3.fr-par.scw.cloud/
      - STORAGE_ACCESS_KEY=secret
      - STORAGE_SECRET_KEY=secret
    depends_on:
      - postgres
    restart: always
    networks:
      - mycustomerdockernetwork

  client:
    image: amruthpillai/reactive-resume:client-latest
    # build:
    #   context: .
    #   dockerfile: ./client/Dockerfile
    container_name: rxresu_client
    environment:
      - TZ=UTC
      - PUBLIC_URL=https://rxresu.domain.tld
      - PUBLIC_SERVER_URL=https://rxresu.domain.tld/api
 #     - PUBLIC_GOOGLE_CLIENT_ID=
      - PUBLIC_FLAG_DISABLE_SIGNUPS=false
    depends_on:
      - server
    restart: always
    networks:
      - mycustomerdockernetwork

networks:
  mycustomerdockernetwork:
    external: true

Here's the required part of my Caddyfile

rxresu.domain.tld {
    handle_path /api/* {
        reverse_proxy rxresu_server:3100
    }
    handle /* {
        reverse_proxy rxresu_client:3000
    }
}
C-Blais commented 1 year ago

For anyone arriving here trying to get this working on Traefik I was able to get it working (with brute force and ignorance).

Added the following to the .env: NAMEclient=resume NAMEserver=resume1 URLclient=resume.domain.com NAMEserver=api.domain.com

Updated in .env: PUBLIC_URL=https://resume.domain.com PUBLIC_SERVER_URL=https://api.domain.com

Client labels:

Server labels:

Hopefully this will be of use to someone; and preferably will make its way into the documentation to help others get this spun up quickly.