From b234ef291701d77b162c44b0f7dce061cc2191da Mon Sep 17 00:00:00 2001 From: Thomas Letsch Groch Date: Mon, 1 Jun 2020 18:41:39 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20heroku=20compatibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recognize heroku with the environment variable DATABASE_URL, parse it and replace the others based on it. --- GUIDE.md | 8 ++- TEMPLATE.env | 1 + app.json | 137 ++++++++++++++++++++++++++++++++++++++ heroku.yml | 3 + images/slogo.png | Bin 0 -> 2570 bytes shynet/shynet/settings.py | 26 ++++++++ 6 files changed, 173 insertions(+), 2 deletions(-) create mode 100644 app.json create mode 100644 heroku.yml create mode 100644 images/slogo.png diff --git a/GUIDE.md b/GUIDE.md index 8610191..11734a9 100644 --- a/GUIDE.md +++ b/GUIDE.md @@ -10,7 +10,7 @@ + [Cloudflare](#cloudflare) + [Nginx](#nginx) + [Troubleshooting](#troubleshooting) - ++ [Quick Deploy](#quick-deploy) --- ## Staying Updated @@ -186,4 +186,8 @@ Here are solutions for some common issues. If your situation isn't described her #### Shynet can't connect to my database running on `localhost`/`127.0.0.1` -* The problem is likely that to Shynet, `localhost` points to the local network in the container itself, not on the host machine. Try adding the `--network='host'` option when you run Docker. \ No newline at end of file +* The problem is likely that to Shynet, `localhost` points to the local network in the container itself, not on the host machine. Try adding the `--network='host'` option when you run Docker. + +## Quick Deploy + +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/thomasgroch/shynet/tree/features/heroku-quick-deploy&env[SHYNET_HOST]=shynet-demo.herokuapp.com) diff --git a/TEMPLATE.env b/TEMPLATE.env index 1aa840a..95ed11a 100644 --- a/TEMPLATE.env +++ b/TEMPLATE.env @@ -13,6 +13,7 @@ DB_PORT=5432 EMAIL_HOST_USER=example EMAIL_HOST_PASSWORD=example_password EMAIL_HOST=smtp.example.com +EMAIL_PORT=465 SERVER_EMAIL= noreply@shynet.example.com # General Django settings diff --git a/app.json b/app.json new file mode 100644 index 0000000..a76baa4 --- /dev/null +++ b/app.json @@ -0,0 +1,137 @@ +{ + "name": "Shynet", + "description":"Modern, privacy-friendly, and detailed web analytics that works without cookies or JS.", + "keywords":[ + "app.json", + "shynet", + "heroku", + "analytics", + "privacy", + "friendly" + ], + "website": "https://github.com/milesmcc/shynet", + "repository": "https://github.com/milesmcc/shynet", + "logo": "https://github.com/milesmcc/shynet/raw/master/images/slogo.png", + "success_url": "/", + "stack": "container", + "addons": [ + "heroku-postgresql:hobby-dev" + ], + "formation": { + "web": { + "quantity": 1, + "size": "free" + } + }, + "env": { + "SHYNET_HOST": { + "description": "The domain on which you'll be hosting Shynet at. (re-type the heroku app name here)", + "value": "your-app.herokuapp.com", + "required": false + }, + "DB_NAME": { + "description": "Database name (PostgreSQL)", + "value": "shynet", + "required": false + }, + "DB_USER": { + "description": "Database username", + "value": "", + "required": false + }, + "DB_PASSWORD": { + "description": "Database password", + "value": "", + "required": false + }, + "DB_HOST": { + "description": "Database hostname", + "value": "", + "required": false + }, + "DB_PORT": { + "description": "Database port", + "value": "5432", + "required": false + }, + "EMAIL_HOST": { + "description": "SMTP server hostname", + "value": "smtp.gmail.com", + "required": false + }, + "EMAIL_PORT": { + "description": "SMTP server port", + "value": "465", + "required": false + }, + "EMAIL_HOST_USER": { + "description": "SMTP server username", + "value": "@gmail.com", + "required": false + }, + "EMAIL_HOST_PASSWORD": { + "description": "SMTP server password", + "value": "", + "required": false + }, + "SERVER_EMAIL": { + "description": "Sender email address", + "value": " noreply@shynet.example.com", + "required": false + }, + "DJANGO_SECRET_KEY": { + "description": "General Django settings", + "generator": "secret" + }, + "ALLOWED_HOSTS": { + "description": "For better security, set this to your deployment's domain. Comma separated.", + "value": "*", + "required": false + }, + "SIGNUPS_ENABLED": { + "description": "Set to True (capitalized) if you want people to be able to sign up for your Shynet instance (not recommended)", + "value": "False", + "required": false + }, + "TIME_ZONE": { + "description": "The timezone of the admin panel. Affects how dates are displayed.", + "value": "America/New_York", + "required": false + }, + "SCRIPT_USE_HTTPS": { + "description": "Set to 'False' if you will not be serving content over HTTPS", + "value": "True", + "required": false + }, + "SCRIPT_HEARTBEAT_FREQUENCY": { + "description": "How frequently should the monitoring script 'phone home' (in ms)?", + "value": "5000", + "required": false + }, + "SESSION_MEMORY_TIMEOUT": { + "description": "How much time can elapse between requests from the same user before a new session is created, in seconds?", + "value": "1800", + "required": false + }, + "ONLY_SUPERUSERS_CREATE": { + "description": "when you'd like to invite others to your Shynet instance but don't want them to be able to create services of their owShould only superusers (admins) be able to create services? This is helpfuln.", + "value": "True", + "required": false + }, + "PERFORM_CHECKS_AND_SETUP": { + "description": "Whether to perform checks and setup at startup, including applying unapplied migrations. For most setups, the recommended value is True. Defaults to True. Will skip only if value is False.", + "value": "True", + "required": false + }, + "SHYNET_ADMIN_EMAIL": { + "description": "Your admin user email. A temporary password will be printed to the console on first run.", + "value": "admin@example.com", + "required": false + }, + "SHYNET_WHITELABEL": { + "description": "What you'd like to call your Shynet instance.", + "value": "shynet-analytics", + "required": false + } + } +} \ No newline at end of file diff --git a/heroku.yml b/heroku.yml new file mode 100644 index 0000000..2b8f79b --- /dev/null +++ b/heroku.yml @@ -0,0 +1,3 @@ +build: + docker: + web: Dockerfile \ No newline at end of file diff --git a/images/slogo.png b/images/slogo.png new file mode 100644 index 0000000000000000000000000000000000000000..9fb623d0e96974eccbcad99f4f79f4cc0b4f095b GIT binary patch literal 2570 zcmZ`*2|Sef8=u*+W^y%C#!X`?C7Qty2IHD>tXyS7Gvr9lIn0c_UE7eOmWV`%P*M3f zaty7}I%*?i?P4kn)2u6DI)z>BtJ>ZF`F=j{`+J_}_gvra`+lC^d(O+lSy4_y4g!HF zy1J0}folzT=OSdm=gsLSNN|C2_BlI1svm33f^tu!k0001eJ?STNyh~rW`=~}06Giw zfd@e0UPWm4p}(&$ebQNf7h-U}paSvXfnXNi7-xk4 zUqRf+BmcDbZ&B+zpTj<(`drK!q=x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