PromucFlow_constructor/app/client/docker/start-nginx.sh

37 lines
1.2 KiB
Bash
Raw Normal View History

Use injected configuration from Nginx at runtime instead of build time (#30) * 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>
2020-07-07 10:22:17 +00:00
#!/bin/sh
# This script is baked into the appsmith-editor Dockerfile and is used to boot Nginx when the Docker container starts
# Refer: /app/client/Dockerfile
set -o errexit
set -o xtrace
if [ -z "$APPSMITH_SERVER_PROXY_PASS" ]; then
export APPSMITH_SERVER_PROXY_PASS='http://localhost:8080'
echo "No explicit value for APPSMITH_SERVER_PROXY_PASS, using '$APPSMITH_SERVER_PROXY_PASS'."
fi
cp /nginx-root.conf.template /etc/nginx/nginx.conf
if [ -f /nginx.conf.template ]; then
# This is to support installations where the docker-compose.yml file would mount a template confi at this location.
app_template=/nginx.conf.template
elif [ -z "$APPSMITH_SSL_CERT_PATH" ]; then
if [ -z "$APPSMITH_DOMAIN" ]; then
export APPSMITH_DOMAIN=_
fi
app_template=/nginx-app-http.conf.template
else
if [ -z "$APPSMITH_DOMAIN" ]; then
echo "APPSMITH_DOMAIN is required when SSL is enabled." >&2
exit 2
fi
app_template=/nginx-app-https.conf.template
fi
cat "$app_template" \
| envsubst "$(printf '$%s,' $(env | grep -Eo '^APPSMITH_[A-Z0-9_]+'))" \
| sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' \
| tee /etc/nginx/conf.d/default.conf
Use injected configuration from Nginx at runtime instead of build time (#30) * 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>
2020-07-07 10:22:17 +00:00
exec nginx -g 'daemon off;'