Skip to content

Commit 71e86ce

Browse files
committed
feat: initial commit
0 parents  commit 71e86ce

6 files changed

+207
-0
lines changed

README.md

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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 | [![Launch Stack](https://cdn.rawgit.com/buildkite/cloudformation-launch-stack-button-svg/master/launch-stack.svg)](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 | [![Launch Stack](https://cdn.rawgit.com/buildkite/cloudformation-launch-stack-button-svg/master/launch-stack.svg)](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 | [![Launch Stack](https://cdn.rawgit.com/buildkite/cloudformation-launch-stack-button-svg/master/launch-stack.svg)](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 | [![Launch Stack](https://cdn.rawgit.com/buildkite/cloudformation-launch-stack-button-svg/master/launch-stack.svg)](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 | [![Launch Stack](https://cdn.rawgit.com/buildkite/cloudformation-launch-stack-button-svg/master/launch-stack.svg)](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 | [![Launch Stack](https://cdn.rawgit.com/buildkite/cloudformation-launch-stack-button-svg/master/launch-stack.svg)](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 | [![Launch Stack](https://cdn.rawgit.com/buildkite/cloudformation-launch-stack-button-svg/master/launch-stack.svg)](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+
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](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+

app.json

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "retool",
3+
"description": "Retool Heroku",
4+
"keywords": [
5+
"retool"
6+
],
7+
"logo": "https://avatars.githubusercontent.com/u/33817679",
8+
"repository": "https://github.com/tryretool/retool-onpremise",
9+
"stack": "container",
10+
"formation": {
11+
"web": {
12+
"quantity": 1,
13+
"size": "performance-m"
14+
}
15+
},
16+
"env": {
17+
"ENCRYPTION_KEY": {
18+
"description": "A secret key for encrypting secret credentials when connecting Retool to other databases or API endpoints",
19+
"required": true,
20+
"generator": "secret"
21+
},
22+
"JWT_SECRET": {
23+
"description": "A secret key for signing JSON Web Tokens",
24+
"required": true,
25+
"generator": "secret"
26+
},
27+
"LICENSE_KEY": {
28+
"description": "Your Retool license key",
29+
"required": true
30+
},
31+
"NODE_ENV": {
32+
"description": "The environment to run Retool",
33+
"required": true,
34+
"value": "production"
35+
},
36+
"PGSSLMODE": {
37+
"required": true,
38+
"value": "require"
39+
},
40+
"USE_GCM_ENCRYPTION": {
41+
"description": "Set to `true` for authenticated encryption of secrets",
42+
"required": false
43+
}
44+
},
45+
"addons": [
46+
{
47+
"plan": "heroku-postgresql:standard-0",
48+
"options": {
49+
"version": "11"
50+
}
51+
}
52+
]
53+
}

deployment-checklist.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Deployment Health Checklist
2+
3+
###### Overview
4+
We recommend completing our Deployment Health Checklist to help you improve the stability and reliability of your Retool deployment.
5+
6+
Please fill out the checklist and share it with our team. This information will help us better understand your infrastructure so that we can support you through product changes, proactive outreach, and more informed support.
7+
8+
###### Instructions
9+
Make a copy of the [Deployment Health Checklist](https://docs.google.com/spreadsheets/d/19XYpWTnYrvsllTuM2VQGFWLiXzMHmTNAzZKyWY-sfSU) for your Retool deployment. Add your company name to the document title for reference.
10+
Fill out the requested information on the first and second tabs.
11+
Share your filled out with your Retool contact or [email protected]. We will reference this in the event of any support conversations.

docker-cheatsheet.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### Docker cheatsheet
2+
3+
Below is a cheatsheet for useful Docker commands. Note that you may need to prefix them with `sudo`.
4+
5+
| Command | Description |
6+
| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
7+
| `docker-compose up -d` | Builds, (re)creates, starts, and attaches to containers for a service. `-d`allows containers to run in background (detached). |
8+
| `docker-compose down` | Stops and remove containers and networks |
9+
| `docker-compose stop` | Stops containers, but does not remove them and their networks |
10+
| `docker ps -a` | Display all Docker containers |
11+
| `docker-compose ps -a` | Display all containers related to images declared in the `docker-compose` file. |
12+
| `docker logs -f <container_name>` | Stream container logs to stdout |
13+
| `docker exec -it <container_name> psql -U <postgres_user> -W <postgres_password> <postgres_db>` | Runs `psql` inside a container |
14+
| `docker kill $(docker ps -q)` | Kills all running containers |
15+
| `docker rm $(docker ps -a -q)` | Removes all containers and networks |
16+
| `docker rmi -f $(docker images -q)` | Removes (and un-tags) all images from the host |
17+
| `docker volume rm $(docker volume ls -q)` | Removes all volumes and completely wipes any persisted data |

heroku.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build:
2+
docker:
3+
web: ./heroku/Dockerfile

heroku/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM tryretool/backend:2.103.7
2+
3+
CMD ./docker_scripts/start_api.sh

0 commit comments

Comments
 (0)