-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
682 changed files
with
24,954 additions
and
35,999 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"contributors": [ | ||
"BanTheNons", | ||
"CleverSource", | ||
"DarkView", | ||
"DenverCoder1", | ||
"Jernik", | ||
"Rstar284", | ||
"almeidx", | ||
"axisiscool", | ||
"dexbiobot", | ||
"greenbigfrog", | ||
"k200-1", | ||
"metal0", | ||
"paolojpa", | ||
"roflmaoqwerty", | ||
"thewilloftheshadow", | ||
"usoka", | ||
"vcokltfre", | ||
"Dragory", | ||
"rubyowo", | ||
"Dalkskkskk", | ||
"iamshoXy", | ||
"Scraayp", | ||
"app/dependabot", | ||
"zayKenyon", | ||
"rukogit", | ||
"Obliie", | ||
"brawaru", | ||
"Benricheson101", | ||
"hawkeye7662" | ||
], | ||
"message": "Thank you for contributing to Zeppelin! We require contributors to sign our Contributor License Agreement (CLA). To let us review and merge your code, please visit https://github.com/ZeppelinBot/CLA to sign the CLA!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "Zeppelin Development", | ||
|
||
"dockerComposeFile": "../docker-compose.development.yml", | ||
|
||
"service": "devenv", | ||
"remoteUser": "ubuntu", | ||
"workspaceFolder": "/home/ubuntu/zeppelin" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.git | ||
.github | ||
.idea | ||
.devcontainer | ||
|
||
/docker/development/data | ||
/docker/production/data | ||
|
||
node_modules | ||
/backend/dist | ||
/dashboard/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,74 @@ | ||
KEY=32_character_encryption_key | ||
# 32 character encryption key | ||
KEY= | ||
|
||
# Values from the Discord developer portal | ||
CLIENT_ID= | ||
CLIENT_SECRET= | ||
BOT_TOKEN= | ||
|
||
# The defaults here automatically work for the development environment. | ||
# For production, change localhost:3300 to your domain. | ||
DASHBOARD_URL=https://localhost:3300 | ||
API_URL=https://localhost:3300/api | ||
|
||
# Comma-separated list of user IDs who should have access to the bot's global commands | ||
STAFF= | ||
|
||
# A comma-separated list of server IDs that should be allowed by default | ||
DEFAULT_ALLOWED_SERVERS= | ||
|
||
# When using the Docker-based development environment, this is only used internally. The API will be available at localhost:DOCKER_DEV_WEB_PORT/api. | ||
API_PORT=3000 | ||
|
||
# Only required if relevant feature is used | ||
#PHISHERMAN_API_KEY= | ||
|
||
# The user ID and group ID that should be used within the Docker containers | ||
# This should match your own user ID and group ID. Run `id -u` and `id -g` to find them. | ||
DOCKER_USER_UID= | ||
DOCKER_USER_GID= | ||
|
||
# | ||
# DOCKER (DEVELOPMENT) | ||
# NOTE: You only need to fill in these values for running the development environment. See production config further below. | ||
# | ||
|
||
DOCKER_DEV_WEB_PORT=3300 | ||
|
||
# The MySQL database running in the container is exposed to the host on this port, | ||
# allowing access with database tools such as DBeaver | ||
DOCKER_DEV_MYSQL_PORT=3001 | ||
# Password for the Zeppelin database user | ||
DOCKER_DEV_MYSQL_PASSWORD= | ||
# Password for the MySQL root user | ||
DOCKER_DEV_MYSQL_ROOT_PASSWORD= | ||
|
||
# The development environment container has an SSH server that you can connect to. | ||
# This is the port that server is exposed to the host on. | ||
DOCKER_DEV_SSH_PORT=3002 | ||
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 | ||
|
||
# | ||
# DOCKER (PRODUCTION) | ||
# NOTE: You only need to fill in these values for running the production environment. See development config above. | ||
# | ||
|
||
DOCKER_PROD_DOMAIN= | ||
DOCKER_PROD_WEB_PORT=443 | ||
# The MySQL database running in the container is exposed to the host on this port, | ||
# allowing access with database tools such as DBeaver | ||
DOCKER_PROD_MYSQL_PORT=3001 | ||
# Password for the Zeppelin database user | ||
DOCKER_PROD_MYSQL_PASSWORD= | ||
# Password for the MySQL root user | ||
DOCKER_PROD_MYSQL_ROOT_PASSWORD= | ||
|
||
# You only need to set these if you're running an external database. | ||
# In a standard setup, the database is run in a docker container. | ||
#DB_HOST= | ||
#DB_USER= | ||
#DB_PASSWORD= | ||
#DB_DATABASE= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true, | ||
browser: true, | ||
es6: true, | ||
}, | ||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["@typescript-eslint"], | ||
rules: { | ||
"@typescript-eslint/no-explicit-any": 0, | ||
"@typescript-eslint/ban-ts-comment": 0, | ||
"@typescript-eslint/no-non-null-assertion": 0, | ||
"no-async-promise-executor": 0, | ||
"@typescript-eslint/no-empty-interface": 0, | ||
"no-constant-condition": ["error", { | ||
checkLoops: false, | ||
}], | ||
"prefer-const": ["error", { | ||
destructuring: "all", | ||
ignoreReadBeforeAssign: true, | ||
}], | ||
"@typescript-eslint/no-namespace": ["error", { | ||
allowDeclarations: true, | ||
}], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ jobs: | |
|
||
strategy: | ||
matrix: | ||
node-version: [16.6] | ||
node-version: [18.16] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ | |
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.clinic | ||
.clinic-bot | ||
.clinic-api | ||
|
||
# Runtime data | ||
pids | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
16.6 | ||
18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Zeppelin development environment | ||
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! | ||
|
||
**Note:** If you'd just like to run the bot for your own server, see 👉 **[PRODUCTION.md](./PRODUCTION.md)** 👈 | ||
|
||
## Starting the development environment | ||
|
||
### Using VSCode devcontainers | ||
1. Install Docker | ||
2. Make a copy of `.env.example` called `.env` | ||
3. Fill in the missing values in `.env` | ||
4. In VSCode: Install the `Remote - Containers` plugin | ||
5. In VSCode: Run `Remote-Containers: Open Folder in Container...` and select the Zeppelin folder | ||
|
||
### Using VSCode remote SSH plugin | ||
1. Install Docker | ||
2. Make a copy of `.env.example` called `.env` | ||
3. Fill in the missing values in `.env` | ||
4. Run `docker compose -f docker-compose.development.yml up` to start the development environment | ||
5. In VSCode: Install the `Remote - SSH` plugin | ||
6. In VSCode: Run `Remote-SSH: Connect to Host...` | ||
* As the address, use `[email protected]:3002` (where `3002` matches `DOCKER_DEV_SSH_PORT` in `.env`) | ||
* Use the password specified in `.env` as `DOCKER_DEV_SSH_PASSWORD` | ||
7. In VSCode: Once connected, click `Open folder...` and select `/home/ubuntu/zeppelin` | ||
|
||
### Using JetBrains Gateway | ||
1. Install Docker | ||
2. Make a copy of `.env.example` called `.env` | ||
3. Fill in the missing values in `.env` | ||
4. Run `docker compose -f docker-compose.development.yml up` to start the development environment | ||
5. Choose `Connect via SSH` and create a new connection: | ||
* Username: `ubuntu` | ||
* Host: `127.0.0.1` | ||
* Port: `3002` (matching the `DOCKER_DEV_SSH_PORT` value in `.env`) | ||
6. Click `Check Connection and Continue` and enter the password specified in `.env` as `DOCKER_DEV_SSH_PASSWORD` when asked | ||
7. In the next pane: | ||
* IDE version: WebStorm, PHPStorm, or IntelliJ IDEA | ||
* Project directory: `/home/ubuntu/zeppelin` | ||
8. Click `Download and Start IDE` | ||
|
||
### Using any other IDE with SSH development support | ||
1. Install Docker | ||
2. Make a copy of `.env.example` called `.env` | ||
3. Fill in the missing values in `.env` | ||
4. Run `docker compose -f docker-compose.development.yml up` to start the development environment | ||
5. Use the following credentials for connecting with your IDE: | ||
* Host: `127.0.0.1` | ||
* Port: `3002` (matching the `DOCKER_DEV_SSH_PORT` value in `.env`) | ||
* Username: `ubuntu` | ||
* Password: As specified in `.env` as `DOCKER_DEV_SSH_PASSWORD` | ||
|
||
## Starting the project | ||
|
||
### Starting the backend (bot + api) | ||
These commands are run inside the dev container. You should be able to open a terminal in your IDE after connecting. | ||
|
||
1. `cd ~/zeppelin/backend` | ||
2. `npm ci` | ||
3. `npm run migrate-dev` | ||
4. `npm run watch` | ||
|
||
### Starting the dashboard | ||
These commands are run inside the dev container. You should be able to open a terminal in your IDE after connecting. | ||
|
||
1. `cd ~/zeppelin/dashboard` | ||
2. `npm ci` | ||
3. `npm run watch-build` | ||
|
||
### Opening the dashboard | ||
Browse to https://localhost:3300 to view the dashboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Elastic License 2.0 (ELv2) | ||
|
||
## Elastic License | ||
|
||
### Acceptance | ||
|
||
By using the software, you agree to all of the terms and conditions below. | ||
|
||
### Copyright License | ||
|
||
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below. | ||
|
||
### Limitations | ||
|
||
You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software. | ||
|
||
You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key. | ||
|
||
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law. | ||
|
||
### Patents | ||
|
||
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company. | ||
|
||
### Notices | ||
|
||
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms. | ||
|
||
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software. | ||
|
||
### No Other Rights | ||
|
||
These terms do not imply any licenses other than those expressly granted in these terms. | ||
|
||
### Termination | ||
|
||
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently. | ||
|
||
### No Liability | ||
|
||
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.*** | ||
|
||
### Definitions | ||
|
||
The **licensor** is the entity offering these terms, and the **software** is the software the licensor makes available under these terms, including any portion of it. | ||
|
||
**you** refers to the individual or entity agreeing to these terms. | ||
|
||
**your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect. | ||
|
||
**your licenses** are all the licenses granted to you for the software under these terms. | ||
|
||
**use** means anything you do with the software requiring one of your licenses. | ||
|
||
**trademark** means trademarks, service marks, and similar rights. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Management | ||
After starting Zeppelin -- either in the [development](./DEVELOPMENT.md) or [production](./PRODUCTION.md) environment -- you have several tools available to manage it. | ||
|
||
## Note | ||
Make sure to add yourself to the list of staff members (`STAFF`) in `.env` and allow at least one server by default (`DEFAULT_ALLOWED_SERVERS`). Then, invite the bot to the server. | ||
|
||
In all examples below, `@Bot` refers to a user mention of the bot user. Make sure to run the commands on a server with the bot, in a channel that the bot can see. | ||
|
||
In the command parameters, `<this>` refers to a required parameter (don't include the `< >` symbols) and `[this]` refers to an optional parameter (don't include the `[ ]` symbols). `<this...>` refers to being able to list multiple values, e.g. `value1 value2 value3`. | ||
|
||
## Allow a server to invite the bot | ||
Run the following command: | ||
``` | ||
@Bot allow_server <serverId> [userId] | ||
``` | ||
When specifying a user ID, that user will be given "Bot manager" level access to the server's dashboard, allowing them to manage access for other users. | ||
|
||
## Disallow a server | ||
Run the following command: | ||
``` | ||
@Bot disallow_server <serverId> | ||
``` | ||
|
||
## Grant access to a server's dashboard | ||
Run the following command: | ||
``` | ||
@Bot add_dashboard_user <serverId> <userId...> | ||
``` | ||
|
||
## Remove access to a server's dashboard | ||
Run the following command: | ||
``` | ||
@Bot remove_dashboard_user <serverId> <userId...> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Zeppelin production environment | ||
Zeppelin's production environment - that is, the **bot, API, and dashboard** - uses Docker. | ||
|
||
## Starting the production environment | ||
1. Install Docker on the machine running the bot | ||
2. Make a copy of `.env.example` called `.env` | ||
3. Fill in the missing values in `.env` | ||
4. Run `docker compose -f docker-compose.production.yml build` | ||
5. Run `docker compose -f docker-compose.production.yml up -d` | ||
|
||
**Note:** The dashboard and API are exposed with a self-signed certificate. It is recommended to set up a proxy with a proper certificate in front of them. Cloudflare is a popular choice here. | ||
|
||
## Updating the bot | ||
|
||
### One-click script | ||
If you've downloaded the bot's files by cloning the git repository, you can use `update.sh` to update the bot. | ||
|
||
### Manual instructions | ||
1. Shut the bot down: `docker compose -f docker-compose.production.yml down` | ||
2. Update the files (e.g. `git pull`) | ||
3. Build new images: `docker compose -f docker-compose.production.yml build` | ||
3. Start the bot again: `docker compose -f docker-compose.production.yml up -d` | ||
|
||
### Ephemeral hotfixes | ||
If you need to make a hotfix to the bot's source files directly on the server: | ||
1. Shut the bot down: `docker compose -f docker-compose.production.yml down` | ||
2. Make your edits | ||
3. Build new images: `docker compose -f docker-compose.production.yml build` | ||
4. Start the bot again: `docker compose -f docker-compose.production.yml up -d` | ||
|
||
Make sure to revert any hotfixes before updating the bot normally. | ||
|
||
## View logs | ||
To view real-time logs, run `docker compose -f docker-compose.production.yml logs -t -f` |
Oops, something went wrong.