From 3938fb0920a4414c2850bc7d882304f6a57f64e0 Mon Sep 17 00:00:00 2001 From: sherl Date: Wed, 21 Jan 2026 04:39:19 +0100 Subject: [PATCH] feat: add Docker support --- .dockerignore | 4 ++++ .env.default | 13 ++++++++++--- .gitignore | 3 ++- docker-compose.yaml | 31 ++++++++++++++++++++----------- kittyBE | 2 +- kittyFE | 2 +- 6 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..03009e8 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +# .env +.env +# Database +db diff --git a/.env.default b/.env.default index c6a1812..74274d6 100644 --- a/.env.default +++ b/.env.default @@ -1,9 +1,13 @@ # ========== Global config ========== - +DB_DATA_LOCATION=./db # Relative path in which database should be stored. +CURRENT_DIRECTORY_ABSOLUTE_PATH=/path/to/kittyurl/ # Absolute path to current directory. Note the trailing slash. # ============= Backend ============= -BACKEND_PORT=6567 # Port on which the backend service should listen to requests. -BACKEND_VERSION=latest # Want to use a specific image for backend? Put the branch here followed by a release tag (like master-v1.2.3). Otherwise the latest one will get pulled. +BACKEND_PORT=6567 # Port on which the backend service should listen to requests. +BACKEND_VERSION=latest # Want to use a specific image for backend? Put the branch here followed by a release tag (like master-v1.2.3). Otherwise the latest one will get pulled. +ACCESS_TOKEN_PRIVATE_KEY=CHANGE_ME_TO_SOMETHING_RANDOM # Used to generate user tokens. Make sure this is pretty random. +TRUSTED_ORIGINS=http://localhost:6568,http://127.0.0.1:6568 # Comma separated list of trusted origins. Make sure to include your PUBLIC_URL here. +PATH_TO_WORDLIST=kittyBE/wordlist.example-large.ts # Relative path (considering CURRENT_DIRECTORY_ABSOLUTE_PATH) to wordlist to use when generating URLs. Note there is no slash at start. # Postgres and TypeORM PG_USER=kitty @@ -21,3 +25,6 @@ DEBUG=false # Set to `false` to disable some features not mea # ============ Frontend ============ FRONTEND_PORT=6568 # Port on which the frontend service should listen to requests. FRONTEND_VERSION=latest # Want to use a specific image for frontend? Put the branch here followed by a release tag (like master-v1.2.3). Otherwise the latest one will get pulled. + +VITE_API_TARGET=http://localhost:6567 # The backend API base URL you want to use. +VITE_ALLOWED_HOST=example.com # Hosts allowed when visiting frontend. Probably should match PUBLIC_URL (tweak this when running a reverse proxy). To allow subdomains, add a dot (.) before the host address (vite.dev/config/server-options#server-allowedhosts). diff --git a/.gitignore b/.gitignore index 55f7525..03009e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ # .env .env - +# Database +db diff --git a/docker-compose.yaml b/docker-compose.yaml index 1815559..c43d250 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,16 +6,18 @@ name: kittyurl services: - # kittyfe: - # container_name: frontend - # image: gitea.7o7.cx/kittyteam/kittyfe:${FRONTEND_VERSION:-latest} - # env_file: - # - .env - # ports: - # - ${FRONTEND_PORT}:6568 - # depends_on: - # - kittybe - # restart: unless-stopped + kittyfe: + container_name: frontend + image: gitea.7o7.cx/kittyteam/kittyfe:${FRONTEND_VERSION:-latest} + env_file: + - .env + ports: + - ${FRONTEND_PORT}:6568 + depends_on: + - kittybe + volumes: + - ${CURRENT_DIRECTORY_ABSOLUTE_PATH}.env:/.env + restart: unless-stopped kittybe: container_name: backend @@ -26,6 +28,11 @@ services: - ${BACKEND_PORT}:6567 depends_on: - postgres + volumes: + # Change me if you want to store wordlist somewhere else. + # Remember, Docker requires you to point out absolute path when mounting + # only a single file. + - ${CURRENT_DIRECTORY_ABSOLUTE_PATH}${PATH_TO_WORDLIST}:/app/src/tools/wordlist.ts restart: unless-stopped postgres: @@ -38,4 +45,6 @@ services: POSTGRES_USER: ${PG_USER} POSTGRES_PASSWORD: ${PG_PASS} POSTGRES_DB: ${PG_DB} - + volumes: + - ${DB_DATA_LOCATION}:/var/lib/postgresql/data + shm_size: 128mb diff --git a/kittyBE b/kittyBE index 58460d9..dfc3f4c 160000 --- a/kittyBE +++ b/kittyBE @@ -1 +1 @@ -Subproject commit 58460d988d39448bf6d5554b282b527fc12b16df +Subproject commit dfc3f4cd8791a2ab3ec7e9a6f340ef1452f02b21 diff --git a/kittyFE b/kittyFE index 686ed03..447ea1c 160000 --- a/kittyFE +++ b/kittyFE @@ -1 +1 @@ -Subproject commit 686ed0340eec01ca10298b72e6851b0548896888 +Subproject commit 447ea1c761ad2939bea526d51117a329ff743c43