3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Remove docker-compose wrapper script; fixes to devcontainers

This commit is contained in:
Dragory 2022-06-26 23:15:36 +03:00
parent db84d80e74
commit 17fa857609
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
7 changed files with 17 additions and 54 deletions

View file

@ -1,8 +1,7 @@
{ {
"name": "Zeppelin Development", "name": "Zeppelin Development",
"dockerComposeFile": "../docker/development/docker-compose.yml", "dockerComposeFile": "../docker-compose.yml",
"runArgs": ["--env-file", "../.env"],
"service": "devenv", "service": "devenv",
"remoteUser": "ubuntu", "remoteUser": "ubuntu",

View file

@ -34,6 +34,9 @@ DOCKER_DEV_MYSQL_ROOT_PASSWORD=
DOCKER_DEV_SSH_PORT=3002 DOCKER_DEV_SSH_PORT=3002
DOCKER_DEV_SSH_PASSWORD=password DOCKER_DEV_SSH_PASSWORD=password
# If your user has a different UID than 1000, you might have to fill that in here to avoid permission issues
#DOCKER_DEV_UID=1000
# #
# PRODUCTION # PRODUCTION
# #

View file

@ -2,6 +2,8 @@
Zeppelin's development environment runs entirely within a Docker container. Zeppelin's development environment runs entirely within a Docker container.
Below you can find instructions for setting up the environment and getting started with development! Below you can find instructions for setting up the environment and getting started with development!
👉 **No support is offered for self-hosting the bot!** 👈
## Starting the development environment ## Starting the development environment
### Using VSCode devcontainers ### Using VSCode devcontainers
@ -15,7 +17,7 @@ Below you can find instructions for setting up the environment and getting start
1. Install Docker 1. Install Docker
2. Make a copy of `.env.example` called `.env` 2. Make a copy of `.env.example` called `.env`
3. Fill in the missing values in `.env` 3. Fill in the missing values in `.env`
4. Run `./docker-compose-dev.sh up` to start the development environment 4. Run `docker-compose up` to start the development environment
5. In VSCode: Install the `Remote - SSH` plugin 5. In VSCode: Install the `Remote - SSH` plugin
6. In VSCode: Run `Remote-SSH: Connect to Host...` 6. In VSCode: Run `Remote-SSH: Connect to Host...`
* As the address, use `ubuntu@127.0.0.1:3002` (where `3002` matches `DOCKER_DEV_SSH_PORT` in `.env`) * As the address, use `ubuntu@127.0.0.1:3002` (where `3002` matches `DOCKER_DEV_SSH_PORT` in `.env`)
@ -26,7 +28,7 @@ Below you can find instructions for setting up the environment and getting start
1. Install Docker 1. Install Docker
2. Make a copy of `.env.example` called `.env` 2. Make a copy of `.env.example` called `.env`
3. Fill in the missing values in `.env` 3. Fill in the missing values in `.env`
4. Run `./docker-compose-dev.sh up` to start the development environment 4. Run `docker-compose up` to start the development environment
5. Choose `Connect via SSH` and create a new connection: 5. Choose `Connect via SSH` and create a new connection:
* Username: `ubuntu` * Username: `ubuntu`
* Host: `127.0.0.1` * Host: `127.0.0.1`
@ -41,7 +43,7 @@ Below you can find instructions for setting up the environment and getting start
1. Install Docker 1. Install Docker
2. Make a copy of `.env.example` called `.env` 2. Make a copy of `.env.example` called `.env`
3. Fill in the missing values in `.env` 3. Fill in the missing values in `.env`
4. Run `./docker-compose-dev.sh up` to start the development environment 4. Run `docker-compose up` to start the development environment
5. Use the following credentials for connecting with your IDE: 5. Use the following credentials for connecting with your IDE:
* Host: `127.0.0.1` * Host: `127.0.0.1`
* Port: `3002` (matching the `DOCKER_DEV_SSH_PORT` value in `.env`) * Port: `3002` (matching the `DOCKER_DEV_SSH_PORT` value in `.env`)

View file

@ -20,46 +20,9 @@ Zeppelin is a moderation bot for Discord, designed with large servers and reliab
See https://zeppelin.gg/ for more details. See https://zeppelin.gg/ for more details.
## Development ## Development
These instructions are intended for bot development only.
👉 **No support is offered for self-hosting the bot!** 👈 👉 **No support is offered for self-hosting the bot!** 👈
### Running the bot See [DEVELOPMENT.md](./DEVELOPMENT.md) for instructions on running the development environment!
1. `cd backend`
2. `npm ci`
3. Make a copy of `bot.env.example` called `bot.env`, fill in the values
4. Run the desired start script:
* `npm run build` followed by `npm run start-bot-dev` to run the bot in a **development** environment
* `npm run build` followed by `npm run start-bot-prod` to run the bot in a **production** environment
* `npm run watch` to watch files and run the **bot and api both** in a **development** environment
with automatic restart on file changes
5. When testing, make sure you have your test server in the `allowed_guilds` table or the guild's config won't be loaded at all
### Running the API server
1. `cd backend`
2. `npm ci`
3. Make a copy of `api.env.example` called `api.env`, fill in the values
4. Run the desired start script:
* `npm run build` followed by `npm run start-api-dev` to run the api in a **development** environment
* `npm run build` followed by `npm run start-api-prod` to run the api in a **production** environment
* `npm run watch` to watch files and run the **bot and api both** in a **development** environment
with automatic restart on file changes
### Running the dashboard
1. `cd dashboard`
2. `npm ci`
3. Make a copy of `.env.example` called `.env`, fill in the values
4. Run the desired start script:
* `npm run build` compiles the dashboard's static files to `dist/` which can then be served with any web server
* `npm run watch` runs webpack's dev server that automatically reloads on changes
### Notes
* Since we now use shared paths in `tsconfig.json`, the compiled files in `backend/dist/` have longer paths, e.g.
`backend/dist/backend/src/index.js` instead of `backend/dist/index.js`. This is because the compiled shared files
are placed in `backend/dist/shared`.
* The `backend/register-tsconfig-paths.js` module takes care of registering shared paths from `tsconfig.json` for
`ava` and compiled `.js` files
* To run the tests for the files in the `shared/` directory, you also need to run `npm ci` there
### Config format example ### Config format example
Configuration is stored in the database in the `configs` table Configuration is stored in the database in the `configs` table

View file

@ -1,3 +0,0 @@
#!/bin/bash
DOCKER_UID="$(id -u)" DOCKER_STAY_RUNNING=1 docker-compose --env-file ./.env -f ./docker/development/docker-compose.yml "$@"

View file

@ -7,14 +7,14 @@ volumes:
services: services:
nginx: nginx:
build: build:
context: ./nginx context: ./docker/development/nginx
args: args:
DOCKER_DEV_WEB_PORT: ${DOCKER_DEV_WEB_PORT:?Missing DOCKER_DEV_WEB_PORT} DOCKER_DEV_WEB_PORT: ${DOCKER_DEV_WEB_PORT:?Missing DOCKER_DEV_WEB_PORT}
API_PORT: ${API_PORT:?Missing API_PORT} API_PORT: ${API_PORT:?Missing API_PORT}
ports: ports:
- "${DOCKER_DEV_WEB_PORT:?Missing DOCKER_DEV_WEB_PORT}:443" - "${DOCKER_DEV_WEB_PORT:?Missing DOCKER_DEV_WEB_PORT}:443"
volumes: volumes:
- ../../:/zeppelin - ./:/zeppelin
mysql: mysql:
image: mysql:8.0 image: mysql:8.0
@ -31,15 +31,14 @@ services:
devenv: devenv:
build: build:
context: ./devenv context: ./docker/development/devenv
args: args:
DOCKER_DEV_SSH_PASSWORD: ${DOCKER_DEV_SSH_PASSWORD:?Missing DOCKER_DEV_SSH_PASSWORD} DOCKER_DEV_SSH_PASSWORD: ${DOCKER_DEV_SSH_PASSWORD:?Missing DOCKER_DEV_SSH_PASSWORD}
DOCKER_UID: ${DOCKER_UID:?Missing DOCKER_UID} DOCKER_DEV_UID: ${DOCKER_DEV_UID:-1000}
DOCKER_STAY_RUNNING: ${DOCKER_STAY_RUNNING}
ports: ports:
- "${DOCKER_DEV_SSH_PORT:?Missing DOCKER_DEV_SSH_PORT}:22" - "${DOCKER_DEV_SSH_PORT:?Missing DOCKER_DEV_SSH_PORT}:22"
volumes: volumes:
- ../../:/home/ubuntu/zeppelin - ./:/home/ubuntu/zeppelin
- ~/.ssh:/home/ubuntu/.ssh - ~/.ssh:/home/ubuntu/.ssh
- vscode-remote:/home/ubuntu/.vscode-remote - vscode-remote:/home/ubuntu/.vscode-remote
- vscode-server:/home/ubuntu/.vscode-server - vscode-server:/home/ubuntu/.vscode-server

View file

@ -1,6 +1,6 @@
FROM ubuntu:20.04 FROM ubuntu:20.04
ARG DOCKER_UID=1000 ARG DOCKER_DEV_UID
ARG DOCKER_DEV_SSH_PASSWORD ARG DOCKER_DEV_SSH_PASSWORD
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
@ -13,7 +13,7 @@ RUN apt-get install -y sudo git curl
# Set up SSH access # Set up SSH access
RUN apt-get install -y openssh-server iptables RUN apt-get install -y openssh-server iptables
RUN mkdir /var/run/sshd RUN mkdir /var/run/sshd
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u $DOCKER_UID ubuntu RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u $DOCKER_DEV_UID ubuntu
RUN echo "ubuntu:${DOCKER_DEV_SSH_PASSWORD}" | chpasswd RUN echo "ubuntu:${DOCKER_DEV_SSH_PASSWORD}" | chpasswd
# Set up proper permissions for volumes # Set up proper permissions for volumes