From 6fae5e8efa98aba7f0e894355f759811d1a49775 Mon Sep 17 00:00:00 2001 From: Alan Friedman Date: Sun, 12 May 2019 13:14:10 -0400 Subject: [PATCH] Add Deploy to Heroku button (#63) * Add package.json and app.json * Add yarn engine * Remove extra build command * Force install dev deps * Add deploy button and update readme --- app.json | 47 +++++++++++++++++++++++++++++++++++++++++++++++ build.sh | 17 +++++++++++++++++ package.json | 23 +++++++++++++++++++++++ readme.md | 21 +++++++++++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 app.json create mode 100755 build.sh create mode 100644 package.json diff --git a/app.json b/app.json new file mode 100644 index 0000000..6a63e32 --- /dev/null +++ b/app.json @@ -0,0 +1,47 @@ +{ + "name": "Darkwire", + "description": "End-to-end encrypted web chat", + "keywords": [ + "cryptography", + "chat", + "privacy" + ], + "website": "https://darkwire.io", + "repository": "https://github.com/darkwire/darkwire.io", + "env": { + "MAILGUN_API_KEY": { + "description": "Mailgun API Key (only required for abuse reporting)", + "required": false + }, + "ABUSE_TO_EMAIL_ADDRESS": { + "description": "Where to send abuse reports (only required for abuse reporting)", + "required": false + }, + "MAILGUN_DOMAIN": { + "description": "Mailgun domain (only required for abuse reporting)", + "required": false + }, + "ABUSE_FROM_EMAIL_ADDRESS": { + "description": "From address on abuse emails (only required for abuse reporting)", + "required": false + }, + "API_HOST": { + "description": "Example: 'api.your-darkwire-api.com'", + "required": false + }, + "API_PROTOCOL": { + "description": "Example: 'https'", + "required": false, + "value": "https" + }, + "API_PORT": { + "description": "Example: 443", + "required": false, + "value": "443" + } + }, + "image": "heroku/nodejs", + "addons": [ + "heroku-redis" + ] +} \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..2031f55 --- /dev/null +++ b/build.sh @@ -0,0 +1,17 @@ +echo "building client..." +rm -rf client +git clone https://github.com/darkwire/darkwire-client.git client +cd client +yarn --production=false +REACT_APP_API_HOST=$API_HOST \ +REACT_APP_API_PROTOCOL=$API_PROTOCOL \ +REACT_APP_API_PORT=$API_PORT \ +yarn react-scripts build +cd ../ + +echo "building server..." +rm -rf server +git clone https://github.com/darkwire/darkwire-server.git server +cd server +yarn --production=false +yarn build \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..3f276d5 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "darkwire.io", + "version": "2.0.0", + "description": "encrypted web chat", + "main": "index.js", + "repository": "https://github.com/darkwire/darkwire.io.git", + "engines": { + "yarn": "1.x" + }, + "contributors": [ + { + "name": "Daniel Seripap" + }, + { + "name": "Alan Friedman" + } + ], + "license": "MIT", + "scripts": { + "build": "./build.sh", + "start": "cd server && CLIENT_DIST_DIRECTORY='../client/build' yarn start" + } +} diff --git a/readme.md b/readme.md index ea3dc87..50b21ec 100644 --- a/readme.md +++ b/readme.md @@ -4,6 +4,8 @@ Simple encrypted web chat. Powered by [socket.io](http://socket.io), the [web cryptography API](https://developer.mozilla.org/en-US/docs/Web/API/Window/crypto). This project is an example of how client side encryption works and how you can integrate it as a chat service. +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) + ### Darkwire Server Darkwire server is a Node.js application that requires redis. @@ -35,6 +37,25 @@ environment: - API_PORT=3000 ``` +### Production + +#### Build + +This command will pull server and client repos down and create production builds of each. + +``` +$ yarn +$ yarn build +``` + +#### Start server + +This will start a production server. + +``` +$ yarn start +``` + ### Contributing to Darkwire Run `setup-dev.sh` to automatically clone server/client files and install dependencies, or clone the client and server repositories.