Heroku Button implementation (#1721)
This change adds Heroku to the list of installation targets for Appsmith
This commit is contained in:
parent
de435ed009
commit
d5480c4f34
103
app.json
Normal file
103
app.json
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
{
|
||||
"name": "Appsmith",
|
||||
"description": "Appsmith is an open-source platform to build and deploy internal tools or admin panels.",
|
||||
"keywords": [
|
||||
"java",
|
||||
"react",
|
||||
"admin"
|
||||
],
|
||||
"addons": [
|
||||
{
|
||||
"plan": "heroku-redis:hobby-dev",
|
||||
"as": "APPSMITH_REDIS"
|
||||
}
|
||||
],
|
||||
|
||||
"website": "https://appsmith.com/",
|
||||
"logo": "https://raw.githubusercontent.com/appsmithorg/appsmith/release/static/logo.png",
|
||||
"success_url": "/",
|
||||
"stack": "container",
|
||||
"env": {
|
||||
"APPSMITH_MONGODB_URI": {
|
||||
"description": "Your Mongo Database URI",
|
||||
"value": ""
|
||||
},
|
||||
"APPSMITH_ENCRYPTION_PASSWORD": {
|
||||
"description": "Encryption password to encrypt all credentials in the database",
|
||||
"value": ""
|
||||
},
|
||||
"APPSMITH_ENCRYPTION_SALT": {
|
||||
"description" : "Encryption salt used to encrypt all credentials in the database",
|
||||
"value": ""
|
||||
},
|
||||
"APPSMITH_MAIL_ENABLED": {
|
||||
"description" : "Set this value to true to enable email sending",
|
||||
"value": "false",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_MAIL_FROM": {
|
||||
"description" : "Email ID using which emails will be sent from your installation ",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_REPLY_TO": {
|
||||
"description" : "Email ID to which all email replies will be sent to",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_MAIL_HOST": {
|
||||
"description" : "The host endpoint for the SMTP server",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_MAIL_SMTP_TLS_ENABLED" : {
|
||||
"description": "Set this value to enable TLS for your SMTP server",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_MAIL_USERNAME": {
|
||||
"description" : "SMTP username",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_MAIL_PASSWORD": {
|
||||
"description" : "SMTP password",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_MAIL_SMTP_AUTH" : {
|
||||
"description" : "Set this value to true if your SMTP server requires authentication",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_OAUTH2_GOOGLE_CLIENT_ID": {
|
||||
"description": "Client ID provided by Google for OAuth2 login",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET": {
|
||||
"description" : "Client secret provided by Google for OAuth2 login",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_OAUTH2_GITHUB_CLIENT_ID": {
|
||||
"description" : "Client ID provided by Github for OAuth2 login",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET": {
|
||||
"description" : "Client secret provided by Github for OAuth2 login",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_GOOGLE_MAPS_API_KEY": {
|
||||
"description" : "Google Maps API key which is required if you wish to leverage Google Maps widget. Read more at: https://docs.appsmith.com/third-party-services/google-maps",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"APPSMITH_DISABLE_TELEMETRY": {
|
||||
"description" : "We want to be transparent and request that you share anonymous usage data with us. This data is purely statistical in nature and helps us understand your needs & provide better support to your self-hosted instance. You can read more about what information is collected in our documentation https://docs.appsmith.com/telemetry/telemetry",
|
||||
"value": "false"
|
||||
}
|
||||
}
|
||||
}
|
||||
23
deploy/heroku/Dockerfile
Normal file
23
deploy/heroku/Dockerfile
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
FROM appsmith/appsmith-editor as frontend
|
||||
|
||||
FROM appsmith/appsmith-server
|
||||
|
||||
RUN mkdir -p /var/www/appsmith
|
||||
COPY --from=appsmith/appsmith-editor /var/www/appsmith /var/www/appsmith
|
||||
|
||||
RUN apk add --update nginx && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
mkdir -p /tmp/nginx/client-body && \
|
||||
apk add gettext && apk add bash && \
|
||||
rm /bin/sh && \
|
||||
ln -s /bin/bash /bin/sh
|
||||
|
||||
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY default.conf.template /etc/nginx/conf.d/default.conf.template
|
||||
COPY bootstrap.sh .
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["./bootstrap.sh"]
|
||||
90
deploy/heroku/README.MD
Normal file
90
deploy/heroku/README.MD
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
## Deploy Appsmith using Heroku
|
||||
Quickly set up Appsmith to explore product functionality using Heroku.
|
||||
|
||||
## Heroku Installation
|
||||
- Sign up for a free account on Heroku
|
||||
- Click the [](https://heroku.com/deploy?template=https://github.com/appsmithorg/appsmith/tree/master) button
|
||||
- Fill in the required `Config Variables` including:
|
||||
- `APPSMITH_ENCRYPTION_PASSWORD`: Encryption password to encrypt all credentials in the database
|
||||
- `APPSMITH_ENCRYPTION_SALT`: Encryption salt used to encrypt all credentials in the database
|
||||
- `APPSMITH_MONGODB_URI`: Your Mongo Database URI
|
||||
- (Optional) Customize the default settings in Heroku
|
||||
- `App Name`: Optionally select a name for your application (this will be used in the app URL)
|
||||
- `Runtime Selection`: Select which region your app should run in (United States or Europe)
|
||||
- `Config Variables`:
|
||||
- Email Configuration:
|
||||
- `APPSMITH_MAIL_ENABLED`: Set this value to true to enable email sending (value should be `true/false` only)
|
||||
- `APPSMITH_MAIL_FROM`: Email ID using which emails will be sent from your installation
|
||||
- `APPSMITH_REPLY_TO`: Email ID to which all email replies will be sent to
|
||||
- `APPSMITH_MAIL_HOST`: The host endpoint for the SMTP server
|
||||
- `APPSMITH_MAIL_SMTP_TLS_ENABLED`: Set this value to enable TLS for your SMTP server (value should be `true/false` only)
|
||||
- `APPSMITH_MAIL_USERNAME`: SMTP username
|
||||
- `APPSMITH_MAIL_PASSWORD`: SMTP password
|
||||
- Oauth Configuration:
|
||||
- Google Oauth:
|
||||
- `APPSMITH_OAUTH2_GOOGLE_CLIENT_ID`: Client ID provided by Google for OAuth2 login
|
||||
- `APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET`: Client secret provided by Google for OAuth2 login
|
||||
- Github Oauth:
|
||||
- `APPSMITH_OAUTH2_GITHUB_CLIENT_ID`: Client ID provided by Github for OAuth2 login
|
||||
- `APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET`: Client secret provided by Github for OAuth2 login
|
||||
- `APPSMITH_GOOGLE_MAPS_API_KEY`: Google Maps API key which is required if you wish to leverage Google Maps widget. Read more at: https://docs.appsmith.com/third-party-services/google-maps
|
||||
- `APPSMITH_DISABLE_TELEMETRY`: We want to be transparent and request that you share anonymous usage data with us. This data is purely statistical in nature and helps us understand your needs & provide better support to your self-hosted instance. You can read more about what information is collected in our documentation https://docs.appsmith.com/telemetry/telemetry
|
||||
|
||||
After Heroku finishes setting up the app, click “View” and your Appsmith should be up and running. You will be taken to the account creation page, where you can enter credentials to create an account and get started.
|
||||
|
||||
|
||||
{% hint style="warning" %}
|
||||
- We use Heroku Redis addon for caching which required your account to have billing information, but we use the free plan of this addon so it will charge you nothing. Please make sure your account already finish providing billing information.
|
||||
- You may need to wait 2 - 3 minutes before accessing the application.
|
||||
{% endhint %}
|
||||
|
||||
|
||||
## Custom domain
|
||||
To create your custom domain with your app, please follow these steps below:
|
||||
- Go to your app's settings tab
|
||||

|
||||
- Click `Add domain` button in Domains section
|
||||

|
||||
- Input your domain name & click `Next`. Heroku will provide you a DNS Target that you can map your domain with
|
||||

|
||||

|
||||
|
||||
- Make sure that your DNS Record is update so that your custom domain will map to `DNS Target`
|
||||
|
||||
- Once you finish, now you can access Appsmith from your custom domain
|
||||
|
||||
{% hint style="warning" %}
|
||||
- Once you use a custom domain, You might want to setup SSL for your dyno. Please check the official document of Heroku [how to configure SSL](https://devcenter.heroku.com/articles/ssl)
|
||||
- Your dyno will need to be upgrade to at least `hobby` type to use this feature of heroku
|
||||
|
||||
{% endhint %}
|
||||
|
||||
|
||||
## Re-Deploy your App using Heroku CLI
|
||||
To re-deploy your app (re-build & re-run), make sure you have Docker & Heroku CLI setup locally then follow steps below:
|
||||
- Pull the appsmith repository & move to `heroku` folder:
|
||||
```
|
||||
git clone --branch master https://github.com/appsmithorg/appsmith
|
||||
cd ./appsmith/deploy/heroku
|
||||
```
|
||||
- Login to Heroku CLI
|
||||
```
|
||||
heroku login
|
||||
```
|
||||
- Login to Container Registry
|
||||
```
|
||||
heroku container:login
|
||||
```
|
||||
- Get your application name
|
||||
```
|
||||
heroku apps
|
||||
```
|
||||
- Push your Docker-based app
|
||||
```
|
||||
heroku container:push web -a <Your App Name>
|
||||
```
|
||||
- Deploy the changes
|
||||
```
|
||||
heroku container:release web -a <Your App Name>
|
||||
```
|
||||
|
||||
51
deploy/heroku/bootstrap.sh
Executable file
51
deploy/heroku/bootstrap.sh
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
function get_maximum_heap(){
|
||||
resource=$(ulimit -u)
|
||||
echo "Resource : $resource"
|
||||
if [[ "$resource" -le 256 ]]; then
|
||||
maximum_heap=128
|
||||
elif [[ "$resource" -le 512 ]]; then
|
||||
maximum_heap=256
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function start_applcation(){
|
||||
nginx
|
||||
if [[ ! -z ${maximum_heap} ]]; then
|
||||
backend_start_command="java -Xmx${maximum_heap}m -Dserver.port=8080 -Djava.security.egd='file:/dev/./urandom' -jar server.jar"
|
||||
else
|
||||
backend_start_command="java -Dserver.port=8080 -Djava.security.egd='file:/dev/./urandom' -jar server.jar"
|
||||
fi
|
||||
eval $backend_start_command
|
||||
}
|
||||
|
||||
# Check for enviroment vairalbes
|
||||
if [[ -z "${APPSMITH_MAIL_ENABLED}" ]]; then
|
||||
unset APPSMITH_MAIL_ENABLED # If this field is empty is might cause application crash
|
||||
fi
|
||||
|
||||
if [[ -z "${APPSMITH_OAUTH2_GITHUB_CLIENT_ID}" ]] || [[ -z "${APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET}" ]]; then
|
||||
unset APPSMITH_OAUTH2_GITHUB_CLIENT_ID # If this field is empty is might cause application crash
|
||||
unset APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET
|
||||
fi
|
||||
|
||||
if [[ -z "${APPSMITH_OAUTH2_GOOGLE_CLIENT_ID}" ]] || [[ -z "${APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET}" ]]; then
|
||||
unset APPSMITH_OAUTH2_GOOGLE_CLIENT_ID # If this field is empty is might cause application crash
|
||||
unset APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET
|
||||
fi
|
||||
|
||||
if [[ -z "${APPSMITH_GOOGLE_MAPS_API_KEY}" ]]; then
|
||||
unset APPSMITH_GOOGLE_MAPS_API_KEY
|
||||
fi
|
||||
|
||||
cat /etc/nginx/conf.d/default.conf.template | envsubst "$(printf '$%s,' $(env | grep -Eo '^APPSMITH_[A-Z0-9_]+'))" | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > /etc/nginx/conf.d/default.conf.template.1
|
||||
|
||||
envsubst "\$PORT" < /etc/nginx/conf.d/default.conf.template.1 > /etc/nginx/conf.d/default.conf
|
||||
|
||||
get_maximum_heap
|
||||
start_applcation
|
||||
|
||||
53
deploy/heroku/default.conf.template
Normal file
53
deploy/heroku/default.conf.template
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
server {
|
||||
|
||||
listen $PORT default_server;
|
||||
client_max_body_size 10m;
|
||||
|
||||
gzip on;
|
||||
|
||||
root /var/www/appsmith;
|
||||
index index.html index.htm;
|
||||
|
||||
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.html =404;
|
||||
sub_filter __APPSMITH_SENTRY_DSN__ '${APPSMITH_SENTRY_DSN}';
|
||||
sub_filter __APPSMITH_SMART_LOOK_ID__ '${APPSMITH_SMART_LOOK_ID}';
|
||||
sub_filter __APPSMITH_OAUTH2_GOOGLE_CLIENT_ID__ '${APPSMITH_OAUTH2_GOOGLE_CLIENT_ID}';
|
||||
sub_filter __APPSMITH_OAUTH2_GITHUB_CLIENT_ID__ '${APPSMITH_OAUTH2_GITHUB_CLIENT_ID}';
|
||||
sub_filter __APPSMITH_MARKETPLACE_ENABLED__ '${APPSMITH_MARKETPLACE_ENABLED}';
|
||||
sub_filter __APPSMITH_SEGMENT_KEY__ '${APPSMITH_SEGMENT_KEY}';
|
||||
sub_filter __APPSMITH_OPTIMIZELY_KEY__ '${APPSMITH_OPTIMIZELY_KEY}';
|
||||
sub_filter __APPSMITH_ALGOLIA_API_ID__ '${APPSMITH_ALGOLIA_API_ID}';
|
||||
sub_filter __APPSMITH_ALGOLIA_SEARCH_INDEX_NAME__ '${APPSMITH_ALGOLIA_SEARCH_INDEX_NAME}';
|
||||
sub_filter __APPSMITH_ALGOLIA_API_KEY__ '${APPSMITH_ALGOLIA_API_KEY}';
|
||||
sub_filter __APPSMITH_CLIENT_LOG_LEVEL__ '${APPSMITH_CLIENT_LOG_LEVEL}';
|
||||
sub_filter __APPSMITH_GOOGLE_MAPS_API_KEY__ '${APPSMITH_GOOGLE_MAPS_API_KEY}';
|
||||
sub_filter __APPSMITH_TNC_PP__ '${APPSMITH_TNC_PP}';
|
||||
sub_filter __APPSMITH_VERSION_ID__ '${APPSMITH_VERSION_ID}';
|
||||
sub_filter __APPSMITH_VERSION_RELEASE_DATE__ '${APPSMITH_VERSION_RELEASE_DATE}';
|
||||
sub_filter __APPSMITH_INTERCOM_APP_ID__ '${APPSMITH_INTERCOM_APP_ID}';
|
||||
sub_filter __APPSMITH_MAIL_ENABLED__ '${APPSMITH_MAIL_ENABLED}';
|
||||
sub_filter __APPSMITH_DISABLE_TELEMETRY__ '${APPSMITH_DISABLE_TELEMETRY}';
|
||||
}
|
||||
|
||||
location /f {
|
||||
proxy_pass https://cdn.optimizely.com/;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://localhost:8080;
|
||||
}
|
||||
|
||||
location /oauth2 {
|
||||
proxy_pass http://localhost:8080;
|
||||
}
|
||||
|
||||
location /login {
|
||||
proxy_pass http://localhost:8080;
|
||||
}
|
||||
|
||||
}
|
||||
BIN
deploy/heroku/images/add-domain-button.png
Normal file
BIN
deploy/heroku/images/add-domain-button.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
BIN
deploy/heroku/images/add-domain-form.png
Normal file
BIN
deploy/heroku/images/add-domain-form.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
BIN
deploy/heroku/images/app-settings.png
Normal file
BIN
deploy/heroku/images/app-settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 216 KiB |
BIN
deploy/heroku/images/finish.png
Normal file
BIN
deploy/heroku/images/finish.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
41
deploy/heroku/nginx.conf
Normal file
41
deploy/heroku/nginx.conf
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '"$time_local" client=$remote_addr '
|
||||
'method=$request_method request="$request" '
|
||||
'request_length=$request_length '
|
||||
'status=$status bytes_sent=$bytes_sent '
|
||||
'body_bytes_sent=$body_bytes_sent '
|
||||
'referer=$http_referer '
|
||||
'http_x_forwarded_for=$http_x_forwarded_for '
|
||||
'user_agent="$http_user_agent" '
|
||||
'upstream_addr=$upstream_addr '
|
||||
'upstream_status=$upstream_status '
|
||||
'request_time=$request_time '
|
||||
'upstream_response_time=$upstream_response_time '
|
||||
'upstream_connect_time=$upstream_connect_time '
|
||||
'upstream_header_time=$upstream_header_time';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
3
heroku.yml
Normal file
3
heroku.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
build:
|
||||
docker:
|
||||
web: deploy/heroku/Dockerfile
|
||||
Loading…
Reference in New Issue
Block a user