From 611e24db5325d35a163d0dda99b2b61675e3b16c Mon Sep 17 00:00:00 2001 From: Tochukwu Nkemdilim Date: Thu, 31 Dec 2020 11:22:00 +0100 Subject: [PATCH] Chore(CD): Deploy To Heroku --- Procfile | 1 + README.md | 8 ++++---- package.json | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..4726e9a --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: node dist/server.js diff --git a/README.md b/README.md index c921837..8e3ffd0 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ A dead-simple service that screenshots webpages, and sends the links to your ema ## Design Goals - **Security:** All webpages are opened both in _sandboxed chromium_ and _icognito mode_. -- **Scalability:** Handles ~2.3k reqs/s on a single node. For load performance, see [load-testing](#load-testing). +- **Scalability:** Handles ~2.3k reqs/s on a single node. For load performance, see [load testing](#load-testing). - **Resilience:** Chromium instance automatically restarts on sudden crash without interrupting the job queue. Jobs that get affected are auto-retried. - **Reduced memory footprints:** Puppeteer is used under the hood to capture screeshots. To reduce memory footprint, **only one** Chromium instance exists throughout the service lifetime irrespective of the number of screenshot workers that are running. - **Portability:** Docker build (with `docker-compose`) supported and can easily be scaled in any containerized environment. @@ -27,8 +27,8 @@ You'll need to ensure you have the following installed: ### Environment Variables -- Clone the repo -- Create a `.env` from [`.env.example`](./.env.example) +- Clone the repo. +- Create a `.env` from [`.env.example`](./.env.example). - Get your [Cloudinary](https://cloudinary.com) API keys, and update env variables with prefix `CLOUDINARY_` respectively. - Get a sample SMTP credentials at [Ethereal](https://ethereal.email), and update env variables with prefix `MAIL_SMTP_` respectively. - Set `MAIL_DEFAULT` to `smtp`. @@ -46,7 +46,7 @@ To serve the application on the default port `3000`, simply run: docker-compose up --build ``` -This should serve application on the following URL: `https://localhost:3000` +This should serve application on the following URL: `http://127.0.0.1:3000` #### Development diff --git a/package.json b/package.json index aa13ecc..551a0db 100644 --- a/package.json +++ b/package.json @@ -11,14 +11,14 @@ "scripts": { "lint": "eslint \"**/*.{js,ts}\" --quiet --fix", "build": "tsc && npm run lint", - "serve": "node dist/server.js", - "start": "npm run build && npm run serve", + "postinstall": "npm run build", + "start": "node dist/server.js", "watch": "tsc -w", "start:nodemon": "npm run build && npm run watch:nodemon", "watch:nodemon": "nodemon dist/server.js", "watch:test": "npm run test -- --watchAll", - "test": "jest --forceExit --coverage --verbose --detectOpenHandles", "start:concurrent": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold\" \"npm run watch\" \"PUPPETEER_PRODUCT=chrome npm run watch:nodemon\"", + "test": "jest --forceExit --coverage --verbose --detectOpenHandles", "load-test": "k6 run --vus 1000 --iterations 10000 ./test/load-testing/index.ts", "coverage": "npm run test && cat ./coverage/lcov.info | coveralls" },