diff --git a/app/client/.gitignore b/app/client/.gitignore index e019741285..0716e41182 100755 --- a/app/client/.gitignore +++ b/app/client/.gitignore @@ -31,3 +31,5 @@ yarn-error.log* cypress/videos cypress/screenshots results/ + +/docker/*.pem diff --git a/app/client/craco.build.config.js b/app/client/craco.build.config.js index f8526e92ca..8a381d4bf5 100644 --- a/app/client/craco.build.config.js +++ b/app/client/craco.build.config.js @@ -2,6 +2,7 @@ const SentryWebpackPlugin = require("@sentry/webpack-plugin"); const merge = require("webpack-merge"); const common = require("./craco.common.config.js"); +const WorkboxPlugin = require("workbox-webpack-plugin"); const env = process.env.REACT_APP_ENVIRONMENT; @@ -16,6 +17,14 @@ if (env === "PRODUCTION" || env === "STAGING") { }), ); } +plugins.push( + new WorkboxPlugin.InjectManifest({ + swSrc: "./src/serviceWorker.js", + mode: "development", + swDest: "./pageService.js", + maximumFileSizeToCacheInBytes: 4 * 1024 * 1024, + }), +); module.exports = merge(common, { webpack: { diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 8cbcf917db..917d3da225 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -6,7 +6,7 @@ const modalWidgetPage = require("../locators/ModalWidget.json"); const widgetsPage = require("../locators/Widgets.json"); Cypress.Commands.add("LogintoApp", (uname, pword) => { - cy.visit("/"); + cy.visit("/user/login"); cy.get(loginPage.username).should("be.visible"); cy.get(loginPage.username).type(uname); cy.get(loginPage.password).type(pword); diff --git a/app/client/docker/nginx-linux.conf b/app/client/docker/nginx-linux.conf new file mode 100644 index 0000000000..de12174294 --- /dev/null +++ b/app/client/docker/nginx-linux.conf @@ -0,0 +1,63 @@ +server { + listen 80; + server_name dev.appsmith.com; + client_max_body_size 10m; + + gzip on; + gzip_proxied any; + proxy_ssl_server_name on; + # sub_filter_once off; + location / { + #proxy_set_header Host $host; + #proxy_set_header X-Real-IP $remote_addr; + # sub_filter ___BASE_URL___ http://$host; + proxy_pass http://localhost:3000; + } + + location /api { + # proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass https://release-api.appsmith.com; + } + + location /oauth2 { + # proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass https://release-api.appsmith.com; + } + +} + +server { + listen 443 ssl http2; + server_name dev.appsmith.com; + + ssl_certificate /etc/certificate/dev.appsmith.com.pem; + ssl_certificate_key /etc/certificate/dev.appsmith.com-key.pem; + + # include /etc/letsencrypt/options-ssl-nginx.conf; + # ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; + gzip on; + + proxy_ssl_server_name on; + # sub_filter_once off; + location / { + #proxy_set_header Host $host; + #proxy_set_header X-Real-IP $remote_addr; + # sub_filter ___BASE_URL___ http://$host; + proxy_pass http://localhost:3000; + } + + location /api { + # proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass https://release-api.appsmith.com; + } + + location /oauth2 { + # proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass https://release-api.appsmith.com; + } +} + diff --git a/app/client/docker/nginx-mac.conf b/app/client/docker/nginx-mac.conf new file mode 100644 index 0000000000..eb0c011582 --- /dev/null +++ b/app/client/docker/nginx-mac.conf @@ -0,0 +1,62 @@ +server { + listen 80; + server_name dev.appsmith.com; + client_max_body_size 10m; + + gzip on; + gzip_proxied any; + proxy_ssl_server_name on; + # sub_filter_once off; + location / { + #proxy_set_header Host $host; + #proxy_set_header X-Real-IP $remote_addr; + # sub_filter ___BASE_URL___ http://$host; + proxy_pass http://host.docker.internal:3000; + } + + location /api { + # proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass https://release-api.appsmith.com; + } + + location /oauth2 { + # proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass https://release-api.appsmith.com; + } + +} + +server { + listen 443 ssl http2; + server_name dev.appsmith.com; + + ssl_certificate /etc/certificate/dev.appsmith.com.pem; + ssl_certificate_key /etc/certificate/dev.appsmith.com-key.pem; + + # include /etc/letsencrypt/options-ssl-nginx.conf; + # ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; + gzip on; + + proxy_ssl_server_name on; + # sub_filter_once off; + location / { + #proxy_set_header Host $host; + #proxy_set_header X-Real-IP $remote_addr; + # sub_filter ___BASE_URL___ http://$host; + proxy_pass http://host.docker.internal:3000; + } + + location /api { + # proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass https://release-api.appsmith.com; + } + + location /oauth2 { + # proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass https://release-api.appsmith.com; + } +} diff --git a/app/client/docker/nginx.conf b/app/client/docker/nginx.conf deleted file mode 100644 index 57c2823ec8..0000000000 --- a/app/client/docker/nginx.conf +++ /dev/null @@ -1,46 +0,0 @@ -server { - listen 80; - server_name localhost; - gzip on; - - #charset koi8-r; - #access_log /var/log/nginx/host.access.log main; - root /var/www/appsmith; - index index.html index.htm; - - location / { - try_files $uri /index.html =404; - } - - #error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - # - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /var/www/appsmith; - } - - # proxy the PHP scripts to Apache listening on 127.0.0.1:80 - # - #location ~ \.php$ { - # proxy_pass http://127.0.0.1; - #} - - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 - # - #location ~ \.php$ { - # root html; - # fastcgi_pass 127.0.0.1:9000; - # fastcgi_index index.php; - # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; - # include fastcgi_params; - #} - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - # - #location ~ /\.ht { - # deny all; - #} -} diff --git a/app/client/package.json b/app/client/package.json index 1ad3a01618..461271a572 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -167,8 +167,9 @@ "redux-devtools-extension": "^2.13.8", "source-map-explorer": "^2.4.2", "storybook-addon-designs": "^5.1.1", - "ts-jest": "^24.3.0", - "webpack-merge": "^4.2.2" + "webpack-merge": "^4.2.2", + "workbox-webpack-plugin": "^5.1.2", + "ts-jest": "^24.3.0" }, "husky": { "hooks": { diff --git a/app/client/public/index.html b/app/client/public/index.html index c59aa1d28f..c7c693f914 100755 --- a/app/client/public/index.html +++ b/app/client/public/index.html @@ -2,18 +2,49 @@
- - +