* Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
73 lines
3.0 KiB
Bash
Executable File
73 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# run the following commands before the docker run command
|
|
# brew install mkcert (if you don't already have it installed)
|
|
# run the following commented command from the project root directory
|
|
# cd docker && mkcert -install && mkcert "*.appsmith.com" && cd ..
|
|
# If this returns a hash successfully, then you can access the application locally using https://dev.appsmith.com
|
|
|
|
if ! docker_loc="$(type -p "docker")" || [[ -z $docker_loc ]]; then
|
|
echo "Could not find docker cli"
|
|
exit
|
|
fi
|
|
|
|
if ! envsubst_loc="$(type -p "envsubst")" || [[ -z $envsubst_loc ]]; then
|
|
echo "Could not find envsubst: If you're on a mac; brew install gettext"
|
|
exit
|
|
fi
|
|
|
|
|
|
KEY_FILE=./docker/_wildcard.appsmith.com-key.pem
|
|
CERT_FILE=./docker/_wildcard.appsmith.com.pem
|
|
if ! test -f "$KEY_FILE" || ! test -f "$CERT_FILE"; then
|
|
echo "
|
|
KEY and/or CERTIFICATE not found
|
|
Please install mkcert and generate
|
|
the key and certificate files
|
|
by running the following command
|
|
|
|
cd docker && mkcert -install && mkcert \"*.appsmith.com\" && cd ..
|
|
|
|
"
|
|
exit
|
|
fi
|
|
|
|
ENV_FILE=../../.env
|
|
if ! test -f "$ENV_FILE"; then
|
|
echo "
|
|
Please populate the .env at the root of the project and run again
|
|
Or add the environment variables defined in .env.example to the environment
|
|
-- to enable features
|
|
"
|
|
else
|
|
export $(grep -v '^[[:space:]]*#' ${ENV_FILE} | xargs)
|
|
fi
|
|
|
|
unameOut="$(uname -s)"
|
|
vars_to_substitute="$(printf '\$%s,' $(grep -o "^APPSMITH_[A-Z0-9_]\+" ../../.env | xargs))"
|
|
case "${unameOut}" in
|
|
Linux*) machine=Linux
|
|
echo "
|
|
Starting nginx for Linux...
|
|
"
|
|
cat ./docker/templates/nginx-linux.conf.template | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx.conf &&
|
|
sudo docker run --network host --name wildcard-nginx -d -p 80:80 -p 443:443 -v `pwd`/docker/nginx.conf:/etc/nginx/conf.d/app.conf -v `pwd`/docker/_wildcard.appsmith.com.pem:/etc/certificate/dev.appsmith.com.pem -v `pwd`/docker/_wildcard.appsmith.com-key.pem:/etc/certificate/dev.appsmith.com-key.pem nginx:latest \
|
|
&& echo "
|
|
nginx is listening on port 443 and forwarding to port 3000
|
|
visit https://dev.appsmith.com
|
|
"
|
|
;;
|
|
Darwin*) machine=Mac
|
|
echo "
|
|
Starting nginx for MacOS...
|
|
"
|
|
cat ./docker/templates/nginx-mac.conf.template | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx.conf &&
|
|
docker run --name wildcard-nginx -d -p 80:80 -p 443:443 -v `pwd`/docker/nginx.conf:/etc/nginx/conf.d/app.conf -v `pwd`/docker/_wildcard.appsmith.com.pem:/etc/certificate/dev.appsmith.com.pem -v `pwd`/docker/_wildcard.appsmith.com-key.pem:/etc/certificate/dev.appsmith.com-key.pem nginx:latest \
|
|
&& echo "
|
|
nginx is listening on port 443 and forwarding to port 3000
|
|
visit https://dev.appsmith.com
|
|
"
|
|
;;
|
|
*) echo "Unknown OS: Please use MacOS or a distribution of linux."
|
|
esac
|