|
| 1 | +# Deprecated methods for deploying Retool on-premise |
| 2 | + |
| 3 | +This repo contains deprecated methods for deploying Retool. |
| 4 | + |
| 5 | +- [AWS one-click deploy](#one-click-deploy-to-aws) |
| 6 | +- [ECS + EC2](#deploying-on-ecs-+-ec2) |
| 7 | +- [Heroku](#deploying-retool-on-heroku) |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +### One-click Deployment to AWS |
| 12 | + |
| 13 | +Region name | Region code | Launch |
| 14 | +--- | --- | --- |
| 15 | +US East (N. Virginia) | us-east-1 | [](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/quickcreate?templateURL=https://s3-external-1.amazonaws.com/cf-templates-x1ljyg3aygh-us-east-1/2021157Dqr-SSOPLaunchJuneo3g1bsca3hh&stackName=retool) |
| 16 | +US West (N. California) | us-west-1 | [](https://us-west-1.console.aws.amazon.com/cloudformation/home?region=us-west-1#/stacks/quickcreate?templateURL=https://s3-external-1.amazonaws.com/cf-templates-x1ljyg3aygh-us-east-1/2021157Dqr-SSOPLaunchJuneo3g1bsca3hh&stackName=retool) |
| 17 | +EU (Ireland) | eu-west-1 | [](https://eu-west-1.console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/quickcreate?templateURL=https://s3-external-1.amazonaws.com/cf-templates-x1ljyg3aygh-us-east-1/2021157Dqr-SSOPLaunchJuneo3g1bsca3hh&stackName=retool) |
| 18 | +Asia Pacific (Mumbai) | ap-south-1 | [](https://ap-south-1.console.aws.amazon.com/cloudformation/home?region=ap-south-1#/stacks/quickcreate?templateURL=https://s3-external-1.amazonaws.com/cf-templates-x1ljyg3aygh-us-east-1/2021157Dqr-SSOPLaunchJuneo3g1bsca3hh&stackName=retool) |
| 19 | +US East (Ohio) | us-east-2 | [](https://us-east-2.console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/quickcreate?templateURL=https://s3-external-1.amazonaws.com/cf-templates-x1ljyg3aygh-us-east-1/2021157Dqr-SSOPLaunchJuneo3g1bsca3hh&stackName=retool) |
| 20 | +US West (Oregon) | us-west-2 | [](https://us-west-2.console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/quickcreate?templateURL=https://s3-external-1.amazonaws.com/cf-templates-x1ljyg3aygh-us-east-1/2021157Dqr-SSOPLaunchJuneo3g1bsca3hh&stackName=retool) |
| 21 | +EU (Frankfurt) | eu-central-1 | [](https://eu-central-1.console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/quickcreate?templateURL=https://s3-external-1.amazonaws.com/cf-templates-x1ljyg3aygh-us-east-1/2021157Dqr-SSOPLaunchJuneo3g1bsca3hh&stackName=retool) |
| 22 | + |
| 23 | +### Deploying on ECS + EC2 |
| 24 | + |
| 25 | +We provide a [template file](/cloudformation/retool.yaml) for you to get started deploying on ECS. |
| 26 | + |
| 27 | +1. In the ECS Dashboard, click **Create Cluster** |
| 28 | +1. Select `EC2 Linux + Networking` as the cluster template. |
| 29 | +1. In your instance configuration, enter the following: |
| 30 | + - Select **On-demand instance** |
| 31 | + - Select **t2.medium** as the instance type (or your desired instance size) |
| 32 | + - Choose how many instances you want to spin up |
| 33 | + - (Optional) Add key pair |
| 34 | + - Choose your existing VPC (or create a new one) |
| 35 | + - (Optional) Add tags |
| 36 | + - Enable CloudWatch container insights |
| 37 | +1. Select the VPC in which you’d like to launch the ECS cluster; make sure that you select a [public subnet](https://stackoverflow.com/questions/48830793/aws-vpc-identify-private-and-public-subnet). |
| 38 | +1. Download the [retool.yaml](/cloudformation/retool.yaml) file, and add your license key and other relevant variables. |
| 39 | +1. Go to the AWS Cloudformation dashboard, and click **Create Stack with new resources → Upload a template file**. Upload your edited `retool.yaml` file. |
| 40 | +1. Then, enter the following parameters: |
| 41 | + - Cluster: the name of the ECS cluster you created earlier |
| 42 | + - DesiredCount: 2 |
| 43 | + - Environment: staging |
| 44 | + - Force: false |
| 45 | + - Image: `tryretool/backend:X.Y.Z` (But replace `X.Y.Z` with your desired version. See [Select a Retool version number](#select-a-retool-version-number) to help you choose a version.) |
| 46 | + - MaximumPercent: 250 |
| 47 | + - MinimumPercent: 50 |
| 48 | + - SubnetId: Select 2 subnets in your VPC - make sure these subnets are public (have an internet gateway in their route table) |
| 49 | + - VPC ID: select the VPC you want to use |
| 50 | +1. Click through to create the stack; this could take up to 15 minutes; you can monitor the progress of the stack being created in the `Events` tab in Cloudformation |
| 51 | +1. After everything is complete, you should see all the resources with a `CREATE_COMPLETE` status. |
| 52 | +1. In the **Outputs** section within the CloudFormation dashboard, you should be able to find the ALB DNS URL. This is where Retool should be running. |
| 53 | +1. The backend tries to guess your domain to create invite links, but with a load balancer in front of Retool you'll need to set the `BASE_DOMAIN` environment variable to your fully qualified domain (i.e. `https://retool.company.com`). Docs [here](https://docs.retool.com/docs/environment-variables). |
| 54 | + |
| 55 | +#### OOM issues |
| 56 | + |
| 57 | +If running into OOM issues (especially on larger instance sizes with >4 vCPUs) |
| 58 | + |
| 59 | +- Verify the issue by going into the ECS console and checking the Service Metrics. Ideally |
| 60 | + - Memory utilization should fall around 40% (20% - 60%) |
| 61 | + - CPU utilization should be close to zero (0% - 5%) |
| 62 | +- If the values fall outside these ranges, increase the CPU and memory allocation in `retool.yml` |
| 63 | + |
| 64 | +### Deploying Retool on Heroku |
| 65 | + |
| 66 | +#### Automatic deploy |
| 67 | + |
| 68 | +[](https://heroku.com/deploy?template=https://github.com/tryretool/retool-onpremise) |
| 69 | + |
| 70 | +You can deploy to Heroku using the following steps: |
| 71 | + |
| 72 | +1. Click the button above to begin your deployment |
| 73 | +1. Provide a unique App name, e.g. `<your-org>-retool` |
| 74 | +1. Provide required config vars: |
| 75 | + * `LICENSE_KEY` - your Retool license key |
| 76 | +1. Set any optional config vars: |
| 77 | + * `USE_GCM_ENCRYPTION` set to `true` for authenticated encryption of |
| 78 | + secrets; if true, `ENCRYPTION_KEY` must be 24 bytes |
| 79 | +1. Click "Deploy app" |
| 80 | + |
| 81 | + |
| 82 | +#### Manual deploy |
| 83 | + |
| 84 | +You can manually deploy to Heroku using the following steps: |
| 85 | + |
| 86 | +1. Install the Heroku CLI, and login. Documentation for this can be found here: <https://devcenter.heroku.com/articles/getting-started-with-nodejs#set-up> |
| 87 | +1. Clone this repo `git clone https://github.com/tryretool/retool-onpremise` |
| 88 | +1. Change the working directory to the newly cloned repository `cd ./retool-onpremise` |
| 89 | +1. Create a new Heroku app with the stack set to `container` with `heroku create your-app-name --stack=container` |
| 90 | +1. Add a database: `heroku addons:create heroku-postgresql:mini` |
| 91 | +1. In the `Settings` page of your Heroku app, add the following environment variables: |
| 92 | + 1. `NODE_ENV` - set to `production` |
| 93 | + 1. `JWT_SECRET` - set to a long secure random string used to sign JSON Web Tokens |
| 94 | + 1. `ENCRYPTION_KEY` - a long secure random string used to encrypt database credentials |
| 95 | + 1. `USE_GCM_ENCRYPTION` set to `true` for authenticated encryption of secrets; if true, `ENCRYPTION_KEY` must be 24 bytes |
| 96 | + 1. `LICENSE_KEY` - your Retool license key |
| 97 | + 1. `PGSSLMODE` - set to `require` |
| 98 | +1. _Optional_: To select the version of Retool used, just edit the first line |
| 99 | + under `./heroku/Dockerfile` to: |
| 100 | + ```docker |
| 101 | + FROM tryretool/backend:X.Y.Z |
| 102 | + ``` |
| 103 | +1. Push the code: `git push heroku master` |
| 104 | + |
| 105 | +### Update Heroku deployment |
| 106 | + |
| 107 | +To update a Heroku deployment that was created with the button above, you'll |
| 108 | +need to push the desired changes to the Heroku remote. |
| 109 | + |
| 110 | +```zsh |
| 111 | +# This assumes you already have the `heroku` CLI installed and are logged in |
| 112 | +heroku git:clone --app=<your-retool-app-name> # default remote name is "heroku" |
| 113 | +git remote add upstream https://github.com/tryretool/retool-onpremise |
| 114 | +# This will incpororate the remote changes into your _local_ copy |
| 115 | +# Also assumes both branches are "master" |
| 116 | +git pull upstream master |
| 117 | +git push heroku master |
| 118 | +``` |
| 119 | + |
| 120 | + |
0 commit comments