All pages
Powered by GitBook
1 of 23

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Install & update

All about installing and updating your UI Bakery self-hosted version.

Installing on-premise
Troubleshooting installation errors
Updating on-premise
Updating license key
Updating environment variables
Recommendations

Installing on-premise

This guide describes how to deploy a ui-bakery on-prem via install.sh script.

The script installs docker and docker-compose, which may upgrade some dependencies under the hood. Please be advised that if you run this script on the OS used as a server for other applications, those applications may break due to that potential dependencies upgrade.

Installation requirements
  • OS Linux Ubuntu 18.04 and above

  • 2 vCPUs, 4 GiB memory, 20GiB disk space

  • Must have full rights to use "sudo"

  • These domains are accessible from your network:

    • https://cruibakeryonprem.westeurope.data.azurecr.io

    • https://cruibakeryonprem.centralus.data.azurecr.io

    • https://raw.githubusercontent.com

Installation steps

  1. Run this command preferably from /home Linux directory to download, install and launch UI Bakery:

  2. In the process, upon request, enter the license key, hosting URL, and port.

On the Free plan, your license key is generated automatically during the installation process. By default, you get the two-week Business plan trial first that is downgraded to Free after the trial period expires. On the paid plans, reach out to our Support team to obtain a license key.

  1. Once the installation is completed, open the browser using the URL and port provided earlier. By default it is http://localhost:3030/.

  2. By default, the login page will open where you will need to sign up first before creating your workspace and building apps.

You can sign up with your own credentials.

NOTE: If Docker of a version less than the required (minimum 20.10.11) is already installed on the server, and/or Docker Compose (minimum 1.29.2), the script will be stopped. You need to update the versions of components manually and run the script again.

Deployment by instance

To deploy the self-hosted version to specific instances, follow these comprehensive guides:

  • Azure virtual machine

  • Azure container instance

  • AWS EC2 instance

  • Google Cloud Compute Engine VM instance

Additional recommended steps

UI Bakery installation is ready for production out of the box. However, there are additional setup steps we recommend following.

curl -k -L -o install.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/install.sh && bash ./install.sh
DigitalOcean 1-click droplet
Manual w/ docker compose
Manual w/ docker run
Windows installation
Kubernetes

DigitalOcean 1-click droplet

Deploy UI Bakery on DigitalOcean cloud platoform

Follow the link or search for "UI Bakery" on the DigitalOcean marketplace to create a droplet with a pre-configured UI Bakery instance.

Updating license key

Just as a reminder, your license key is obtained during the installation process.

To update your UI Bakery license key, you need to change the corresponding variable:

UI_BAKERY_LICENSE_KEY=key_value

For the Docker Compose setup, the environment variables are located in ui-bakery-on-premise/.env file. To restart your instance, use the following command:

docker compose down
docker compose up -d

Azure virtual machine

To deploy UI Bakery to an Azure virtual machine, follow these steps:

  1. Open Azure Portal and in the search field at the top type in Virtual machines and select this item in the result search window.

  2. Click on the + Create button in the top left corner and select Azure Virtual machine in the menu.

  3. Select an image of Ubuntu 18.04 or higher.

  4. For the instance size, select the minimum Standard_F2s_v2 - 2 vCPUs, 4 GiB memory.

  5. In the Administrator account section in the Authentication type menu item, select SSH public key, and it will generate the keys after VM creation.

  6. In Inbound port rules leave SSH(22) as by default.

  7. In the Networking tab, select existing or create a new Virtual Network and Subnet used by this VM.

  8. In NIC network security group select Advanced.

  9. In Configure network security group click Create new.

  10. Click + Add an inbound rule.

  11. Add {BakeryPort} (use 3030 by default, you will need to select the same port during UI Bakery installation later) in the Destination port ranges.

  12. In Protocol Choose TCP.

  13. Click Add.

  14. Check that SSH (TCP/22) is configured by default. If not, add it manually using the same algorithm as for {BakeryPort}.

  15. Click Ok to finish creating a Network security group.

  16. Click Review + create.

  17. Click Create.

  18. After creating and running the virtual machine, connect to it from outside using SSH protocol.

  19. Run this command preferably from the /home Linux directory to download, install and launch UI Bakery:

  20. Upon request, enter the previously received license code, hosting URL - Azure Virtual Machine IP address, and port ({BakeryPort} which you selected in the earlier steps 3030 by default).

  21. After the installation is completed and launched, enter the bakery from a browser on your local machine at http://{Public IP address Azure VM}:{BakeryPort}.

UI Bakery in production

UI Bakery installation is ready for production out of the box. However, there is a bunch of additional setup steps we recommend following:

  • Put your instance behind HTTPS.

  • Use a standalone database.

  • Enable automatic backups for instance and database machines.

  • Lock the UI Bakery version by setting a specific value for the UI_BAKERY_VERSION environment variable.

  • Store your environment variables in a secure place like a secrets manager or a key vault. Make sure you override the following variables:

If you have used the install script, then your .env file already contains unique values for those vars. Otherwise, use .

Recommendations

Additional steps and information after installing the self-hosted version.

Kubernetes

Requirements

Ensure your Kubernetes cluster meets the minimum requirements of 4 CPUs and 8 GiB of memory for this tutorial.

You either have to run a or make sure standard PersistentVolumeClaim exists in your cluster.

Azure container instance

To deploy UI Bakery to an Azure container instance, follow these steps:

  1. Login docker to Azure.

  1. Create a docker context.

  1. Use new context.

Generating custom secrets

If you want to generate custom secrets values, you can do this right from your console using a simple command.

You can use the openssl command (commonly available on many Unix-based systems) combined with tr and head commands. Here's how you can do it for each of your requirements:

Alternatively, you can also use urandom to generate secrets:

Windows installation

UI Bakery supports running its self-hosted version on Windows OS.

In order to install it, follow the steps below:

  1. Install .

Docker has updated its license agreement according to which the commercial use of Docker Desktop in larger enterprises (more than 250 employees OR more than $10 million USD in annual revenue) now requires a paid subscription.

Updating environment variables

are a crucial part of configuring your UI Bakery On-Premise installation. They can control various settings, including your , , and application behavior. Here's how you can modify them.

After the installation of UI Bakery On-Premise, a directory named ui-bakery-on-premise is created. Within this directory, you will find a file named .env. This file contains the for your instance.

To modify any variable, such as your license key or other settings:

  1. Open the .env file using a text editor. You can do this through the command line or by navigating through the file explorer to ui-bakery-on-premise

Troubleshooting installation errors

Common installation errors

[::]:3030 failed (97: Address family not supported by protocol...

When installing or starting the server, you might encounter an error related to Nginx, as shown below:

This error indicates a problem with Nginx attempting to open a socket on an IPv6 address, which might not be supported in your network configuration.

Scaling and resource optimization

UI Bakery consists of that may need to be scaled using different approaches. The default resource specifications outline the minimum requirements for each service, but you might want to adjust these based on your specific solution and usage needs.

All services are stateless (except databases) and can be scaled using either HorizontalPodAutoscaler or by setting replicas in the deployment specification. However, scaling every service may not be necessary.

The bakery-gateway, bakery-front, and workbench-front services are simple NGINX applications that provide static resource delivery and request routing. These services are resource-efficient and typically do not require scaling.

The automation, datasource and python-runtime services may need scaling if your solution involves lots of automation runs, datasource requests or Python code executions. Since it is a Node.js app, assigning more than one CPU is not necessary. However, such features heavily rely on memory when handling large datasets. For the bakery-back service, running multiple small replicas might be less efficient than a single instance with more resources. We recommend increasing container CPU and memory resources based on your load.

Architecture overview

UI Bakery self-hosted version is a set of services, some of which are optional. The same core principles apply whether you deploy it using Docker Compose or Kubernetes.

Below is a diagram illustrating UI Bakery containers and the relationships between them. Arrows indicate the direction of requests between containers/services.

All UI Bakery containers are stateless. Certain containers are optional and can be safely removed if their functionality is not required. Check out what these containers stand for:

  • bakery-gateway acts as an NGINX-based gateway and reverse proxy. Routes incoming client requests to the appropriate internal services.

Architecture overview
UI Bakery in production
Resource optimization
Running a standalone database instance
Generating custom secrets
bakery-front is an NGINX server hosting static files (HTML/CSS/JS) for the main UI Bakery interface.
  • workbench-front is another NGINX server dedicated to hosting static files for the “workbench” front-end. The workbench is rendered within an iframe inside the main UI, providing a secure sandboxed environment for end-user apps.

  • bakery-back is a Java-based API service serving as the main backend. Handles authentication, authorization, user management, storage of application models, and other central logic. May initiate outbound connections if SSO or other external integrations are enabled.

  • datasource is a Node.js service responsible for executing queries against connected data sources.

  • db is a MySQL database that stores internal UI Bakery entities such as users, apps, and permissions. Recommended to replace with a managed, external MySQL database in production. Can be removed if you are using an external database solution.

  • automation is a Node.js service that executes UI Bakery automations. Invoked by bakery-back, it can perform datasource queries as part of these automations. Can be removed if automations are not used.

  • python-runtime is a Node.js-based environment for running Backend Python code actions within UI Bakery. Can be removed if Python-based actions are not required.

  • bakery-db is a PostgreSQL database that can be connected as a data source within UI Bakery. Used for the UI Bakery Database feature. Can be removed if database is not used.

  • UI Bakery overview
    and opening the
    .env
    file.
  • Find and modify or add a new variable:

  • UI_BAKERY_LICENSE_KEY=new_license_key_value

    Make sure to save the file after making your changes.

  • To apply the changes, a system restart is necessary. Accomplish this by running the following commands in your terminal:

  • Restarting your UI Bakery On-Premise instance with docker compose down and docker compose up -d does not erase your data. Persistent data is stored in Docker volumes, ensuring it remains safe across container restarts.

    Environment variables
    license key
    database connections
    domain name
    environment variables
    UI_BAKERY_JWT_SECRET
    UI_BAKERY_JWT_REFRESH_SECRET
    UI_BAKERY_JWT_SERVICE_ACCOUNT_SECRET
    UI_BAKERY_CREDENTIALS_SECRET
    UI_BAKERY_MFA_SECRET
    the following guide to generate the secrets
    # For UI_BAKERY_JWT_SECRET
    openssl rand -base64 100 | tr -dc 'A-Z0-9' | head -c 42; echo
    # For UI_BAKERY_JWT_SERVICE_ACCOUNT_SECRET
    openssl rand -base64 100 | tr -dc 'A-Z0-9' | head -c 55; echo
    # For UI_BAKERY_JWT_REFRESH_SECRET
    openssl rand -base64 100 | tr -dc 'A-Z0-9' | head -c 42; echo
    # For UI_BAKERY_CREDENTIALS_SECRET
    openssl rand -base64 100 | tr -dc 'A-Z0-9' | head -c 32; echo
    # For UI_BAKERY_MFA_SECRET
    openssl rand -base64 100 | tr -dc 'A-Z0-9' | head -c 32; echo
    # For UI_BAKERY_PROJECT_PRIVATE_KEY_SECRET
    openssl rand -base64 100 | tr -dc 'A-Z0-9' | head -c 32; echo
    # For UI_BAKERY_AUTH_DEVICE_INFO_SECRET
    openssl rand -base64 100 | tr -dc 'A-Z0-9' | head -c 32; echo
    # For UI_BAKERY_JWT_SECRET
    echo $(LC_ALL=C tr -cd "A-Za-z0-9" < /dev/urandom | head -c 42 | xargs -0)
    # For UI_BAKERY_JWT_SERVICE_ACCOUNT_SECRET
    echo $(LC_ALL=C tr -cd "A-Za-z0-9" < /dev/urandom | head -c 55 | xargs -0)
    # For UI_BAKERY_JWT_REFRESH_SECRET
    echo $(LC_ALL=C tr -cd "A-Za-z0-9" < /dev/urandom | head -c 42 | xargs -0)
    # For UI_BAKERY_CREDENTIALS_SECRET
    echo $(LC_ALL=C tr -cd "A-Za-z0-9" < /dev/urandom | head -c 32 | xargs -0)
    # For UI_BAKERY_MFA_SECRET
    echo $(LC_ALL=C tr -cd "A-Za-z0-9" < /dev/urandom | head -c 32 | xargs -0)
    # For UI_BAKERY_PROJECT_PRIVATE_KEY_SECRET
    echo $(LC_ALL=C tr -cd "A-Za-z0-9" < /dev/urandom | head -c 32 | xargs -0)
    # For UI_BAKERY_AUTH_DEVICE_INFO_SECRET
    echo $(LC_ALL=C tr -cd "A-Za-z0-9" < /dev/urandom | head -c 32 | xargs -0)
    Installation steps

    Step 1: Obtain UI Bakery Kubernetes Configs

    UI Bakery configs are available in https://github.com/uibakery/self-hosted repository in kubernetes folder.

    You can download the repository with the following command:

    Step 2: Fill the required environment variables

    By default, all variables are defined in ui-bakery-configmap.yaml. To run UI Bakery you need to provide the following variables:

    • UI_BAKERY_APP_SERVER_NAME - your {server ip address}:3030, for example http://123.123.123.123:3030;

    • UI_BAKERY_LICENSE_KEY - get it from the UI Bakery team;

    Step 3: Apply configuration on the cluster

    Run kubectl apply -f . in the kubernetes folder. Please note that the application will be exposed on a public IP address on port 3030.

    Configuring UI Bakery

    Once you've completed the installation steps, the UI Bakery app will be deployed on your cluster. You can sign up to test the installation. To prepare UI Bakery for production, further configuration is required.

    Setup standalone databases

    UI Bakery comes with MySQL and Postgres databases defined in ui-bakery-database.yaml and ui-bakery-internal-database.yaml. It's recommended to migrate these databases to a managed solution or ensure they are secure and backed up. If you don't use the Bakery Database feature, you can delete ui-bakery-internal-database.yaml.

    Configure secrets

    We recommend storing sensitive environment variables' values in Secrets instead of ConfigMap.

    Use the following guide to generate the secrets for the following variables:

    Configure domain name and HTTPS

    After setting up Ingress, update UI_BAKERY_APP_SERVER_NAME environment variable to https://yourdomain.com.

    standalone database instance

    Clone ui bakery self-hosted repository.

    1. UI Bakery requires db to persist its data. So it's necessary to create one. We suggest you use Azure Database for MySQL.

    2. Set UI_BAKERY_LICENSE_KEY variable in docker-compose-azure-container-instances.yml for bakery-back service.

    1. Set UI_BAKERY_DB_* variables in docker-compose-azure-container-instances.yml for bakery-back service.

    1. Up the Azure container instance.

    1. Find the assigned IP address. Run docker ps and in column PORTS you'll find the assigned IP address.

    2. Replace all occurrences of UI_BAKERY_APP_SERVER_NAME with the IP address retrieved in the previous step.

    1. Restart the instance to apply the new configuration.

    docker login azure
    Solution
    1. Open UI Bakery .env (Updating UI Bakery ENV variables guide)

    2. Add or update the following line:

    1. Save the file and restart UI Bakery

    Escaping special characters

    Sometimes when using special characters in your environment variables, like &, $, %, the variables may not be escaped properly. To fix it, put the variable value in quotes like this:

    If you have an older version of Docker installed, you may need to use double quotes instead.

    1#1: socket() [::]:3030 failed (97: Address family not supported by protocol)
    socket() [::]:3030 failed (97: Address family not supported by protocol)

    Check out the example of HorizontalPodAutoscaler for the automation service:

    various services
    apiVersion: autoscaling/v2
    kind: HorizontalPodAutoscaler
    metadata:
      name: ui-bakery-automation-hpa
      namespace: ui-bakery
    spec:
      scaleTargetRef:
        apiVersion: apps/v1
        kind: Deployment
        name: ui-bakery-automation
      minReplicas: 2
      maxReplicas: 10
      metrics:
      - type: Resource
        resource:
          name: cpu
          target:
            type: Utilization
            averageUtilization: 70
    docker compose down
    docker compose up -d
    curl -k -L -o install.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/install.sh && bash ./install.sh
    git clone https://github.com/uibakery/self-hosted.git
    UI_BAKERY_JWT_SECRET
    UI_BAKERY_JWT_REFRESH_SECRET
    UI_BAKERY_JWT_SERVICE_ACCOUNT_SECRET
    UI_BAKERY_CREDENTIALS_SECRET
    UI_BAKERY_MFA_SECRET
    docker context create aci uibakery
    docker context use uibakery
    git clone https://github.com/uibakery/self-hosted.git && cd self-hosted
    UI_BAKERY_LICENSE_KEY=${UI_BAKERY_LICENSE_KEY:-eyJhbGciOiJIUz}
    UI_BAKERY_DB_HOST=${UI_BAKERY_DB_HOST:-azure-container-instance-test-db.mysql.database.azure.com}
    UI_BAKERY_DB_PORT=${UI_BAKERY_DB_PORT:-3306}
    UI_BAKERY_DB_DATABASE=${UI_BAKERY_DB_DATABASE:-bakery}
    UI_BAKERY_DB_USERNAME=${UI_BAKERY_DB_USERNAME:-uibakeryuser@azure-container-instance-db}
    UI_BAKERY_DB_PASSWORD=${UI_BAKERY_DB_PASSWORD:-uibakerypassword}
    docker compose -f docker-compose-azure-container-instances.yml up
    UI_BAKERY_APP_SERVER_NAME=https://123.123.123.123
    docker compose -f docker-compose-azure-container-instances.yml up
    UI_BAKERY_LISTEN_IP6=false
    docker compose down
    docker compose up -d
    UI_BAKERY_SMTP_PASSWORD='myPasswordWithSpecicalChars$33%#4'
    If you fall under this limitation, you can still install Docker without Docker Desktop on Windows since this license update is not related to Docker or the Docker Engine.
    1. Create a folder that will contain UI Bakery configuration files - mkdir ui-bakery-on-premise.

    2. Change the current working directory to thecd ui-bakery-on-premise folder.

    3. Download the docker-compose.yml configuration file: Invoke-WebRequest -Uri https://raw.githubusercontent.com/uibakery/self-hosted/main/docker-compose.yml -OutFile docker-compose.yml.

    4. Create .env file from the template below (use this to generate the secrets):

    1. Replace placeholders in the .env file with the appropriate secrets you generated.

    2. Pull the containers and run them using the following command - docker compose up -d.

    Docker Desktop

    Manual w/ docker compose

    MySQL instance is included into the out of the box container and doesn't require any additional setup. If you need to have a standalone database, read Running a standalone database instance

    • Install docker 20.10.11 version or higher, and docker compose 1.29.2 version or higher.

    • Start docker daemon.

    • Get on-premise configuration files:

    • Get the license key from the UI Bakery team.

    • Run ./setup.sh:

      • Enter the license key;

      • Enter the port (leave empty for local installation, 3030 port will be used);

      • Enter the server URL (leave empty for local installation).

    • Run docker compose up -d to start the containers;

    • Wait until all containers are up and running;

    • Open port 3030 or UI_BAKERY_PORT (if it was modified in .env file or entered in ./setup.sh) to access UI Bakery instance, then you can create a new account.

    Google Cloud Compute Engine VM instance

    To deploy UI Bakery to a Google cloud compute engine virtual machine, follow these steps:

    1. Open Google Cloud Console. On your project page, select Navigation Menu - Compute Engine - VM instances.

    2. Select Create an instance - New Vm instance.

    3. Input bakery in Name. Select region and zone.

    4. Select E2 in Series field and e2-medium in Machine Type field in the block Machine configuration - Machine family - General-purpose.

    5. Press Change button in block Boot Disk.

    6. Select Ubuntu in the Operation System, Ubuntu 18.04 LTS or higher in the Version and input 20 in Size (GB). Click Select button.

    7. Click Create button at the bottom of the page.

    8. On your project page, select Navigation Menu - VPC Network - Firewall and press Create a firewall rule button.

    9. Input bakery in Name and select All instances in the network in Targets.

    10. Input 0.0.0.0/0 in Source IPv4 ranges.

    11. Go to the block Protocols and ports. Select Specified protocols and ports and TCP, input {BakeryPort} (use 3030 by default, you will need to select the same port during UI Bakery installation later) in the Port.

    12. Click Create button at the bottom of the page.

    13. On your project page, select Navigation Menu - Compute Engine - VM instances.

    14. Select VM instance Bakery and press SSH - Open in Browser Window. This will open the SSH-in-browser window.

    15. Run this command preferably to download, install and launch UI Bakery:

    16. Upon request, enter the previously received license code, hosting URL - External IP address VM Instance, and port ({BakeryPort} which you selected in the earlier steps 3030 by default).

    17. After the installation is completed and launched, enter the UI Bakery from a browser on your local machine at http://{External IP address Vm Instance}:{BakeryPort}.

    AWS EKS with Fargate

    This guide shows how to deploy UI Bakery on AWS EKS using Fargate. It is assumed that you have an active AWS account and have copied the repository containing the necessary configuration files for the deployment process.

    1. Create cluster with eksctl:

      • Install eksctl if it's not already installed.

      • Run eksctl create cluster -f ./templates/eksctl-fargate.yaml. If necessary, you can modify the region and cluster name specified in the file to match your desired configurations.

      • Once the command execution is finished, you will have successfully created your AWS EKS cluster.

    2. Set up the MySQL database required for UI Bakery on AWS RDS.

      • Create a new RDS instance in your AWS account. It should have MySQL 8+ engine and be accessible by the cluster. Configure the remaining database settings according to your requirements.

      • Create database and user with the following permissions: GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, LOCK TABLES, EXECUTE, CREATE ROUTINE, ALTER ROUTINE

    3. Configure the Elastic Load Balancer (ELB) for your UI Bakery deployment

      • Verify that all the cluster subnets have the required tags:

        • Each subnet should have the tag kubernetes.io/cluster/ui-bakery=shared.

    4. Deploy UI Bakery with the following command kubectl apply -f ./kubernetes

    Running a standalone database instance

    UI Bakery incorporates a MySQL database to manage crucial data such as applications, users, roles, among others, essential for its operation.

    The standard UI Bakery configuration includes a database running in Docker. For production environments, we recommend using a standalone database.

    Step 1. Install MySQL

    UI Bakery requires MySQL 8+ version.

    Step 2. Create database and user

    Use the following script to create database and user:

    Ensure you have updated the password and host details. If the database should be accessible from external networks, you need to modify the bind-address setting in the MySQL configuration file.

    Step 3. Update UI Bakery to use a new database

    the following environment variables and restart UI Bakery:

    To stop running the embedded database, remove the db service from the docker-compose.yml file.

    How to migrate data from the default db to a standalone

    If you need to move data from an embedded database to a standalone one, follow these steps:

    Step 0. Reduce the database size (Optional)

    If you have been using UI Bakery for an extended period, you might notice that your database requires a significant amount of space.

    To clear old audit logs and apps model backups connect to db container:

    Then run the following script:

    Before Proceeding: Ensure a backup has been created to prevent data loss.

    Step 1. Create the database dump

    Step 2. Apply the dump to the standalone database

    Ensure you first create an empty database, then proceed to run the script.

    UI_BAKERY_APP_SERVER_NAME=http://localhost:3030
    UI_BAKERY_PORT=3030
    UI_BAKERY_JWT_SECRET=<42 ALPHABET LETTER/NUMBER CHARACTERS>
    UI_BAKERY_JWT_SERVICE_ACCOUNT_SECRET=<55 ALPHABET LETTER/NUMBER CHARACTERS>
    UI_BAKERY_JWT_REFRESH_SECRET=<42 ALPHABET LETTER/NUMBER CHARACTERS>
    UI_BAKERY_CREDENTIALS_SECRET=<32 ALPHABET LETTER/NUMBER CHARACTERS>
    UI_BAKERY_TEMPLATE_MAKER_PASSWORD=<SECURE PASSWORD TO ACCESS UI BAKERY TEMPLATE MAKER ACCOUNT>
    UI_BAKERY_LICENSE_KEY=<YOUR LICENSE KEY RECEIVED FROM UI BAKERY TEAM>
    guide
    Provide
    Put database credentials in ./kubernetes/ui-bakery-configmap or in secrets for

    bakery-back service:

    • Delete the default db configuration file ./kubernetes/ui-bakery-database.yaml

    Private subnets should have the tag
    kubernetes.io/role/internal-elb=1
    .
  • Public subnets should have the tag kubernetes.io/role/elb=1.

  • Install AWS Load Balancer Controller add-on

  • Add annotations for bakery-gateway service in ./kubernetes/ui-bakery-gateway file:

  • mkdir ui-bakery-on-premise && cd ui-bakery-on-premise && curl -k -L -o docker-compose.yml https://raw.githubusercontent.com/uibakery/self-hosted/main/docker-compose.yml && curl -k -L -o docker-compose-external-db.yml https://raw.githubusercontent.com/uibakery/self-hosted/main/docker-compose-external-db.yml && curl -k -L -o setup.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/setup.sh
    curl -k -L -o install.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/install.sh && bash ./install.sh
    CREATE DATABASE bakery;
    
    CREATE USER 'bakery'@'host' IDENTIFIED BY 'password';
    
    GRANT
      SELECT, INSERT, UPDATE, DELETE, CREATE, DROP,
      REFERENCES, INDEX, ALTER, LOCK TABLES, EXECUTE,
      CREATE ROUTINE, ALTER ROUTINE 
    ON bakery.* TO 'bakery'@'host';
    UI_BAKERY_DB_HOST=mysql-instance-address
    UI_BAKERY_DB_PORT=3306
    UI_BAKERY_DB_DATABASE=bakery
    UI_BAKERY_DB_USERNAME=bakery
    UI_BAKERY_DB_PASSWORD=password
    # list runing containers
    docker ps
    # connect to db container
    docker exec -it DB_CONTAINER_ID /bin/bash
    # login into MySQL
    mysql -u bakery -p bakery 
    -- delete audit logs that older than 7 days
    DELETE FROM audit_log WHERE created_at < NOW() - INTERVAL 7 DAY
    
    -- delete app backups that older than 7 days
    DELETE `release`, project_snapshot FROM project_snapshot
     JOIN `release` ON `release`.project_snapshot_id=project_snapshot.id 
     WHERE `release`.automatic_backup=1 AND `release`.created_at <  NOW() - INTERVAL 7 DAY AND project_snapshot.id>0 AND `release`.id>0;
    docker exec DB_CONTAINER_ID /usr/bin/mysqldump -u root --password=root bakery > backup.sql
    mysql -u root -p < backup.sql
    UI_BAKERY_DB_HOST: bakery.xxx.us-east-1.rds.amazonaws.com
    UI_BAKERY_DB_PORT: 3306
    UI_BAKERY_DB_DATABASE: bakery
    UI_BAKERY_DB_USERNAME: bakery
    UI_BAKERY_DB_PASSWORD: bakery
      annotations:
        service.beta.kubernetes.io/aws-load-balancer-type: "external"
        service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: "ip"
        service.beta.kubernetes.io/aws-load-balancer-scheme: "internet-facing"

    Resource optimization

    Resource usage

    To run a UI Bakery instance, it's recommended to have at least 2 CPUs and 4 GiB of memory. For handling hundreds or thousands of simultaneous user sessions, or gigabytes of data in automation, you may need to increase these resources. It's challenging to specify the exact resource requirements, so we recommend monitoring resource usage and adjusting based on demand.

    When you deploy UI Bakery using Docker Compose, each UI Bakery service will consume resources on demand. You may want to adjust resource limits for various UI Bakery services based on your specific needs. If you expect that users might trigger heavy queries leading to overuse of resources, set hard limits in the docker-compose.yml file, for example:

    The configuration above limits the datasource service to consuming more than 1 CPU and 1 GiB of memory.

    We recommend setting resource limits for the datasource, automation, and python-runtime services if you experience unpredictable loads on these services. The memory limit should be at least twice the size of the processed data.

    Replicating UI Bakery services

    Not all UI Bakery services are designed to be replicated.

    • Replicating is advisable for these services: datasource, automation, and python-runtime. These services execute data requests or run user code. The heavier the datasource requests or the more complex the automation or python code execution, the more resources they may require. However, in most scenarios, these services do not need more than 1 GB of RAM and 1 CPU. If you have a large number of concurrent requests, the better strategy is to scale them horizontally.

    • The bakery-back service is designed to be scaled vertically. If you observe high resource consumption on the bakery-back service, we recommend increasing the amount of RAM and CPU allocated to the service instance.

    Scaling with docker compose

    To accommodate numerous concurrent data sources or automation requests, you may choose to scale some of UI Bakery's services by adjusting the docker-compose.yml file with the replicas config:

    Scaling with kubernates

    To configure Kubernetes for auto-scaling, add these lines to ui-bakery-datasource.yaml. This will start with 2 instances of the datasource service, allowing scaling up to 4 instances if the CPU load increases.

    Updating on-premise

    Please note that the on-premise version differs from the cloud version and is not updated automatically.

    On-premise version release notes

    You can follow the updates here with the ON-PREMISE RELEASE tag.

    Update to the latest version

    To update your UI Bakery on-premise version to the latest one, follow the steps below:

    1. Take a full backup of the UI Bakery instance.

    2. Go to your ui-bakery-on-premise folder:

    1. Run ./update.sh that will download new images and restart your instance:

    1. If you use Git to manage your apps in UI Bakery, follow to properly migrate the application model.

    Update to the specific version

    To update your UI Bakery on-premise version to the specific version, follow the steps below:

    1. Take a full backup of the UI Bakery instance.

    2. Go to your ui-bakery-on-premise folder:

    1. Set the UI_BAKERY_VERSION environment variable to the desired version in the .env file.

    2. Then restart the system.

    1. Optionally delete old images.

    1. If you use Git to manage your apps in UI Bakery, follow to properly migrate the application model.

    Updating from version 2.25.0 and lower to the new version

    If you are on a 2.25.0 UI Bakery version or lower, please follow the guide below to update to a newer version.

    Please note this is a one-time procedure! You need to follow these steps only once to upgrade from any version lower than 2.25.0. If you are on a higher version, please use .

    1. Create a backup of ui-bakery-on-premise folder:

    2. Go to ui-bakery-on-premise folder and run:

    3. Comment UI_BAKERY_WORKBENCH_PATH variable by adding # at the beginning of the line in .env file:

    • Press control + O to save.

    • Press control + X to exit.

    4. Run the next command to rerun containers:

    5. Check your UI Bakery instance.

     datasource:
        container_name: datasource
        image: cruibakeryonprem.azurecr.io/cloud/datasource:${UI_BAKERY_VERSION:-latest}
        restart: always
        env_file: .env
        deploy:
          resources:
            limits:
              cpus: '1'
              memory: 1024M

    Other services such as bakery-gateway, bakery-front, and workbench-front are simple NGINX applications. They can handle heavy loads efficiently while maintaining low resource usage, so scaling is rarely necessary.

    this guide
    this guide
    this guide
      datasource:
        container_name: datasource
        image: cruibakeryonprem.azurecr.io/cloud/datasource:${UI_BAKERY_VERSION:-latest}
        restart: always
        env_file: .env
        deploy:
          mode: replicated
          replicas: 4
    ---
    apiVersion: autoscaling/v2
    kind: HorizontalPodAutoscaler
    metadata:
      name: ui-bakery-datasource-hpa
      namespace: ui-bakery
    spec:
      scaleTargetRef:
        apiVersion: apps/v1
        kind: Deployment
        name: ui-bakery-datasource
      minReplicas: 2
      maxReplicas: 4
      metrics:
      - type: Resource
        resource:
          name: cpu
          target:
            type: Utilization
            averageUtilization: 70
    cd ./ui-bakery-on-premise
    ./update.sh
    cd ./ui-bakery-on-premise
    # pull new images
    docker compose pull
    # restart UI Bakery
    docker compose down && docker compose up -d
    docker image prune -a -f
    cp -R ui-bakery-on-premise ui-bakery-on-premise_old
    curl -k -L -o docker-compose.yml <https://raw.githubusercontent.com/uibakery/self-hosted/main/docker-compose.yml>
    nano .env
    
    #UI_BAKERY_WORKBENCH_PATH=...
    sudo docker compose build --pull
    sudo docker compose pull
    sudo docker compose up -d

    Manual w/ docker run

    We strongly recommend not to use this installation option, unless you don't have any other option. In most of cases, you should go with docker compose installation option since it is much easier for initial setup and further maintenance.

    Prerequisites

    • Install 20.10.11 version or higher

    • Create a directory for on-premise configuration files and download setup script:

    • Run the setup.sh script to create .env file with required environmental variables: ./setup.sh

    Installation

    Pulling container images

    First of all, pull all the docker images from UI Bakery's Docker container repository.

    Note, that you might not need Mysql image in case you are using an external database.

    Creating a Docker network for images

    This network will be later used by containers to communicate with each other.

    Starting containers one by one

    In order to start the UI Bakery containers and run them one by one, use the following commands.

    db (Internal UI Bakery database)

    Used for storing user accounts and project metadata (not needed if an external database is used):

    bakery-back

    Bakery backend which is responsible for storing user accounts, project metadata, etc.

    workbench-front

    UI Bakery end-user frontend:

    bakery-front

    UI Bakery developer and workspace frontend:

    datasource

    UI Bakery data source connection middleware:

    python-runtime

    UI Bakery python backend code middleware:

    automation

    UI Bakery module for creating scheduled jobs and webhooks:

    gateway

    An entry point for all UI Bakery client requests:

    bakery-db

    Built-in , available as in UI Bakery:

    Updating to the newer version

    Pull the new container versions using. You can also pull a specific version by changing the :latest tag to the version that you need.

    Stop running containers:

    Remove the containers:

    Restart all the containers except MySQL (db) and PostgreSQL (bakery-db) as defined in the .

    docker
    PostgreSQL
    data source
    the command specified above
    section above
    mkdir ui-bakery-on-premise && cd ui-bakery-on-premise && curl -k -L -o setup.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/setup.sh
    docker pull cruibakeryonprem.azurecr.io/cloud/gateway:latest &&\
    docker pull cruibakeryonprem.azurecr.io/cloud/bakery-front:latest &&\
    docker pull cruibakeryonprem.azurecr.io/cloud/workbench-front:latest &&\
    docker pull cruibakeryonprem.azurecr.io/cloud/datasource:latest &&\
    docker pull cruibakeryonprem.azurecr.io/cloud/python-runtime:latest &&\
    docker pull cruibakeryonprem.azurecr.io/cloud/bakery-back:latest &&\
    docker pull cruibakeryonprem.azurecr.io/cloud/automation:latest &&\
    docker pull postgres:16.1 &&\
    docker pull mysql:8.0
    docker network create ui-bakery-on-premise
    docker run -d \
      --name db \
      --restart always \
      --platform linux/amd64 \
      --cap-add SYS_NICE \
      --env-file .env \
      -e MYSQL_DATABASE=bakery \
      -e MYSQL_USER=bakery \
      -e MYSQL_PASSWORD=bakery \
      -e MYSQL_ROOT_PASSWORD=root \
      -v my-db:/var/lib/mysql \
      --health-cmd 'mysql -h localhost -u bakery --password=bakery -e "select 1"' \
      --health-timeout 1s \
      --health-interval 10s \
      --health-retries 10 \
      --network=ui-bakery-on-premise \
      mysql:8.0 --default-authentication-plugin=mysql_native_password
    docker run -d \
      --name bakery-back \
      --env-file .env \
      --restart always \
      --network ui-bakery-on-premise \
      cruibakeryonprem.azurecr.io/cloud/bakery-back:latest
    docker run -d \
      --name workbench-front \
      --env-file .env \
      --restart always \
      --network ui-bakery-on-premise \
      cruibakeryonprem.azurecr.io/cloud/workbench-front:latest
    docker run -d \
      --name bakery-front \
      --env-file .env \
      --restart always \
      --network ui-bakery-on-premise \
      cruibakeryonprem.azurecr.io/cloud/bakery-front:latest
    docker run -d \
      --name datasource \
      --env-file .env \
      --restart always \
      --network ui-bakery-on-premise \
      cruibakeryonprem.azurecr.io/cloud/datasource:latest
    docker run -d \
      --name python-runtime \
      --env-file .env \
      --restart always \
      --network ui-bakery-on-premise \
      cruibakeryonprem.azurecr.io/cloud/python-runtime:latest
    docker run -d \
      --name automation \
      --env-file .env \
      --restart always \
      --network ui-bakery-on-premise \
      cruibakeryonprem.azurecr.io/cloud/automation:latest
    docker run -d \
      --name gateway \
      --env-file .env \
      -p ${UI_BAKERY_PORT:-3030}:3030 \
      --restart always \
      --network ui-bakery-on-premise \
      cruibakeryonprem.azurecr.io/cloud/gateway:latest
    docker run -d \
      --name bakery-db \
      --restart always \
      --health-cmd "pg_isready -U bakery" \
      --health-interval 1s \
      --health-timeout 5s \
      --health-retries 10 \
      --env-file .env \
      -e POSTGRES_USER="bakery" \
      -e POSTGRES_PASSWORD="bakery" \
      -e POSTGRES_DB="bakery" \
      -v internal-db:/var/lib/postgresql/data \
      --network ui-bakery-on-premise \
      postgres:16.1
    docker stop gateway automation datasource python-runtime bakery-front workbench-front bakery-back
    docker rm gateway automation datasource python-runtime bakery-front workbench-front bakery-back

    AWS EC2 instance

    To deploy UI Bakery to an AWS EC2 instance, follow these steps:

    1. Open AWS Management Console and select Services - EC2 (Virtual Servers in the Cloud).

    2. Select Network & Security - Security Groups. Click Create security group button in the top right corner.

    3. Input Bakery in Security group name and Bakery security group in Description.

    4. In block Inbound rules, click Add rule button. Select Custom TCP in the Type, input {BakeryPort} (use 3030 by default, you will need to select the same port during UI Bakery installation later) in the Port range and select Anywhere-IPv4 in the Source.

    5. In block Inbound rules click Add rule button. Select SSH in the Type and select Anywhere-IPv4 in the Source.

    6. Click Create security group.

    7. Select Network & Security - Key Pairs. Click Create key pairs button in the top right corner.

    8. Input Bakery in Name. Select RCA in Key pair type. Select .pem in Private key file format, if you will be connecting to the VM using OpenSSH, or select .ppk in Private key file format, if you will be connecting to the VM using Putty.

    9. Save the key file to the disk of the local machine.

    10. Select Instances - Instance Types. Select t2.medium in the Instance types list. Click Action - Launch instance button in the top right corner.

    11. Input 'Bakery' in Name.

    12. Select an image of Ubuntu Server 18.04 or higher in the Application and OS Images (Amazon Machine Image).

    13. Select 'Bakery' in Key pair (login) - Key pair name - required.

    14. Select 'Bakery' in Network settings - Select existing security group - Common security groups.

    15. Input 20 GiB in Configure storage - 1x.

    16. Click Launch instance button in the bottom right corner.

    17. After creating and running the virtual machine, connect to it from outside (OpenSSH or Putty) using SSH protocol (use the previously saved key file).

    18. Run this command preferably from the /home Linux directory to download, install and launch UI Bakery:

    19. Upon request, enter the previously received license code, hosting URL - Public IPv4 address AWS EC2 Instance, and port ({BakeryPort} which you selected in the earlier steps 3030 by default).

    20. After the installation is completed and launched, enter the bakery from a browser on your local machine at http://{Public IPv4 address AWS EC2 Instance}:{BakeryPort}.

    curl -k -L -o install.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/install.sh && bash ./install.sh