From 51291fce1c4b393c5205602923f1aa572d74109a Mon Sep 17 00:00:00 2001 From: gabrielcastrosilva Date: Tue, 4 Jan 2022 14:54:50 -0300 Subject: [PATCH 1/3] Added quality of life dev tools --- Dockerfile.dev | 24 ++++++++++++++++++++++++ Makefile | 13 +++++++++++++ dev.yml | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 Dockerfile.dev create mode 100644 Makefile create mode 100644 dev.yml diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 000000000..096adf664 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,24 @@ +FROM node:12-alpine + +RUN apk add --update bash + +# Setting working directory. +WORKDIR /usr/src/app + +# Installing dependencies +COPY package*.json ./ +RUN npm install + +# Copying source files +COPY . . + +# Give permission to run script +RUN chmod +x ./wait-for-it.sh + +# Build files +RUN npm run build + +EXPOSE 3000 + +# Running the app +CMD [ "npm", "start" ] \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..0bf88ea54 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +DOCKER_USERNAME?=mconf +REPOSITORY?=kutt +IMAGE_NAME=$(DOCKER_USERNAME)/$(REPOSITORY) +REVISION?=$(shell git rev-parse --short HEAD) + +up-dev: + docker-compose -f dev.yml up + +up: + docker-compose up + +docker-build-dev: + docker build --rm -f Dockerfile.dev -t $(IMAGE_NAME):dev-latest --build-arg git_token=$(GIT_TOKEN) . \ No newline at end of file diff --git a/dev.yml b/dev.yml new file mode 100644 index 000000000..4b1c23d2f --- /dev/null +++ b/dev.yml @@ -0,0 +1,37 @@ +version: "3" + +services: + mconf-kutt-dev: + image: mconf/kutt:dev-latest + depends_on: + - postgres + - redis + command: ["./wait-for-it.sh", "postgres:5432", "--", "npm", "start"] + ports: + - "3000:3000" + env_file: + - .env + environment: + DB_HOST: postgres + DB_NAME: kutt + DB_USER: user + DB_PASSWORD: pass + REDIS_HOST: redis + + redis: + image: redis:6.0-alpine + volumes: + - redis_data:/data + + postgres: + image: postgres:12-alpine + environment: + POSTGRES_USER: user + POSTGRES_PASSWORD: pass + POSTGRES_DB: kutt + volumes: + - postgres_data:/var/lib/postgresql/data + +volumes: + redis_data: + postgres_data: From 2b953309b3436ef5424fc718ad5b96daaaa06a44 Mon Sep 17 00:00:00 2001 From: gabrielcastrosilva Date: Tue, 4 Jan 2022 15:02:32 -0300 Subject: [PATCH 2/3] Sign up button removal --- client/components/Header.tsx | 4 ++-- client/pages/login.tsx | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/components/Header.tsx b/client/components/Header.tsx index 2d4fb4417..21bc588e1 100644 --- a/client/components/Header.tsx +++ b/client/components/Header.tsx @@ -58,11 +58,11 @@ const Header: FC = () => { diff --git a/client/pages/login.tsx b/client/pages/login.tsx index 5a9986cce..ef240597b 100644 --- a/client/pages/login.tsx +++ b/client/pages/login.tsx @@ -146,6 +146,12 @@ const LoginPage = () => { /> Log in + {/* + + If signing up is required + again for whatever reason, + just remove this comment + {!DISALLOW_REGISTRATION && ( )} + */} Date: Mon, 10 Jan 2022 16:43:05 -0300 Subject: [PATCH 3/3] Fixed build ignoring .env --- .dockerignore | 1 - .example.env | 2 +- client/components/Header.tsx | 4 ++-- client/pages/login.tsx | 7 ------- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.dockerignore b/.dockerignore index 1e63545e1..6a416c675 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,3 @@ -.env .git node_modules production-server diff --git a/.example.env b/.example.env index def63616b..ad5ead1e5 100644 --- a/.example.env +++ b/.example.env @@ -30,7 +30,7 @@ REDIS_PORT=6379 REDIS_PASSWORD= # Disable registration -DISALLOW_REGISTRATION=false +DISALLOW_REGISTRATION=true # Disable anonymous link creation DISALLOW_ANONYMOUS_LINKS=false diff --git a/client/components/Header.tsx b/client/components/Header.tsx index 21bc588e1..2d4fb4417 100644 --- a/client/components/Header.tsx +++ b/client/components/Header.tsx @@ -58,11 +58,11 @@ const Header: FC = () => { diff --git a/client/pages/login.tsx b/client/pages/login.tsx index ef240597b..5a9986cce 100644 --- a/client/pages/login.tsx +++ b/client/pages/login.tsx @@ -146,12 +146,6 @@ const LoginPage = () => { /> Log in - {/* - - If signing up is required - again for whatever reason, - just remove this comment - {!DISALLOW_REGISTRATION && ( )} - */}