GitHub - tiddbits/self-hosted: Internal tools and workflow automations

UI Bakery is a low-code platform to build apps and automations you never had time for

Get StartedDocsTutorialsWhat's newRoadmap

UI Bakery - Internal tools and workflow automations

Deploying UI Bakery on-premise

Deploy UI Bakery locally to manage your data from your private network

We understand that you might have lots of data accessible from your private network, that’s why you can use UI Bakery self-hosted version for your benefit.

On-premise version grants you:

  • A quick setup process
  • Custom branding
  • Custom domain hosting
  • Google SSO
  • SAML-based identity providers
  • Data is stored securely under your own VPS

✔️ UI Bakery on-premise version license key can be obtained here

⚠️ If you have already installed UI Bakery on-premise version, follow this guide to update your version.

Table of contents

Installation

This document describes how to deploy 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.

Requirements

  • ⚠️ OS Linux Ubuntu 18.04 and above.
  • Must have full rights to use "sudo".

Installation steps

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

    curl -k -L -o install.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/install.sh && bash ./install.sh
  2. In the process, upon request, enter the previously received license code, hosting URL and port.

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

NOTE: If Docker of the 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.

Deploying on Azure Virtual Machine

  1. Open Azure Portal and on 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 instance size, select 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:

    curl -k -L -o install.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/install.sh && bash ./install.sh
  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}

Manual installation

⚠️ 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 сonfiguration files:

    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
  • Get the license key from UI Backery Team. You'll get a key like of the following format: eyJhbaj8es9fj9aesI6IkpXVCJ9.eyJsjioOHGEFOJeo0JSe98fJEJSEJFImVtYWlsIjoibmlrLnBvbHRvcmF0c2t5QGdtYWlsLmNvbSJ9.2n9q1LmjnBn62KyAM3FlYZ8PzQcxmIK0_mptNv38ufM

  • 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.

Kubernetes

  1. Clone the repository git clone git@github.com:uibakery/self-hosted.git
  2. Open the kubernetes directory
  3. Edit the ui-bakery-configmap.yaml, and set the required variables inside the {{ ... }}, where:
  • 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 UI Bakery team
  • You either have to run a standalone database instance or make sure standard PersistentVolumeClaim exists in your cluster.
  1. Run kubectl apply -f .

Please note that the application will be exposed on a public ip address on port 3030, so DNS and SSL have to be handled by the user.

Azure container instance

  1. Login docker to azure.
  1. Create docker context.
docker context create aci uibakery
  1. Use new context.
docker context use uibakery
  1. Clone ui bakery self-hosted repository.
git clone https://github.com/uibakery/self-hosted.git && cd self-hosted
  1. UI Bakery requires db to persist its data. So we have to create one. We suggest you using Azure Database for MySQL.

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

- UI_BAKERY_LICENSE_KEY=${UI_BAKERY_LICENSE_KEY:-eyJhbGciOiJIUz}
  1. Set UI_BAKERY_DB_* variables in docker-compose-azure-container-instances.yml for bakery-back service.
- 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-test-db}
- UI_BAKERY_DB_PASSWORD=${UI_BAKERY_DB_PASSWORD:-uibakerypassword}
  1. Up azure container instance.
docker compose -f docker-compose-azure-container-instances.yml up
  1. Find assigned IP address. Run docker ps and in colum PORTS you'll find assigned IP address.

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

- UI_BAKERY_APP_SERVER_NAME=https://123.123.123.123:80
  1. Restart instance to apply new configuration.
docker compose -f docker-compose-external-db.yml up

Running a standalone database instance

In case when a 3rd party MySQL instance is required:

  1. Provide the following environment variables:

    UI_BAKERY_DB_HOST=192.168.0.1
    UI_BAKERY_DB_PORT=3306
    UI_BAKERY_DB_DATABASE=bakery
    UI_BAKERY_DB_USERNAME=username
    UI_BAKERY_DB_PASSWORD=password
  2. Run docker-compose -f ./docker-compose-external-db.yml up to start the containers, alternatively, docker-compose -f ./docker-compose-external-db.yml up -d to run containers in the background.

Running on a remote instance

If you would like to run UI Bakery not on localhost, but on a server, you need to provide the following variables:

UI_BAKERY_APP_SERVER_NAME=http://YOUR_DOMAIN_OR_IP:3030
UI_BAKERY_PORT=3030

⚠️ UI_BAKERY_PORT variable must match port in UI_BAKERY_APP_SERVER_NAME variable

In your DNS provider, configure the following records:

  • A or CNAME record with UI Bakery instance host

Then modify your environment variable with the following values:

UI_BAKERY_APP_SERVER_NAME=https://YOUR_DOMAIN
UI_BAKERY_PORT=80

Google OAuth setup

  1. Create OAuth Client ID in Google Developer Console

    • Create or choose an existing project.
    • Click on “Create credentials”.
    • Choose “OAuth Client ID”.
    • Choose “Web Application” Application type.
    • Specify http://localhost:3030 or UI_BAKERY_APP_SERVER_NAME for authorized javascript origin.
    • Specify http://localhost:3030/auth/oauth2/callback or UI_BAKERY_APP_SERVER_NAME/auth/oauth2/callback for authorized redirect URLs.
    • Click “Create”.
    • Copy “Your Client ID”.
  2. Provide UI_BAKERY_GOOGLE_CLIENT_ID=Your Client ID environment variable.

  3. Provide UI_BAKERY_APP_SERVER_NAME=http(s)://youdomain.com environment variable in case you want to run UI Bakery on a custom domain/IP.

  4. Run docker-compose up if you want to use the embedded database.

  5. Or run docker-compose -f ./docker-compose-external-db.yml up with environment variables described in Running a standalone database instance above in case you want to use an external database.

SAML authentication setup

  1. Configure your Identity provider. In identity provider settings, set Sign on URL and Reply URL to https://APP_LOCATION/api/auth/login/saml. Replace APP_LOCATION with UI Bakery instance URL. Configure name and role attributes. You can set claim name in identity provider settings or in UI Bakery env variables UI_BAKERY_SAML_NAME_CLAIM and UI_BAKERY_SAML_ROLE_CLAIM.

  2. Provide URL of your identity provider metadata and entity ID via the following env variables:

    UI_BAKERY_SAML_METADATA_URL=https://your.identityprovider.com/federationmetadata/2007-06/federationmetadata.xml.
    UI_BAKERY_SAML_ENTITY_ID=http://appregestry.com/myapp/primary
  3. Set variable UI_BAKERY_SAML_ENABLED=true

  4. You can add a role mapping from identity provider role to UI Bakery role via env variable:

    UI_BAKERY_ROLE_MAPPING=identityRoleName->bakeryRoleName,identityRoleName2->bakeryRoleName2
  5. You can set the variable UI_BAKERY_SAML_LOGIN_AUTO to true to enable automatic login. Any unauthorized user will be redirected to SAML login flow.

Other authentication setting

  1. You can disable email authentication by providing the environment variable UI_BAKERY_GOOGLE_AUTH_ONLY=true

  2. Provide UI_BAKERY_AUTH_RESTRICTED_DOMAIN=domain.com environment variable to restrict Google login only to the specified domain.

Limitations

  • Emails won’t be sent from the local instance, although the invitation system works in a way that any invited email can access the organization by creating an account.

  • Google Sheets connection requires additional setup.

Google Sheets connection setup

Start with creating OAuth Client ID in Google Developer Console. Then, follow the below steps:

  1. Create a new or choose an existing project.
  2. Go to API & Services section.
  3. Click ENABLE APIS AND SERVICES and enable Google Sheets API.
  4. Click on Create credentials and choose Create OAuth client ID.
  5. Select Web Application.
  6. Add Authorized redirect URI with value http://YOUR_IP_OR_DOMAIN/gsheet-oauth-callback
  7. Click Create.
  8. Set credentials in UI_BAKERY_GSHEET_CLIENT_ID and UI_BAKERY_GSHEET_CLIENT_SECRET variables.
  9. Go to OAuth consent screen and create it with an external type.
  10. Publish your consent screen.

Configuring email provider

By default, UI Bakery On-Premise comes with a noop email provider that will only log emails to the backend logs.

Configure Sendgrid

We suggest using Sendgrid email provider to send the emails:

  1. Create a Sendgrid account or use an existing account

  2. Generate an API Key with the Mail Send access enabled

  3. Set the following environment variables:

    UI_BAKERY_MAILING_PROVIDER=sendgrid
    SENDGRID_API_KEY=YOUR_API_KEY
    SENDGRID_EMAIL_FROM=your@company.com # make sure this domain is authorized to send emails in your sendgrid account
  4. Restart the containers.

Once configured, your instance will start using your account to send the user invitation, password reset, and other emails.

Change email templates

By default, email templates and subjects are provided as environment variables, so you can adjust the emails by modifying their content:

# tells that email will be sent as plain text/html
UI_BAKERY_MAILING_TEMPLATES_MODE=custom

UI_BAKERY_MAILING_WELCOME_TEMPLATE=Hello userName,<br> Welcome to UI Bakery workspace.
UI_BAKERY_MAILING_WELCOME_SUBJECT=Welcome to UI Bakery workspace

UI_BAKERY_MAILING_RESET_PASSWORD_TEMPLATE=Hello userName,<br> Here's your <a href="resetPasswordUrl">password reset link</a>.
UI_BAKERY_MAILING_RESET_PASSWORD_SUBJECT=Reset password request

UI_BAKERY_MAILING_CONFIRM_EMAIL_CHANGE_TEMPLATE=Hello userName,<br> Here's a link <a href="changeEmailUrl">to change your email</a>.
UI_BAKERY_MAILING_CONFIRM_EMAIL_CHANGE_SUBJECT=Change email request

UI_BAKERY_MAILING_SHARE_WITH_USER_TEMPLATE=Hello userName,<br> Here's a <a href="organizationUrl">link to access the organizationName workspace</a>.
UI_BAKERY_MAILING_SHARE_WITH_USER_SUBJECT=You are invited to UI Bakery workspace

You can use the following built-in email variables to add user values to your emails:

# All emails
userName, userEmail, subject, userId

# Reset password request
resetPasswordUrl

# Invitation email
organizationUrl, organizationName

# Change email request
changeEmailUrl

Alternatively, you can set up email temples using SendGrid dynamic templates and put template ids instead of plain HTML emails:

# tells that email will be sent using dynamic templates
UI_BAKERY_MAILING_TEMPLATES_MODE=provided

UI_BAKERY_MAILING_WELCOME_TEMPLATE=d-c3f84d76543941c084ff2de0exxxxxxx
UI_BAKERY_MAILING_RESET_PASSWORD_TEMPLATE=d-c3f84d76543941c084ff2de0exxxxxxx
UI_BAKERY_MAILING_CONFIRM_EMAIL_CHANGE_TEMPLATE=d-c3f84d76543941c084ff2de0exxxxxxx
UI_BAKERY_MAILING_SHARE_WITH_USER_TEMPLATE=d-c3f84d76543941c084ff2de0exxxxxxx

⚠️ Note, that in this case an email subject will be taken from a dynamic template configuration and variables such as UI_BAKERY_MAILING_WELCOME_SUBJECT will be ignored.

This way, you don't need to manage templates content inside of your environment variables and can build more advanced email with images and custom styles.

Updating on-premise version

Once an update to the on-premise version is available, we will notify you via email.

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

  1. Take a full backup of UI Bakery instance.
  2. Go to your ui-bakery-on-premise folder:
cd ./ui-bakery-on-premise
  1. Run ./update.sh that will download new images and restart your instance:

Supported Environment Variables