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
23.48k stars 2.49k forks source link

[BUG] 'Register' and 'Login' buttons on form do not work #752

Closed BackedUpBooty closed 2 years ago

BackedUpBooty commented 2 years ago

Describe the bug After spinning up all containers and navigating to the front page with the 'Login' and 'Register' buttons, I click the 'Register' button which brings up the form to fill in. After doing this, I click 'Register' but nothing happens

Product Flavor

To Reproduce Steps to reproduce the behavior:

  1. Copy docker-compose.yml
  2. Modify as needed (client port mapped to 3100, traefik port mapped to 8080, networks added, volumes modified)
  3. Copy .env.example
  4. Modify as needed (Public URLs/secret key, jwt secret, google api key)
  5. Save as .env
  6. docker-compose up -d
  7. See all containers up and running: Postgres logs state: [1] LOG: database system is ready to accept connections Traefik log states: time="2022-03-21T14:12:46Z" level=info msg="Configuration loaded from flags." Server log states: [Nest] 44 - 03/21/2022, 2:13:59 PM LOG 🚀 Server is up and running! Client log states: react-env: Writing runtime env /app/client/public/__ENV.js ready - started server on 0.0.0.0:3000, url: http://localhost:3000
  8. Access react gui via mapped port 3100
  9. Hit 'Register' button
  10. Fill in the form, hit 'Submit'
  11. Nothing happens

To verify that nothing happened, I have tried to log in with a user, however a single X in a red circle appears bottom right of the screen when I do that.

Expected behavior Hitting submit after completing the registration form actually registers my user and allows me to log in to use the service

Screenshots

image image

Desktop (please complete the following information):

Additional context I have tried this with two separate directories, one just using a docker-compose file and .env file to spin up the containers, the second folder used git clone and then spun up the containers. Both result in the same behavior.

onicosta commented 2 years ago

Had the same problem. The server container stops because it missed a JWT_SECRET.

Added a random string in the 'JWT_SECRET' variable in .env and it worked for me.

BackedUpBooty commented 2 years ago

Thanks for the reply and assist. I've had the JWT_SECRET set from before spinning up any containers, and none of the containers are stopping, so unfortunately that's not a solution for me.

onicosta commented 2 years ago

Ah, damn. Share your .env and your docker-compose.yml and I'll take a look.

BackedUpBooty commented 2 years ago

Thanks, appreciate it.

compose file https://pastebin.com/YruExh47 .env https://pastebin.com/j8SN3tRH

martadinata666 commented 2 years ago

Isn't should be accessed via traefik? as traefik is the one to redirect api/ registration/login stuff to server, interface to client? And if using traefik dont need to bind client ports.

BackedUpBooty commented 2 years ago

I've tried it both with and without traefik, I get the same response both ways.

EDIT: figured I should share the version I used with traefik too - https://pastebin.com/WdzWRtf6

BackedUpBooty commented 2 years ago

Bumping this again in case - I noticed that '1 task done' is listed, but there's not a resolution yet.

modem7 commented 2 years ago

Bumping this again in case - I noticed that '1 task done' is listed, but there's not a resolution yet.

Task is literally just:

image

Please check https://github.com/AmruthPillai/Reactive-Resume/issues/691 as I had a similar issue.

Here's my latest:

  reactiveresumeserver:
    image: amruthpillai/reactive-resume:server-latest
    container_name: ReactiveResume-Server
    environment:
      - PUBLIC_URL=https://resume.$DOMAINNAME
      - POSTGRES_HOST=reactiveresumedb
      - POSTGRES_DATABASE=$RR_POSTGRES_DATABASE
      - POSTGRES_PASSWORD=$RR_POSTGRES_PASSWORD
      - POSTGRES_USER=$RR_POSTGRES_USERNAME
      - TZ=$TZ
      - SECRET_KEY=$RR_SECRET_KEY
      - JWT_SECRET=$RR_JWT_SECRET
      - JWT_EXPIRY_TIME=$RR_JWT_EXPIRY_TIME
      - PUBLIC_GOOGLE_CLIENT_ID=$RR_PUBLIC_GOOGLE_CLIENT_ID
      - GOOGLE_CLIENT_SECRET=$RR_GOOGLE_CLIENT_SECRET
      - GOOGLE_API_KEY=$RR_GOOGLE_API_KEY
    depends_on:
      - reactiveresumedb
    networks:
      pihole:
        ipv4_address: '172.22.0.140'
      isolated:
    labels: 
      - autoheal=true
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.resumeserver-rtr.entrypoints=https"
      - "traefik.http.routers.resumeserver-rtr.rule=Host(`resume.$DOMAINNAME`) && PathPrefix(`/api/`)"
      - "traefik.http.routers.resumeserver-rtr.tls=true"
      ## Middlewares
      - "traefik.http.routers.resumeserver-rtr.middlewares=chain-no-auth@file, resume-api" # No Authentication
      # - "traefik.http.routers.resumeserver-rtr.middlewares=chain-basic-auth@file" # Basic Authentication
      # - "traefik.http.routers.resumeserver-rtr.middlewares=chain-oauth@file" # Google OAuth 2.0
      # - "traefik.http.routers.resumeserver-rtr.middlewares=chain-authelia@file" # Authelia
      - "traefik.http.middlewares.resume-api.stripprefix.prefixes=/api"
      - "traefik.http.middlewares.resume-api.stripprefix.forceslash=true"
      ## HTTP Services
      - "traefik.http.routers.resumeserver-rtr.service=resumeserver-svc"
      - "traefik.http.services.resumeserver-svc.loadbalancer.server.port=3100"
    # volumes:
      # - $USERDIR/ReactiveResume/uploads:/app/server/dist/assets/uploads
    healthcheck:
      test: curl -fSs http://localhost:3100/health || exit 1
      interval: 30s
      timeout: 5s
      retries: 3
    restart: always

  reactiveresumeclient:
    image: amruthpillai/reactive-resume:client-latest
    container_name: ReactiveResume-Client
    environment:
      - PUBLIC_SERVER_URL=https://resumeserver.$DOMAINNAME
      - TZ=$TZ
      # - SECRET_KEY=$RR_SECRET_KEY
      # - JWT_SECRET=$RR_JWT_SECRET
      # - JWT_EXPIRY_TIME=$RR_JWT_EXPIRY_TIME
      - PUBLIC_GOOGLE_CLIENT_ID=$RR_PUBLIC_GOOGLE_CLIENT_ID
      - GOOGLE_CLIENT_SECRET=$RR_GOOGLE_CLIENT_SECRET
      - GOOGLE_API_KEY=$RR_GOOGLE_API_KEY
      - PUBLIC_FLAG_DISABLE_SIGNUPS=false
    depends_on:
      - reactiveresumeserver
      - reactiveresumedb
    networks:
      pihole:
        ipv4_address: '172.22.0.141'
    labels: 
      - autoheal=true
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.resume-rtr.entrypoints=https"
      - "traefik.http.routers.resume-rtr.rule=Host(`resume.$DOMAINNAME`)"
      - "traefik.http.routers.resume-rtr.tls=true"
      ## Middlewares
      - "traefik.http.routers.resume-rtr.middlewares=chain-no-auth@file" # No Authentication
      # - "traefik.http.routers.resume-rtr.middlewares=chain-basic-auth@file" # Basic Authentication
      # - "traefik.http.routers.resume-rtr.middlewares=chain-oauth@file" # Google OAuth 2.0
      # - "traefik.http.routers.resume-rtr.middlewares=chain-authelia@file" # Authelia
      ## HTTP Services
      - "traefik.http.routers.resume-rtr.service=resume-svc"
      - "traefik.http.services.resume-svc.loadbalancer.server.port=3000"
      ## Flame Dashboard
      - flame.type=application # "app" works too
      - flame.name=Reactive Resume
      - flame.icon=https://raw.githubusercontent.com/modem7/MiscAssets/master/Icons/rxresume.png
    healthcheck:
      test: curl -fSs 127.0.0.1:3000 || exit 1
      interval: 30s
      timeout: 5s
      retries: 3
    restart: always

  reactiveresumedb:
    image: postgres:alpine
    container_name: ReactiveResume-DB
    environment:
      - TZ=$TZ
      - POSTGRES_DB=$RR_POSTGRES_DATABASE
      - POSTGRES_PASSWORD=$RR_POSTGRES_PASSWORD
      - POSTGRES_USER=$RR_POSTGRES_USERNAME
    networks:
      - isolated
    volumes:
      - $USERDIR/ReactiveResume/db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $RR_POSTGRES_USERNAME" ]
      interval: 30s
      timeout: 5s
      retries: 3
    restart: always
sudo-kraken commented 2 years ago

I am having the same issue.

bpottle1 commented 2 years ago

I'm seeing the same issue as well. I've tried with and without Traefik.

modem7 commented 2 years ago

@Joeharrison94 @bpottle1 - it seems that there may have been a breaking change.

Under reactiveresumeserver, make sure you now have POSTGRES_DB instead of POSTGRES_DATABASE and see if that works.

BackedUpBooty commented 2 years ago

Thanks for pointing that out, I've updated the images and made sure to have POSTGRES_DB, but I'm having the same issue with the 'Register' button on the form. The button has some functionality, as if I click it without having correctly filled out any/all of the fields then it will tell me. Logs aren't showing any errors that I can find.

sudo-kraken commented 2 years ago

Same here updated the env var and its still the same.

dvd741-a commented 2 years ago

Maybe related to the STORAGE_ env variables? It seems a few of them are required. Which might stop the Server from starting? Are there other options besides using an S3 bucket? I'd like to be able to just use a local volume...

Seems overkill to have to setup an entire S3 bucket for the "picture" functionality

modem7 commented 2 years ago

Maybe related to the STORAGE_ env variables? It seems a few of them are required. Which might stop the Server from starting? Are there other options besides using an S3 bucket? I'd like to be able to just use a local volume...

Seems overkill to have to setup an entire S3 bucket for the "picture" functionality

Nope, I'm able to store everything locally. Only thing that's not currently working is PDFs, but that's a separate issue being tracked elsewhere.

The important part was this line here https://www.modem7.com/books/docker/page/current-docker-compose - line 2178 where I've specifically listed the internal path for the media volume.

sudo-kraken commented 2 years ago

@Joeharrison94 @bpottle1 - it seems that there may have been a breaking change.

Under reactiveresumeserver, make sure you now have POSTGRES_DB instead of POSTGRES_DATABASE and see if that works.

I have it set this, since the beginning I cant get this working at all Ive been through every last line of the yaml and the docs, this appears to be a bug, is there an example of a working docker compose configuration without traefik.

dvd741-a commented 2 years ago

Maybe related to the STORAGE_ env variables? It seems a few of them are required. Which might stop the Server from starting? Are there other options besides using an S3 bucket? I'd like to be able to just use a local volume... Seems overkill to have to setup an entire S3 bucket for the "picture" functionality

Nope, I'm able to store everything locally. Only thing that's not currently working is PDFs, but that's a separate issue being tracked elsewhere.

The important part was this line here https://www.modem7.com/books/docker/page/current-docker-compose - line 2178 where I've specifically listed the internal path for the media volume.

Unfortunately this doesn't work for me. I added the volume, but no success :-/ In the Server log I see:

[Nest] 42  - 04/13/2022, 11:09:39 AM   ERROR [ExceptionsHandler] Region is missing
Error: Region is missing
    at default (/app/node_modules/.pnpm/@aws-sdk+config-resolver@3.58.0/node_modules/@aws-sdk/config-resolver/dist-cjs/regionConfig/config.js:10:15)
    at /app/node_modules/.pnpm/@aws-sdk+node-config-provider@3.58.0/node_modules/@aws-sdk/node-config-provider/dist-cjs/fromStatic.js:6:83
    at /app/node_modules/.pnpm/@aws-sdk+property-provider@3.55.0/node_modules/@aws-sdk/property-provider/dist-cjs/chain.js:11:28
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async coalesceProvider (/app/node_modules/.pnpm/@aws-sdk+property-provider@3.55.0/node_modules/@aws-sdk/property-provider/dist-cjs/memoize.js:14:24)
    ...

So not sure, it seems like it's trying to access the S3 storage anyway? How do I disable it from doing that? @modem7 are you on the latest version?

`server: image: amruthpillai/reactive-resume:server-latest container_name: ReactiveResume-Server dns:

modem7 commented 2 years ago

Maybe related to the STORAGE_ env variables? It seems a few of them are required. Which might stop the Server from starting? Are there other options besides using an S3 bucket? I'd like to be able to just use a local volume... Seems overkill to have to setup an entire S3 bucket for the "picture" functionality

Nope, I'm able to store everything locally. Only thing that's not currently working is PDFs, but that's a separate issue being tracked elsewhere.

The important part was this line here https://www.modem7.com/books/docker/page/current-docker-compose - line 2178 where I've specifically listed the internal path for the media volume.

Unfortunately this doesn't work for me. I added the volume, but no success :-/ In the Server log I see:

[Nest] 42  - 04/13/2022, 11:09:39 AM   ERROR [ExceptionsHandler] Region is missing
Error: Region is missing
    at default (/app/node_modules/.pnpm/@aws-sdk+config-resolver@3.58.0/node_modules/@aws-sdk/config-resolver/dist-cjs/regionConfig/config.js:10:15)
    at /app/node_modules/.pnpm/@aws-sdk+node-config-provider@3.58.0/node_modules/@aws-sdk/node-config-provider/dist-cjs/fromStatic.js:6:83
    at /app/node_modules/.pnpm/@aws-sdk+property-provider@3.55.0/node_modules/@aws-sdk/property-provider/dist-cjs/chain.js:11:28
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async coalesceProvider (/app/node_modules/.pnpm/@aws-sdk+property-provider@3.55.0/node_modules/@aws-sdk/property-provider/dist-cjs/memoize.js:14:24)
    ...

So not sure, it seems like it's trying to access the S3 storage anyway? How do I disable it from doing that? @modem7 are you on the latest version?

Yupper, latest version. The link is my actual setup that's current.

dvd741-a commented 2 years ago

@modem7 - Weird. - Can you update the picture on a resume?

In the code (main branch) I see (which does seem to try to upload to the s3Client, and not a local store): image https://github.com/AmruthPillai/Reactive-Resume/blob/main/server/src/resume/resume.service.ts

martadinata666 commented 2 years ago

the new release 3.3.4 technically need s3 storage setup. the profile pic thing won't work on local, there is minio too emulate s3 storage but also got some issues.

modem7 commented 2 years ago

the new release 3.3.4 technically need s3 storage setup. the profile pic thing won't work on local, there is minio too emulate s3 storage but also got some issues.

I mean, I'm on latest, with local storage, working absolutely as intended. Albeit it's a weird setup to get it working.

    volumes:
      - $USERDIR/ReactiveResume/uploads:/app/server/dist/assets/uploads
BackedUpBooty commented 2 years ago

@modem7 I did try your compose file, replacing the keys / domain etc. with my own from the .env file, but unfortunately I'm still getting exactly the same issue. I can access the page from resume.mydomain.com, but the form's 'Register' button still doesn't work

sudo-kraken commented 2 years ago

t, with local storage, working absolutely as intended. Albeit it's a weird setup to get it working.

I am trying to set up locally as you have but cant seem to get it working.

 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
 ################################# Reactive Resume #################################
 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##

 ##~~~~~~~~~~##
 ##### DB #####
 ##~~~~~~~~~~##

  react-postgres:
    image: postgres:14.2-alpine
    container_name: react-postgres
    environment:
      - POSTGRES_DB=react-postgres
      - POSTGRES_USER=react-postgres
      - POSTGRES_PASSWORD=$MYSQL_ROOT_PASSWORD
    volumes:
      - $DOCKERLOCALDIR/reactive_resume/db:/var/lib/postgresql/data
      - /etc/localtime:/etc/localtime:ro
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U react-postgres" ]
      start_period: 15s
      interval: 30s
      timeout: 30s
      retries: 3
    restart: unless-stopped
    networks:
      - proxy_net
    ports:
      - 5432:5432
    security_opt:
      - no-new-privileges:true

 ##~~~~~~~~~~##
 ### Server ###
 ##~~~~~~~~~~##

  react-server:
    image: amruthpillai/reactive-resume:server-latest
    container_name: react-server
    environment:
      - TZ=$TZ
      - PUBLIC_URL=https://cv.$DOMAINNAME
#      - PUBLIC_SERVER_URL=http://localhost:3000/api
      - POSTGRES_DB=react-postgres
      - POSTGRES_USER=react-postgres
      - POSTGRES_PASSWORD=$MYSQL_ROOT_PASSWORD
      - SECRET_KEY="REDACTED20CHARSECRET"
      - POSTGRES_HOST=react-postgres
      - POSTGRES_PORT=5432
      - JWT_SECRET="REDACTED20CHARSTRING"
      - JWT_EXPIRY_TIME=604800
      - GOOGLE_API_KEY=$GOOGLE_API_KEY
    depends_on:
      - react-postgres
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - $DOCKERLOCALDIR/reactive_resume/uploads:/app/server/dist/assets/uploads
    networks:
      - proxy_net
    ports:
      - 3100:3100
    restart: always
    healthcheck:
      test: curl -fSs http://localhost:3100/health || exit 1
      interval: 30s
      timeout: 5s
      retries: 3
    security_opt:
      - no-new-privileges:true

 ##~~~~~~~~~~##
 ### Client ###
 ##~~~~~~~~~~##

  resume_client:
    image: amruthpillai/reactive-resume:client-latest
    container_name: react-client
    environment:
      - TZ=$TZ
      - PUBLIC_SERVER_URL=http://localhost:3100/api
      - PUBLIC_FLAG_DISABLE_SIGNUPS=false
    depends_on:
      - react-server
      - react-postgres
    volumes:
      - /etc/localtime:/etc/localtime:ro
    networks:
      - proxy_net
    ports:
      - 3000:3000
    restart: always
    healthcheck:
      test: curl -fSs 127.0.0.1:3000 || exit 1
      interval: 30s
      timeout: 5s
      retries: 3
    security_opt:
      - no-new-privileges:true
modem7 commented 2 years ago

I think we should move this to a new issue - it's not related to login and register buttons, but storage.

We're muddying up the waters and it'll make it more difficult for @AmruthPillai to track, and diagnose.

sudo-kraken commented 2 years ago

We're muddying up the waters and it'll make it more difficult for @AmruthPillai to track, and diagnose

So you think this issue is causing the register buttons to stop working as mine loads but buttons dont work

dvd741-a commented 2 years ago

I think we should move this to a new issue - it's not related to login and register buttons, but storage.

We're muddying up the waters and it'll make it more difficult for @AmruthPillai to track, and diagnose.

https://github.com/AmruthPillai/Reactive-Resume/issues/830

sudo-kraken commented 2 years ago

Anyone got a fix for the register button yet :(

dvd741-a commented 2 years ago

Anyone got a fix for the register button yet :(

Did you check the Server docker logs when you press "Register"?

BackedUpBooty commented 2 years ago

Pressing the first 'Register' button brings up the registration form. If you press the 'Register' button on the form without it being correctly filled, it will tell me on the form itself. Filling it in correctly then pressing the button (click animation happens) does nothing.

None of the logs show anything past their original startup messages, I listed them on my original post.

sudo-kraken commented 2 years ago

Pressing the first 'Register' button brings up the registration form. If you press the 'Register' button on the form without it being correctly filled, it will tell me on the form itself. Filling it in correctly then pressing the button (click animation happens) does nothing.

None of the logs show anything past their original startup messages, I listed them on my original post.

This is the exact issue I'm facing

sudo-kraken commented 2 years ago

Any movement on this one?

derek333x commented 2 years ago

Pressing the first 'Register' button brings up the registration form. If you press the 'Register' button on the form without it being correctly filled, it will tell me on the form itself. Filling it in correctly then pressing the button (click animation happens) does nothing.

None of the logs show anything past their original startup messages, I listed them on my original post.

I am also experiencing the exact same situation with the self hosted version.
It would be beautiful to have the self hosted option not rely on Traefik as well. Everyone doesn't want to run Traefik or has their own setup for a reverse proxy manager. I have tried with and without Traefik and had the same scenario of not being able to register or login.

Even if we could get better debug output so things could be troubleshooted.

valantur commented 2 years ago

I think the server component is not starting. curl localhost 3100 says connection refused. Frontend and documentation services at 3000 and 3200 seem to be OK. That's why we can't register a new user, the backend is offline.

This is a weird message I'm seeing on the console:

[server] /opt/Reactive-Resume/server/src/printer/printer.service.ts:19 [server] this.browser = await chromium.launch({ [server] ^ [server] browserType.launch: Failed to launch: Error: spawn /root/.cache/ms-playwright/chromium-1000/chrome-linux/chrome ENOENT

but then it says compiled client and server successfully...

minez0 commented 2 years ago

Pressing the first 'Register' button brings up the registration form. If you press the 'Register' button on the form without it being correctly filled, it will tell me on the form itself. Filling it in correctly then pressing the button (click animation happens) does nothing.

None of the logs show anything past their original startup messages, I listed them on my original post.

Same issue here as well. Both server and client both show that they have started successfully in the logs (same logs as OP)

BackedUpBooty commented 2 years ago

I think the server component is not starting. curl localhost 3100 says connection refused. Frontend and documentation services at 3000 and 3200 seem to be OK. That's why we can't register a new user, the backend is offline.

This is a weird message I'm seeing on the console:

[server] /opt/Reactive-Resume/server/src/printer/printer.service.ts:19 [server] this.browser = await chromium.launch({ [server] ^ [server] browserType.launch: Failed to launch: Error: spawn /root/.cache/ms-playwright/chromium-1000/chrome-linux/chrome >ENOENT

but then it says compiled client and server successfully...

I'll have to spin it up again and take a look through the console, good ideas to use curl though from the containers, something I coulda shoulda thought of...

dorbalmas commented 2 years ago

I am having the same issue with the 'Login' and 'Register' buttons, digitalOcean, docker, and mac M1.

Screen Shot 2022-05-11 at 10 50 50 Screen Shot 2022-05-11 at 10 51 38

docker-compose.yml

Screen Shot 2022-05-11 at 14 00 13

.env

Server + Client

TZ=UTC PUBLIC_URL=http://localhost:3000 PUBLIC_SERVER_URL=http://localhost:3000/api PUBLIC_GOOGLE_CLIENT_ID=

Server + Database

POSTGRES_DB=postgres POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres

Server

SECRET_KEY=1sLa4ROgrl83e90cKEyOk7Nget

POSTGRES_HOST=postgres POSTGRES_PORT=5432 POSTGRES_SSL_CERT= JWT_SECRET=erV2bcZCviRlqHDasFk3HG 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=dbcv STORAGE_REGION=fra1 STORAGE_ENDPOINT=fra1.digitaloceanspaces.com STORAGE_URL_PREFIX=https://dbcv.fra1.digitaloceanspaces.com/ STORAGE_ACCESS_KEY=AVNc_ei70n2346vcCN5 STORAGE_SECRET_KEY=AVNc_ei70n2346vcCN5

Flags (customer)

PUBLIC_FLAG_DISABLE_SIGNUPS=False

maltokyo commented 2 years ago

Same issue here, everything in logs suggests no errors, just cannot sign up

BackedUpBooty commented 2 years ago

It's a shame that we can't pin down what's causing this.

AmruthPillai commented 2 years ago

That's really weird. I see postgres as a service, up and running on Docker in the screenshot above, and the env is all set correctly, but still the server is not able to find this service?

I was not able to recreate this locally as my docker, on local, works every time I boot it up. And the set up process was nothing special, just filled in the env vars. Does this happen on the latest versions of the app/docker deployment too?

AmruthPillai commented 2 years ago

Okay, I don't understand where the issue could be, because I just followed these steps exactly, and I was able to have the app/server running within 5 minutes.

I created a folder sample and added a docker-compose.yml file, with these contents:

version: "3.8"

services:
  postgres:
    image: postgres:alpine
    container_name: postgres
    restart: always
    ports:
      - 5432:5432
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      start_period: 15s
      interval: 30s
      timeout: 30s
      retries: 3
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres

  traefik:
    image: traefik:latest
    container_name: traefik
    restart: always
    command:
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --entrypoints.web.address=:80
    ports:
      - 80:80
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro

  server:
    image: amruthpillai/reactive-resume:server-latest
    container_name: server
    restart: always
    depends_on:
      - traefik
      - postgres
    labels:
      - traefik.enable=true
      - traefik.http.routers.server.entrypoints=web
      - traefik.http.routers.server.rule=Host(`localhost`) && PathPrefix(`/api/`)
      - traefik.http.routers.server.middlewares=server-stripprefix
      - traefik.http.middlewares.server-stripprefix.stripprefix.prefixes=/api
      - traefik.http.middlewares.server-stripprefix.stripprefix.forceslash=true
    environment:
      - PUBLIC_URL=http://localhost
      - PUBLIC_SERVER_URL=http://localhost/api
      - PUBLIC_GOOGLE_CLIENT_ID=
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - SECRET_KEY=change-me-to-something-secure
      - POSTGRES_HOST=postgres
      - POSTGRES_PORT=5432
      - POSTGRES_SSL_CERT=
      - JWT_SECRET=change-me-to-something-secure
      - JWT_EXPIRY_TIME=604800
      - GOOGLE_CLIENT_SECRET=
      - GOOGLE_API_KEY=
      - MAIL_FROM_NAME=Reactive Resume
      - MAIL_FROM_EMAIL=noreply@rxresu.me
      - MAIL_HOST=
      - MAIL_PORT=
      - MAIL_USERNAME=
      - MAIL_PASSWORD=
      - STORAGE_BUCKET=
      - STORAGE_REGION=
      - STORAGE_ENDPOINT=
      - STORAGE_URL_PREFIX=
      - STORAGE_ACCESS_KEY=
      - STORAGE_SECRET_KEY=

  client:
    image: amruthpillai/reactive-resume:client-latest
    container_name: client
    restart: always
    depends_on:
      - traefik
      - server
    labels:
      - traefik.enable=true
      - traefik.http.routers.client.rule=Host(`localhost`)
      - traefik.http.routers.client.entrypoints=web
    environment:
      - PUBLIC_URL=http://localhost
      - PUBLIC_SERVER_URL=http://localhost/api
      - PUBLIC_GOOGLE_CLIENT_ID=

volumes:
  pgdata:

Note how I chose to pull in the docker images from docker hub, instead of building them.

It's very similar to the docker-compose that already exists on the repo root, but with env vars hoisted on the compose file, rather than a separate .env file.

Now, I just ran the command docker compose up -d. This is the log I got:

[+] Running 6/5
 â ¿ Network rxresume-sample-deployment_default  Created                                                             0.0s
 â ¿ Volume "rxresume-sample-deployment_pgdata"  Created                                                             0.0s
 â ¿ Container postgres                          Created                                                             0.4s
 â ¿ Container traefik                           Created                                                             0.4s
 â ¿ Container server                            Created                                                             0.1s
 â ¿ Container client                            Created                                                             0.1s
Attaching to client, postgres, server, traefik
postgres  | The files belonging to this database system will be owned by user "postgres".
postgres  | This user must also own the server process.
postgres  |
postgres  | The database cluster will be initialized with locale "en_US.utf8".
postgres  | The default database encoding has accordingly been set to "UTF8".
postgres  | The default text search configuration will be set to "english".
postgres  |
postgres  | Data page checksums are disabled.
postgres  |
postgres  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres  | creating subdirectories ... ok
postgres  | selecting dynamic shared memory implementation ... posix
postgres  | selecting default max_connections ... 100
traefik   | time="2022-08-28T14:37:18Z" level=info msg="Configuration loaded from flags."
postgres  | selecting default shared_buffers ... 128MB
postgres  | selecting default time zone ... UTC
postgres  | creating configuration files ... ok
postgres  | running bootstrap script ... ok
postgres  | performing post-bootstrap initialization ... sh: locale: not found
postgres  | 2022-08-28 14:37:19.352 UTC [29] WARNING:  no usable system locales were found
server    |
server    | > reactive-resume@3.6.3 start /app
server    | > env-cmd --silent turbo run start "--filter" "server"
server    |
server    |  WARNING  cannot find a .git folder. Falling back to manual file hashing (which may be slower). If you are running this build in a pruned directory, you can ignore this message. Otherwise, please initialize a git repository in the root of your monorepo
server    | • Packages in scope: @reactive-resume/server
server    | • Running start in 1 packages
server    | @reactive-resume/server:start: cache bypass, force executing fba5a995b0cac09b
postgres  | ok
server    | @reactive-resume/server:start:
server    | @reactive-resume/server:start: > @reactive-resume/server@ start /app/server
server    | @reactive-resume/server:start: > node dist/main
server    | @reactive-resume/server:start:
postgres  | syncing data to disk ... initdb: warning: enabling "trust" authentication for local connections
postgres  | You can change this by editing pg_hba.conf or using the option -A, or
postgres  | --auth-local and --auth-host, the next time you run initdb.
postgres  | ok
postgres  |
postgres  |
postgres  | Success. You can now start the database server using:
postgres  |
postgres  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres  |
client    |
client    | > reactive-resume@3.6.3 start /app
client    | > env-cmd --silent turbo run start "--filter" "client"
client    |
postgres  | waiting for server to start....2022-08-28 14:37:19.987 UTC [35] LOG:  starting PostgreSQL 14.5 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219, 64-bit
postgres  | 2022-08-28 14:37:19.989 UTC [35] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres  | 2022-08-28 14:37:19.996 UTC [36] LOG:  database system was shut down at 2022-08-28 14:37:19 UTC
postgres  | 2022-08-28 14:37:20.000 UTC [35] LOG:  database system is ready to accept connections
client    |  WARNING  cannot find a .git folder. Falling back to manual file hashing (which may be slower). If you are running this build in a pruned directory, you can ignore this message. Otherwise, please initialize a git repository in the root of your monorepo
postgres  |  done
postgres  | server started
postgres  |
postgres  | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
postgres  |
postgres  | 2022-08-28 14:37:20.085 UTC [35] LOG:  received fast shutdown request
postgres  | waiting for server to shut down....2022-08-28 14:37:20.087 UTC [35] LOG:  aborting any active transactions
postgres  | 2022-08-28 14:37:20.088 UTC [35] LOG:  background worker "logical replication launcher" (PID 42) exited with exit code 1
postgres  | 2022-08-28 14:37:20.090 UTC [37] LOG:  shutting down
postgres  | 2022-08-28 14:37:20.102 UTC [35] LOG:  database system is shut down
postgres  |  done
postgres  | server stopped
postgres  |
postgres  | PostgreSQL init process complete; ready for start up.
postgres  |
postgres  | 2022-08-28 14:37:20.200 UTC [1] LOG:  starting PostgreSQL 14.5 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219, 64-bit
postgres  | 2022-08-28 14:37:20.200 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres  | 2022-08-28 14:37:20.200 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres  | 2022-08-28 14:37:20.205 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres  | 2022-08-28 14:37:20.214 UTC [47] LOG:  database system was shut down at 2022-08-28 14:37:20 UTC
client    | • Packages in scope: @reactive-resume/client
client    | • Running start in 1 packages
client    | @reactive-resume/client:start: cache bypass, force executing 5cd108ff8dc8a7cf
postgres  | 2022-08-28 14:37:20.217 UTC [1] LOG:  database system is ready to accept connections
client    | @reactive-resume/client:start:
client    | @reactive-resume/client:start: > @reactive-resume/client@ start /app/client
client    | @reactive-resume/client:start: > react-env --prefix PUBLIC -- next start
client    | @reactive-resume/client:start:
client    | @reactive-resume/client:start: react-env: Writing runtime env /app/client/public/__ENV.js
client    | @reactive-resume/client:start: ready - started server on 0.0.0.0:3000, url: http://localhost:3000
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [NestFactory] Starting Nest application...
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +66ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] DatabaseModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] MailModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] PassportModule dependencies initialized +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] MulterModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] MulterModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] HttpModule dependencies initialized +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] CacheModule dependencies initialized +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] TerminusModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] ServeStaticModule dependencies initialized +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] AppModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] HealthModule dependencies initialized +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] MailModule dependencies initialized +2ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] JwtModule dependencies initialized +12ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] PrinterModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:20 PM     LOG [InstanceLoader] FontsModule dependencies initialized +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [InstanceLoader] TypeOrmCoreModule dependencies initialized +70ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [InstanceLoader] UsersModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [InstanceLoader] ResumeModule dependencies initialized +2ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [InstanceLoader] AuthModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [InstanceLoader] IntegrationsModule dependencies initialized +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RoutesResolver] AuthController {/auth}: +4ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/auth, GET} route +2ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/auth/google, POST} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/auth/register, POST} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/auth/login, POST} route +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/auth/forgot-password, POST} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/auth/reset-password, POST} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/auth, DELETE} route +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RoutesResolver] ResumeController {/resume}: +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume, POST} route +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume, GET} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume/short/:shortId, GET} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume/:username/:slug, GET} route +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume/:id, GET} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume/:id, PATCH} route +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume/:id, DELETE} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume/:id/duplicate, POST} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume/:id/sample, POST} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume/:id/reset, POST} route +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume/:id/photo, PUT} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/resume/:id/photo, DELETE} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RoutesResolver] FontsController {/fonts}: +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/fonts, GET} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RoutesResolver] IntegrationsController {/integrations}: +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/integrations/linkedin, POST} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/integrations/json-resume, POST} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/integrations/reactive-resume, POST} route +1ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/integrations/reactive-resume-v2, POST} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RoutesResolver] PrinterController {/printer}: +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/printer/:username/:slug, GET} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RoutesResolver] HealthController {/health}: +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [RouterExplorer] Mapped {/health, GET} route +0ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG [NestApplication] Nest application successfully started +188ms
server    | @reactive-resume/server:start: [Nest] 71  - 08/28/2022, 2:37:21 PM     LOG 🚀 Server is up and running!

And I was able to get the site running on http://localhost (port 80, from traefik).

Screenshot 2022-08-28 at 4 51 42 PM

And I was also able to register as expected.

Screenshot 2022-08-28 at 4 47 10 PM

Screenshot 2022-08-28 at 4 52 21 PM
BackedUpBooty commented 2 years ago

I've just pulled the new docker images and made sure the compose file was up to date, all new and empty volumes, still the same issue and no indication in the logs as to why:

Console however brings up 3 errors when I click on the 'Register' button:

I'm not really sure what most of that means, other than the 404. I've tried it with localhost in each PUBLIC_URL variable, and with the subdomain. I get the same issue console errors. I'm not really a traefik person, I use SWAG for my reverse proxies, but if I set the public url to my subdomain, should I also change anything in the traefik lables for Host?

AmruthPillai commented 2 years ago

If you aren't used to Treafik, just remove it, it should be fairly simple that way too.

All you need to do is expose 3000 from client and 3100 from the server, then change the public url env to subdomain.domain.com:3000 and server url env to subdomain.domain.com:3100.

It should work as it is, and later you can use any proxy middleware solution like traefik, caddy or swag to reassign 3000 to :80

BackedUpBooty commented 2 years ago

thanks for the notes, I think getting closer to what the error is, don't know why it's happening. removed traefik.

The variables in both server and client now read as follows: PUBLIC_URL=http://localhost and PUBLIC_SERVER_URL=http://localhost/api.

My compose is mapping server port as 3002:3000 and server port as 3100:3100.

I can access the react homepage on http://192.168.1.2:3002. When I hit register, I get http://192.168.1.2:3002/api/auth/register 404 (Not Found) in console.

I have changed PUBLIC_SERVER_URL=http://localhost:3100/api and still get the same error. In fact it doesn't matter what I put as PUBLIC_SERVER_URL, I get the same response. Basically it looks like the register button is looking for the api under PUBLIC_URL rather than what's being specified in PUBLIC_SERVER_URL. When I tried with the reverse proxy, I even set https://resume.domain.name/api to port 3100 in the proxy-conf, didn't change anything.

AmruthPillai commented 2 years ago

That is true actually, the React client is wired up in a way to always visit PUBLIC_URL/api for the server. I can't seem to remember why that was a good idea, but I felt there would be a closer connection to the server if it were set up like that. I can see why there's so much confusion about it now. I guess I didn't think to imagine if people would want their server on a different URL.

I will quickly try to see if I can push a release where it makes use of PUBLIC_SERVER_URL instead, if available.

AmruthPillai commented 2 years ago

This has now been resolved on v3.6.4: https://github.com/AmruthPillai/Reactive-Resume/releases/tag/v3.6.4

Hopefully it doesn't break anything else 😅 I don't think it does, but you should be able to add any domain/subdomain to the URL env now. I've also removed traefik from the root example docker-compose.yml as it's not needed anymore.

BackedUpBooty commented 2 years ago

That's amazing thanks. I won't get a chance to try it for a while, but I'll edit this reply when I do. Thanks Amruth :)

EDIT: And I'm in! http://localhost had for both PUBLIC_ and PUBLIC_SERVER_URL had to be changed to my machine IP (unsurprising when in docker) but it's now letting me register and go through it all.

Thanks for taking the time to help us get it working.