diff --git a/app/client/package.json b/app/client/package.json index effa27e4af..5043eb47c1 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -128,6 +128,7 @@ "scripts": { "analyze": "source-map-explorer 'build/static/js/*.js'", "start": "BROWSER=none EXTEND_ESLINT=true REACT_APP_ENVIRONMENT=DEVELOPMENT HOST=dev.appsmith.com craco start", + "start-m1": "BROWSER=none EXTEND_ESLINT=true REACT_APP_ENVIRONMENT=DEVELOPMENT HOST=0.0.0.0 craco start", "build": "./build.sh", "build-local": "craco --max-old-space-size=4096 build --config craco.build.config.js", "build-staging": "REACT_APP_ENVIRONMENT=STAGING craco --max-old-space-size=4096 build --config craco.build.config.js", diff --git a/app/client/start-https.sh b/app/client/start-https.sh index 025f5afd02..692ea718c1 100755 --- a/app/client/start-https.sh +++ b/app/client/start-https.sh @@ -7,12 +7,12 @@ # 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 + 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" + echo "Could not find envsubst: If you're on a mac; brew install gettext" exit fi @@ -23,11 +23,11 @@ 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 + the key and certificate files by running the following command cd docker && mkcert -install && mkcert \"*.appsmith.com\" && cd .. - + " exit fi @@ -63,7 +63,7 @@ client_proxy_pass="${default_client_proxy}" network_mode="bridge" case "${uname_out}" in Linux*) machine=Linux - + source ../util/is_wsl.sh if [ $IS_WSL ]; then : # ignore to continue using host.docker.internal @@ -75,28 +75,36 @@ case "${uname_out}" in server_proxy_pass=$default_linux_server_proxy fi fi - echo " + echo " Starting nginx for Linux... - " - cat ./docker/templates/nginx-app.conf.template | sed -e "s|__APPSMITH_CLIENT_PROXY_PASS__|${client_proxy_pass}|g" | sed -e "s|__APPSMITH_SERVER_PROXY_PASS__|${server_proxy_pass}|g" | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx.conf && - cat ./docker/templates/nginx-root.conf.template | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx-root.conf && - sudo docker run --network ${network_mode} --name wildcard-nginx -d -p 80:80 -p 443:443 -v `pwd`/docker/nginx-root.conf:/etc/nginx/nginx.conf -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 " + " + cat ./docker/templates/nginx-app.conf.template | sed -e "s|__APPSMITH_CLIENT_PROXY_PASS__|${client_proxy_pass}|g" | sed -e "s|__APPSMITH_SERVER_PROXY_PASS__|${server_proxy_pass}|g" | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx.conf && + cat ./docker/templates/nginx-root.conf.template | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx-root.conf && + sudo docker run --network ${network_mode} --name wildcard-nginx -d -p 80:80 -p 443:443 -v `pwd`/docker/nginx-root.conf:/etc/nginx/nginx.conf -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 " + # workaround for apple silicon until host.docker.interal works as expected + if [[ "$(uname -m)" = "arm64" ]]; then + # if no server was passed + if [[ -z $1 ]]; then + server_proxy_pass='http://"$(ipconfig getifaddr en0)":8080' + fi + client_proxy_pass='http://"$(ipconfig getifaddr en0)":3000' + fi + echo " Starting nginx for MacOS... - " - cat ./docker/templates/nginx-app.conf.template | sed -e "s|__APPSMITH_CLIENT_PROXY_PASS__|${client_proxy_pass}|g" | sed -e "s|__APPSMITH_SERVER_PROXY_PASS__|${server_proxy_pass}|g" | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx.conf && - cat ./docker/templates/nginx-root.conf.template | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx-root.conf && - docker run --name wildcard-nginx -d -p 80:80 -p 443:443 -v `pwd`/docker/nginx-root.conf:/etc/nginx/nginx.conf -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 " + " + cat ./docker/templates/nginx-app.conf.template | sed -e "s|__APPSMITH_CLIENT_PROXY_PASS__|${client_proxy_pass}|g" | sed -e "s|__APPSMITH_SERVER_PROXY_PASS__|${server_proxy_pass}|g" | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx.conf && + cat ./docker/templates/nginx-root.conf.template | envsubst ${vars_to_substitute} | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' > ./docker/nginx-root.conf && + docker run --name wildcard-nginx -d -p 80:80 -p 443:443 -v `pwd`/docker/nginx-root.conf:/etc/nginx/nginx.conf -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 diff --git a/contributions/ClientSetup.md b/contributions/ClientSetup.md index 962822e606..08b13f654a 100644 --- a/contributions/ClientSetup.md +++ b/contributions/ClientSetup.md @@ -70,6 +70,7 @@ On your development machine, please ensure that: - By default your client app points to the local api server - `http://host.docker.internal:8080` for MacOS or `http://localhost:8080` for Linux. Your page will load with errors if you don't have the api server running on your local system. To setup the api server on your local system please follow the instructions [here](https://github.com/appsmithorg/appsmith/blob/release/contributions/ServerSetup.md) - In case you are unable to setup the api server on your local system, you can also [use Appsmith's staging API server](#if-you-would-like-to-hit-a-different-appsmith-server). +- In case you are using a M1 chip Macbook please run the client with `yarn start-m1`. #### If yarn start throws mismatch node version error