Reactive-Resume icon indicating copy to clipboard operation
Reactive-Resume copied to clipboard

[BUG] Self hosted docker instruction and domain

Open kgotso opened this issue 2 years ago • 6 comments

Describe the bug

Product Flavor

  • [ ] Managed (https://rxresu.me)
  • [ X] Self Hosted

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):

  • OS: Windows 10
  • Browser Chrome
  • Version 100

Additional context

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

kgotso avatar Apr 16 '22 16:04 kgotso

@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

ASmartGuy avatar May 07 '22 14:05 ASmartGuy

I believe they are referring the fact the documentation says:

Edit the docker-compose.yml file you just pulled in and update the <SERVER-IP> 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.

djw4 avatar May 08 '22 13:05 djw4

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.

ASmartGuy avatar May 09 '22 02:05 ASmartGuy

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.

pizzaandcheese avatar May 11 '22 21:05 pizzaandcheese

~~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
	}
}

gymnae avatar May 19 '22 07:05 gymnae

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: - "traefik.enable=true" - "traefik.http.routers.${NAMEclient}.rule=Host(${URLclient})" - "traefik.http.routers.${NAMEclient}.entrypoints=websecure" - "traefik.http.routers.${NAMEclient}.tls.certresolver=myresolver" - "traefik.http.services.${NAMEclient}.loadbalancer.server.port=3000" networks: - traefik

Server labels: - "traefik.enable=true" - "traefik.http.routers.${NAMEserver}.rule=Host(${URLserver})" - "traefik.http.routers.${NAMEserver}.entrypoints=websecure" - "traefik.http.routers.${NAMEserver}.tls.certresolver=myresolver" - "traefik.http.services.${NAMEserver}.loadbalancer.server.port=3100" networks: - resume - traefik

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.

C-Blais avatar Oct 19 '22 12:10 C-Blais