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

Question about hiding the registration #273

Open
farzadha2 opened this issue Aug 20, 2023 · 11 comments
Open

Question about hiding the registration #273

farzadha2 opened this issue Aug 20, 2023 · 11 comments
Labels
complexity:1 enhancement New feature or request prio:1 Low priority

Comments

@farzadha2
Copy link

Hi
I was wondering if its possible to hide the registration.
As currently we dont users to register only if we allow to is that possible?

Thank you

@mawoka-myblock mawoka-myblock added enhancement New feature or request prio:1 Low priority complexity:1 labels Aug 21, 2023
@mawoka-myblock
Copy link
Owner

mawoka-myblock commented Aug 21, 2023

I'll implement that in the next days/weeks

@mawoka-myblock
Copy link
Owner

To enable this new feature, do the following:

  1. Add ENV VITE_REGISTRATION_DISABLED=True to your frontend/Dockerfile under all the other ENV-keywords and rebuild the container (docker compose build)
  2. Set the environment-variable REGISTRATION_DISABLED=True for the backend

@killmasta93
Copy link

hi @mawoka-myblock I was trying to follow the guide but cant seem to disable registration

This is my Docker compose


version: "3"

services:
  frontend:
    restart: always
    build:
      context: ./frontend
      dockerfile: Dockerfile
    depends_on:
      - redis
      - api
    networks:
      - rss_default
    environment:
      REDIS_URL: redis://redis:6379/0?decode_responses=True
      API_URL: http://api:80
      ENV_VITE_REGISTRATION_DISABLED: True
  api:
    build: &build_cfg
      context: .
      dockerfile: Dockerfile
    restart: &restart always
    networks:
      - rss_default
    depends_on: &depends
      - db
      - redis

    environment: &env_vars
      ROOT_ADDRESS: "https://quiz.domain.com" # Base-URL (change it)
      DB_URL: "postgresql://postgres:classquiz@db:5432/classquiz"
      REDIS: "redis://redis:6379/0?decode_responses=True"
      MAIL_ADDRESS: "email@domain.com"
      MAIL_PASSWORD: "thepass"
      MAIL_USERNAME: "email@domain.com"
      MAIL_SERVER: "mail.domain.com"
      MAX_WORKERS: "1" # Very important
      MAIL_PORT: "587"
      SECRET_KEY: "thesecretkey"
      ACCESS_TOKEN_EXPIRE_MINUTES: 30
      SKIP_EMAIL_VERIFICATION: True
      HCAPTCHA_KEY: "ee81b2a1-acf3-4d20-b2a4-a7ea94c7eba5"
      MEILISEARCH_URL: "http://meilisearch:7700"
      STORAGE_BACKEND: "local"
      STORAGE_PATH: "/app/data"
      REGISTRATION_DISABLED: "True"

  redis:
    image: redis:alpine
    restart: always
    networks:
      - rss_default
    healthcheck:
      test: [ "CMD", "redis-cli","ping" ]

  db:
    image: postgres:14-alpine
    restart: always
    networks:
      - rss_default
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U postgres" ]
      interval: 5s
      timeout: 5s
      retries: 5
    environment:
      POSTGRES_PASSWORD: "classquiz"
      POSTGRES_DB: "classquiz"
    volumes:
      - data:/var/lib/postgresql/data
  proxy:
    image: caddy:alpine
    restart: always
    networks:
      - rss_default
    volumes:
      - ./Caddyfile-docker:/etc/caddy/Caddyfile
    ports:
      - "9001:8080"
  meilisearch:
    image: getmeili/meilisearch:v0.28.0
    restart: always
    networks:
      - rss_default
    environment:
      MEILI_NO_ANALYTICS: true
    volumes:
      - meilisearch-data:/data.ms
  worker:
    build: *build_cfg
    environment: *env_vars
    depends_on: *depends
    restart: *restart
    networks:
      - rss_default
    command: arq classquiz.worker.WorkerSettings

networks:
  rss_default:
   name: rss_default

volumes:
  data:
   driver: local-persist
   driver_opts:
     mountpoint: /scsi1/quiz/data

  meilisearch-data:
   driver: local-persist
   driver_opts:
     mountpoint: /scsi1/quiz/melisearchdata

@mawoka-myblock
Copy link
Owner

You have to set it in the frontend/Dockerfile.

@killmasta93
Copy link

oh gotcha like this?

image

image
not sure if i missed something?

@mawoka-myblock
Copy link
Owner

Looks good!

@killmasta93
Copy link

thanks for the reply, the odd issue is that after running docker-compose build i recheck and it shows the registration option still
not sure what i missed?

@mawoka-myblock
Copy link
Owner

I'll investigate further when I got some spare time.

@mawoka-myblock
Copy link
Owner

mawoka-myblock commented Jan 3, 2024

Hmmm... I checked again and it works for me. Could please try to add it into the docker-compose.yml for the frontend container as well?

Nevermind, you also got it in your docker-compose.yml

@mawoka-myblock
Copy link
Owner

Maybe add it above the WORKDIR in the Dockerfile? And did you try to hard-refresh your browser with STRG + F5?

@killmasta93
Copy link

hi there so wanted to see what i could be doing wrong, as it keeps showing the register button
image

this is the docker file

ClassQuiz# cat frontend/Dockerfile
# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
#
# SPDX-License-Identifier: MPL-2.0

### Build Step
# pull the Node.js Docker image
FROM node:19-bullseye as builder
# ENV API_URL=http://api:80
ENV API_URL=https://mawoka.eu
#Ah, I've noticed that!!!
ENV VITE_REGISTRATION_DISABLED=True
ENV REDIS_URL=redis://localhost:6379
ENV VITE_MAPBOX_ACCESS_TOKEN=pk.eyJ1IjoibWF3b2thIiwiYSI6ImNsMjBob3d4ZjBhcGszYnE0bWp4aXB1ZW4ifQ.IByxV1qeIuEWpHCWsuB88A
# This Mapbox-token is restricted to the following urls: classquiz.de, classquiz.mawoka.eu, test.com
ENV VITE_HCAPTCHA=exxxxxx
# ENV VITE_SENTRY=https://75cb4ef1be624d8f81bbaf864b722f8a@glitch.mawoka.eu/2
#ENV VITE_GOOGLE_AUTH_ENABLED=true
#ENV VITE_GITHUB_AUTH_ENABLED=true
ENV VITE_CAPTCHA_ENABLED=true
ENV VITE_REGISTRATION_DISABLED=True
#ENV VITE_PLAUSIBLE_DATA_URL=
# change working directory
WORKDIR /usr/src/app

# copy the package.json files from local machine to the workdir in container
COPY package*.json ./
COPY pnpm-lock.yaml ./

# run npm install in our local machine
RUN corepack enable && corepack prepare pnpm@8.6.1 --activate && pnpm i

# copy the generated modules and all other files to the container
COPY . .

# build the application
RUN pnpm run build

### Serve Step
# pull the Node.js Docker image
FROM node:19-bullseye-slim

# change working directory
WORKDIR /app
COPY --from=builder /usr/src/app/package.json .
COPY --from=builder /usr/src/app/pnpm-lock.yaml .
RUN corepack enable && corepack prepare pnpm@8.6.1 --activate && pnpm i
# copy files from previous step
COPY --from=builder /usr/src/app/build .
COPY --from=builder /usr/src/app/node_modules ./node_modules

# our app is running on port 3000 within the container, so need to expose it
EXPOSE 3000

# the command that starts our app
CMD ["pnpm", "run", "run:prod"]

and the docker compose

version: "3"

services:
  frontend:
    restart: always
    build:
      context: ./frontend
      dockerfile: Dockerfile
    depends_on:
      - redis
      - api
    networks:
      - rss_default
    environment:
      REDIS_URL: redis://redis:6379/0?decode_responses=True
      API_URL: http://api:80
  api:
    build: &build_cfg
      context: .
      dockerfile: Dockerfile
    restart: &restart always
    networks:
      - rss_default
    depends_on: &depends
      - db
      - redis

    environment: &env_vars
      ROOT_ADDRESS: "https://quiz.domain.com" # Base-URL (change it)
      DB_URL: "postgresql://postgres:classquiz@db:5432/classquiz"
      REDIS: "redis://redis:6379/0?decode_responses=True"
      MAIL_ADDRESS: "noticias@domain.com.co"
      MAIL_PASSWORD: "9xxxx"
      MAIL_USERNAME: "noticias@domain.com.co"
      MAIL_SERVER: "mail.domain.com.co"
      MAX_WORKERS: "1" # Very important
      MAIL_PORT: "587"
      SECRET_KEY: "fxxxxx"
      ACCESS_TOKEN_EXPIRE_MINUTES: 30
      SKIP_EMAIL_VERIFICATION: True
      HCAPTCHA_KEY: "eexxxxxx"
      MEILISEARCH_URL: "http://meilisearch:7700"
      STORAGE_BACKEND: "local"
      STORAGE_PATH: "/app/data"
      REGISTRATION_DISABLED: "True"


  redis:
    image: redis:alpine
    restart: always
    networks:
      - rss_default
    healthcheck:
      test: [ "CMD", "redis-cli","ping" ]

  db:
    image: postgres:14-alpine
    restart: always
    networks:
      - rss_default
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U postgres" ]
      interval: 5s
      timeout: 5s
      retries: 5
    environment:
      POSTGRES_PASSWORD: "classquiz"
      POSTGRES_DB: "classquiz"
    volumes:
      - data:/var/lib/postgresql/data
  proxy:
    image: caddy:alpine
    restart: always
    networks:
      - rss_default
    volumes:
      - ./Caddyfile-docker:/etc/caddy/Caddyfile
    ports:
      - "9001:8080"
  meilisearch:
    image: getmeili/meilisearch:v0.28.0
    restart: always
    networks:
      - rss_default
    environment:
      MEILI_NO_ANALYTICS: true
    volumes:
      - meilisearch-data:/data.ms
  worker:
    build: *build_cfg
    environment: *env_vars
    depends_on: *depends
    restart: *restart
    networks:
      - rss_default
    command: arq classquiz.worker.WorkerSettings

networks:
  rss_default:
   name: rss_default

volumes:
  data:
   driver: local-persist
   driver_opts:
     mountpoint: /scsi1/quiz/data

  meilisearch-data:
   driver: local-persist
   driver_opts:
     mountpoint: /scsi1/quiz/melisearchdata

after that i did a docker-compose down -v

then a docker-compose build

then a docker-compose up -d

i also tried deleting all containers and recreated from scratch

Also tried accessing on another computer which never accessed the site before

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity:1 enhancement New feature or request prio:1 Low priority
Projects
None yet
Development

No branches or pull requests

3 participants