From 708b9ab5f360e213f3cdb11f440a7ee9b9990dd4 Mon Sep 17 00:00:00 2001 From: MotorTruck1221 Date: Sun, 20 Aug 2023 23:39:07 -0600 Subject: [PATCH 1/5] Add docker --- .env.example | 2 +- .gitignore | 8 +++++++- docker/.dockerignore | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 docker/.dockerignore diff --git a/.env.example b/.env.example index d99aa17..836c1a8 100644 --- a/.env.example +++ b/.env.example @@ -18,4 +18,4 @@ GUILD_ID= OWNER_ID= # Cooldown time in ms (set to 0 to disable) -COOLDOWN_TIME=2000 \ No newline at end of file +COOLDOWN_TIME=2000 diff --git a/.gitignore b/.gitignore index fb0aec7..c6b4bc0 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,10 @@ node_modules /src/modals/EvalModal.ts # build -/dist \ No newline at end of file +/dist + + +# User generated docker files +docker-compose.yml +Dockerfile +/db diff --git a/docker/.dockerignore b/docker/.dockerignore new file mode 100644 index 0000000..8ecbae6 --- /dev/null +++ b/docker/.dockerignore @@ -0,0 +1,2 @@ +# DB +/db From d16f48f0d1a5ae4f2b6f2d31bd7da4c36baf34b3 Mon Sep 17 00:00:00 2001 From: MotorTruck1221 Date: Sun, 20 Aug 2023 23:40:43 -0600 Subject: [PATCH 2/5] docker 2 --- .gitignore | 6 ++--- docker/Dockerfile | 8 +++++++ docker/docker-compose.yml | 46 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 docker/Dockerfile create mode 100644 docker/docker-compose.yml diff --git a/.gitignore b/.gitignore index c6b4bc0..e4fe5a6 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ node_modules /dist -# User generated docker files -docker-compose.yml -Dockerfile +# User generated docker files (Root of the project only) /db +/docker-compose.yml +/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..6d00529 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,8 @@ +FROM node:latest +WORKDIR /usr/src/app +COPY package*.json ./ +COPY . . +RUN npm install +RUN cp .env.example .env +RUN chmod u+x ./start.sh +CMD ["./start.sh"] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..83b588b --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,46 @@ +version: "3" +services: + dispenser-fork: + image: dispenser-fork + build: . + container_name: dispenser-fork + restart: unless-stopped + environment: + #DO NOT CHANGE THE HOST + POSTGRES_HOST: db + #DO NOT CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING + POSTGRES_USER: dispenser-fork + #CHANGE THE PASSWORD TO SOMETHING MORE SECURE (RECOMMENDED) + POSTGRES_PASSWORD: postgres + #DO NOT CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING!! + POSTGRES_DB: dispenser-fork + #THIS SHOULDN'T NEED TO CHANGE + DATABASE_URL: postgres://dispenser-fork:postgres@db:5432/dispenser-fork + #### + #ANYTHING BELOW THIS NEEDS TO BE EDITED + #The discord bot's token (REQUIRED) + TOKEN: token + #The Bot ID for slash command deployment (REQUIRED) + CLIENT_ID: clientID + #The Server ID for quick deployment (Not required but recommended for quick deployment, delete line to disable) + GUILD_ID: guildID + # The ID of the Bot owner (NOT REQUIRED, delete line to disable) + OWNER_ID: ownerID + # Cooldown time in ms (set to 0 to disable) + COOLDOWN_TIME: 2000 + depends_on: + - db + db: + image: postgres:latest + container_name: dispenser-fork-db + restart: unless-stopped + environment: + POSTGRES_USER: dispenser-fork + POSTGRES_PASSWORD: postgres + POSTGRES_DB: dispenser-fork + volumes: + - ./db:/var/lib/postgresql/data +networks: + default: + external: false + name: dispenser-fork-network From f4d5186f60a13b52722b4bc5aeb14101515f6353 Mon Sep 17 00:00:00 2001 From: MotorTruck1221 Date: Fri, 3 Nov 2023 16:24:58 -0600 Subject: [PATCH 3/5] Add basic instructions for docker --- docker.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 docker.md diff --git a/docker.md b/docker.md new file mode 100644 index 0000000..b3c109f --- /dev/null +++ b/docker.md @@ -0,0 +1,40 @@ +# Docker installation + +## Requirements: +- Docker +- Docker-compose + +## Setup: +- Clone the repository +```bash +git clone https://github.com/nebulaServices/dispenser.git +cd dispenser +``` + +- Copy the everything from the `docker` directory to the root of the project +```bash +cp -r docker/* . +``` + +- Edit the docker-compose.yml file and change the env vars + - TOKEN + - CLIENT_ID + - GUILD_ID + - OWNER_ID (optional) + - COOLDOWN_TIME + +*The other ones listed are not to be changed unless you know what you are doing* + +- Build the image +```bash +docker-compose build +``` + +*You may have to run this as `sudo`* + +- Run the image +```bash +docker-compose up -d +``` + +And that's it, the bot should be running now. From e79bf86a7a728d06057b5f33bd529cf83ecb4b18 Mon Sep 17 00:00:00 2001 From: MotorTruck1221 Date: Sat, 4 Nov 2023 00:21:41 -0600 Subject: [PATCH 4/5] Remove docker/ --- docker.md | 5 ----- docker/.dockerignore | 2 -- docker/Dockerfile | 8 ------- docker/docker-compose.yml | 46 --------------------------------------- 4 files changed, 61 deletions(-) delete mode 100644 docker/.dockerignore delete mode 100644 docker/Dockerfile delete mode 100644 docker/docker-compose.yml diff --git a/docker.md b/docker.md index b3c109f..f84dc36 100644 --- a/docker.md +++ b/docker.md @@ -11,11 +11,6 @@ git clone https://github.com/nebulaServices/dispenser.git cd dispenser ``` -- Copy the everything from the `docker` directory to the root of the project -```bash -cp -r docker/* . -``` - - Edit the docker-compose.yml file and change the env vars - TOKEN - CLIENT_ID diff --git a/docker/.dockerignore b/docker/.dockerignore deleted file mode 100644 index 8ecbae6..0000000 --- a/docker/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -# DB -/db diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 6d00529..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM node:latest -WORKDIR /usr/src/app -COPY package*.json ./ -COPY . . -RUN npm install -RUN cp .env.example .env -RUN chmod u+x ./start.sh -CMD ["./start.sh"] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100644 index 83b588b..0000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,46 +0,0 @@ -version: "3" -services: - dispenser-fork: - image: dispenser-fork - build: . - container_name: dispenser-fork - restart: unless-stopped - environment: - #DO NOT CHANGE THE HOST - POSTGRES_HOST: db - #DO NOT CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING - POSTGRES_USER: dispenser-fork - #CHANGE THE PASSWORD TO SOMETHING MORE SECURE (RECOMMENDED) - POSTGRES_PASSWORD: postgres - #DO NOT CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING!! - POSTGRES_DB: dispenser-fork - #THIS SHOULDN'T NEED TO CHANGE - DATABASE_URL: postgres://dispenser-fork:postgres@db:5432/dispenser-fork - #### - #ANYTHING BELOW THIS NEEDS TO BE EDITED - #The discord bot's token (REQUIRED) - TOKEN: token - #The Bot ID for slash command deployment (REQUIRED) - CLIENT_ID: clientID - #The Server ID for quick deployment (Not required but recommended for quick deployment, delete line to disable) - GUILD_ID: guildID - # The ID of the Bot owner (NOT REQUIRED, delete line to disable) - OWNER_ID: ownerID - # Cooldown time in ms (set to 0 to disable) - COOLDOWN_TIME: 2000 - depends_on: - - db - db: - image: postgres:latest - container_name: dispenser-fork-db - restart: unless-stopped - environment: - POSTGRES_USER: dispenser-fork - POSTGRES_PASSWORD: postgres - POSTGRES_DB: dispenser-fork - volumes: - - ./db:/var/lib/postgresql/data -networks: - default: - external: false - name: dispenser-fork-network From 0629ac2d4219ed980164de50066fe5ae050c9629 Mon Sep 17 00:00:00 2001 From: MotorTruck1221 Date: Sat, 4 Nov 2023 00:22:55 -0600 Subject: [PATCH 5/5] Fix .gitignore --- .gitignore | 2 -- Dockerfile | 8 ++++++++ docker-compose.yml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index e4fe5a6..d91dbba 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,3 @@ node_modules # User generated docker files (Root of the project only) /db -/docker-compose.yml -/Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6d00529 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM node:latest +WORKDIR /usr/src/app +COPY package*.json ./ +COPY . . +RUN npm install +RUN cp .env.example .env +RUN chmod u+x ./start.sh +CMD ["./start.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..83b588b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,46 @@ +version: "3" +services: + dispenser-fork: + image: dispenser-fork + build: . + container_name: dispenser-fork + restart: unless-stopped + environment: + #DO NOT CHANGE THE HOST + POSTGRES_HOST: db + #DO NOT CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING + POSTGRES_USER: dispenser-fork + #CHANGE THE PASSWORD TO SOMETHING MORE SECURE (RECOMMENDED) + POSTGRES_PASSWORD: postgres + #DO NOT CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING!! + POSTGRES_DB: dispenser-fork + #THIS SHOULDN'T NEED TO CHANGE + DATABASE_URL: postgres://dispenser-fork:postgres@db:5432/dispenser-fork + #### + #ANYTHING BELOW THIS NEEDS TO BE EDITED + #The discord bot's token (REQUIRED) + TOKEN: token + #The Bot ID for slash command deployment (REQUIRED) + CLIENT_ID: clientID + #The Server ID for quick deployment (Not required but recommended for quick deployment, delete line to disable) + GUILD_ID: guildID + # The ID of the Bot owner (NOT REQUIRED, delete line to disable) + OWNER_ID: ownerID + # Cooldown time in ms (set to 0 to disable) + COOLDOWN_TIME: 2000 + depends_on: + - db + db: + image: postgres:latest + container_name: dispenser-fork-db + restart: unless-stopped + environment: + POSTGRES_USER: dispenser-fork + POSTGRES_PASSWORD: postgres + POSTGRES_DB: dispenser-fork + volumes: + - ./db:/var/lib/postgresql/data +networks: + default: + external: false + name: dispenser-fork-network