Self-host Bytebase
Latest release version: 3.3.0
Self-host is for business with security/compliance requirements. Bytebase offers an air-gapped deployment with a single Go binary.
Prerequisites
- Check System Requirements.
- Check External PostgreSQL Prerequisites if you configure it.
- If you use gateway such as Nginx, enable WebSocket for SQL Editor autocomplete to work.
Docker
Estimated time: 5 minutes.
Installation
Once you see the Bytebase logo, you can access the console at http://localhost:8080.
Configuration
Use external PostgreSQL to store metadata
By default, Bytebase will use an embedded PostgreSQL database to store metadata. For production usage, it is recommended to use an external PostgreSQL database instead. Check Configure External PostgreSQL for details.
Customize startup options
If you need more control over the server configuration, check other Server Startup Options.
Allow external access via External URL
Check Configure External URL for details.
Enable WebSocket for SQL Editor
SQL Editor autocomplete requires WebSocket. If you access Bytebase via a gateway, you need to enable WebSocket there. Here is an sample NGINX configuration (including the optional HTTPS mentioned below):
Enable HTTPS
Bytebase does not support enabling HTTPS in server configuration. We suggest use NGINX or Caddy as a reverse proxy in front of Bytebase to enable HTTPS.
Troubleshooting
bind: address already in use
If you see bind: address already in use
error, it means the port 8080 is already in use on your host. You need to either stop the existing process using the port or configure Bytebase to use a different port via --publish <<YOUR_PORT>>:8080
.
Connect database instance on the same host
- If you run Bytebase inside Docker on Linux, then you need to supply the additional
--network host
flags indocker run
command. This allows Bytebase to connect to database instance running on the same host withlocalhost
. - If you run Bytebase inside Docker Desktop on Mac , then you need to use
host.docker.internal
to connect to database instance running on the same host.
Manifest not found
There may be a few reasons the manifest file is not found:
- The docker image only supports
linux/amd64
andlinux/arm64
arch. If it doesn't match your OS arch, you may supply--platform linux/amd64
as a best effort. - Your Docker version is too old and doesn't support manifest list. Please install the latest Docker version.
Unable to start using Colima
Due to the vm mechanism of Colima, try to use the --mount
option when starting colima as shown below:
Kubernetes
Estimated time: 15 minutes.
Deploy to Kubernetes
Here is a sample Kubernetes YAML file bb.yaml
describing the minimal components and configuration required to run Bytebase in Kubernetes.
-
Start Bytebase with the following command:
-
Make sure everything worked by listing your deployments:
Do the same check for your services:
-
Open a browser and visit http://localhost, you should see Bytebase.
Upgrade
When a new Bytebase release is published, you can change the image version in the yaml file
Use Helm Chart
Production Setup External URL
Installing the Chart
For example:
Uninstalling the Chart
Upgrade Bytebase Version/Configuration
Use helm upgrade
command to upgrade the bytebase version or configuration.
Deploy with Ingress
We use Ingress-Nginx Controller as ingress controller. You need to config Ingress-Nginx Controller
according to your environment.
Note If you use ingress, make sure to use https to access bytebase;
External PostgreSQL
Instead of specify PostgreSQL connection string in helm or Kubernetes yaml file, we allows users to using Kubernetes secrets resources.
Kubernetes
Using the following yaml section to replace the spec.templates.spec.containers.env
section:
Helm
Using --set bytebase.option.existingPgURLSecret
and --set bytebase.option.existingPgURLSecretKey
to specify the secret key and secret name instead of --set "bytebase.option.external-url"={NEW_EXTERNAL_URL}
. See more details in Bytebase - Artifact Hub.
Persistent Volume
We don't recommend this. However, if you do not configure External PostgreSQL, then to persist data, you need to use the Persistent Volumes in the cluster. Each cloud provider has its own solution.
For Amazon Elastic Kubernetes Service(EKS)
In AWS EKS, you can use the Amazon EBS CSI driver for persistent volumes. Follow the managing EBS CSI to add it as an Amazon EKS add-on.
Here is a simple example to use an EBS volume:
Note Also need to update the statefulset spec of bytebase to replace the emptyDir volume with persistentVolumeClaim:
For Google Kubernetes Engine(GKE)
Please follow the Persistent volumes and dynamic provisioning.
AWS Fargate
Create an ECS Cluster
- Go to AWS Management Console and navigate to the ECS (Elastic Container Service).
- Click Clusters on the left menu and then click Create cluster.
- Fill in the cluster name, choose
AWS Fargate (serverless)
under Infrastructure. - Click Create.
Create an ECS Task Definition
- Click Task Definitions on the left menu and then click Create new task definition.
- Choose AWS Fargate as the launch type under Infrastructure requirements.
- Add a Container, fill in Image URL with
bytebase/bytebase:latest
and Container port8080
. - Click Create.
Run the Task
- Go to the created cluster and click Create under Services.
- Under Environment > Compute configuration, choose FARGATE as the launch type.
- Under Deployment configuration, Choose
Service
as the Application type, choose the task definition you created in the previous step, give it a name such asbytebase-service
. - Click Create.
Access Bytebase
- Go to the service you just created and click Logs tab to see the logs. If you see something like
Version 3.3.0(f5891735834ea82fd67bf8181597f86a7f5dab58) has started on port 8080 š
, it means Bytebase is running. - Click Tasks tab to see the task list. Click the task name to see the task details.
- Under Cointainer details for bytebase, click Network bindings tab to find the External link.
- Click Open address to access Bytebase.
Build from Source
Prerequisites
-
Install pnpm, Bytebase requires Node.js >=17.0.
-
Install Go, Bytebase requires Go >= 1.16
-
It's recommended to run Bytebase application as non-root user for security reason. If you don't have other non-root users on the system, you can follow the following steps to create one, e.g. user
bytebase
.
Download source code from GitHub, then go to the source root directory
Build the source
If out_directory
is not specified, the default directory is ./bytebase-build
Suppose you run scripts/build_bytebase.sh foo
After build completes, run:
(check Server Startup Options for other startup options)
You should see something like this in the console:
Troubleshoot
error: too many open files
Change the open file limit: