forked from ZeppelinBot/Zeppelin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use a single Dockerfile for all Zeppelin services - Add a Dockerfile in project root that can be used by app hosting services - Provide a standalone and lightweight prod setup - Standalone is the same as the old setup, with mysql+nginx - Lightweight only runs bot+backend+dash, no mysql/nginx - Remove mounted mysql data folders for dev and prod - This resolves permission issues caused by the mount - The mysql service uses a regular named volume now - Simplify .env options and clearly separate different prod setups - Remove update.sh - Different setups require different update procedures, so a common update.sh no longer works
- Loading branch information
Showing
30 changed files
with
947 additions
and
273 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
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
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
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
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,20 @@ | ||
FROM node:20 | ||
USER node | ||
|
||
COPY --chown=node:node . /zeppelin | ||
|
||
# Install dependencies for all packages | ||
WORKDIR /zeppelin | ||
RUN npm ci | ||
|
||
# Build backend | ||
WORKDIR /zeppelin/backend | ||
RUN npm run build | ||
|
||
# Build dashboard | ||
WORKDIR /zeppelin/dashboard | ||
RUN npm run build | ||
|
||
# Prune dev dependencies | ||
WORKDIR /zeppelin | ||
RUN npm prune --production |
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,34 +1,67 @@ | ||
# Zeppelin production environment | ||
Zeppelin's production environment - that is, the **bot, API, and dashboard** - uses Docker. | ||
Zeppelin's production environment uses Docker. There are a few different ways to run Zeppelin in production: | ||
|
||
## Starting the production environment | ||
1. **Standalone** | ||
* The easiest way to get Zeppelin up and running. This setup comes with a built-in database and web server. | ||
2. **Lightweight** | ||
* In case you don't want to use the built-in database and web server. This setup only runs the bot, API, and dashboard themselves. You'll have to provide your own database connection options and set up a proxy server for the API and dashboard. | ||
3. **Manual** | ||
* If you only want to run a specific service, you can use Zeppelin's Dockerfile directly. | ||
|
||
## Standalone | ||
|
||
### Setup | ||
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` | ||
3. Fill in the missing values in `.env` (including the "PRODUCTION - STANDALONE" section) | ||
|
||
**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. A popular option for this is [Cloudflare Tunnel](https://www.cloudflare.com/products/tunnel/). | ||
|
||
### Running the bot | ||
`docker compose -f docker-compose.standalone.yml up -d` | ||
|
||
### Shutting the bot down | ||
`docker compose -f docker-compose.standalone.yml down` | ||
|
||
### Updating the bot | ||
1. Shut the bot down | ||
2. Update the files (e.g. `git pull`) | ||
3. Rebuild: `docker compose -f docker-compose.standalone.yml build` | ||
4. Run the bot again | ||
|
||
### Viewing logs | ||
`docker compose -f docker-compose.standalone.yml logs -t -f` | ||
|
||
## Lightweight | ||
|
||
**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. | ||
### Setup | ||
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` (including the "PRODUCTION - LIGHTWEIGHT" section) | ||
|
||
## Updating the bot | ||
### Running the bot | ||
`docker compose -f docker-compose.lightweight.yml up -d` | ||
|
||
### 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. | ||
### Shutting the bot down | ||
`docker compose -f docker-compose.lightweight.yml down` | ||
|
||
### Manual instructions | ||
1. Shut the bot down: `docker compose -f docker-compose.production.yml down` | ||
### Updating the bot | ||
1. Shut the bot 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` | ||
3. Rebuild: `docker compose -f docker-compose.lightweight.yml build` | ||
4. Run the bot again | ||
|
||
### Viewing logs | ||
`docker compose -f docker-compose.lightweight.yml logs -t -f` | ||
|
||
### 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` | ||
## Manual | ||
1. Build the Zeppelin image: `docker build --tag 'zeppelin' .` | ||
2. Run the service: | ||
* Bot: `docker run zeppelin npm run start-bot` | ||
* API: `docker run zeppelin npm run start-api` | ||
* Dashboard: `docker run zeppelin npm run start-dashboard` | ||
|
||
Make sure to revert any hotfixes before updating the bot normally. | ||
If you're using an application platform such as Railway, you can simply point it to Zeppelin's repository and it should pick up the Dockerfile from there. | ||
For the start command, you can use the same commands as above: `npm run start-bot`, `npm run start-api`, `npm run start-dashboard`. | ||
|
||
## View logs | ||
To view real-time logs, run `docker compose -f docker-compose.production.yml logs -t -f` | ||
**Note:** You'll need to provide the necessary env variables. For example, `docker run --env-file .env 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
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
Oops, something went wrong.