Merge branch 'MagnumDingusEdu/master' into dev
This commit is contained in:
commit
c5ed5ef0e7
39
GUIDE.md
39
GUIDE.md
@ -4,6 +4,7 @@
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Heroku](#heroku)
|
||||
- [Render](#render)
|
||||
- [Updating Your Configuration](#updating-your-configuration)
|
||||
- [Advanced Usage](#advanced-usage)
|
||||
* [Installation with SSL](#installation-with-ssl)
|
||||
@ -17,11 +18,12 @@
|
||||
---
|
||||
|
||||
## Staying Updated
|
||||
|
||||
**If you install Shynet, you should strongly consider enabling notifications when new versions are released.** You can do this under the "Watch" tab on GitHub (above). This will ensure that you are notified when new versions are available, some of which may be security updates. (Shynet will never automatically update itself.)
|
||||
|
||||
## Installation
|
||||
|
||||
Installation of Shynet is easy! Follow the [Basic Installation](#basic-installation) guide below if you'd like to run Shynet over HTTP or if you are going to be running it over HTTPS through a reverse proxy. If you'd like to run Shynet over HTTPS without a reverse proxy, skip ahead to [Installation with SSL](#installation-with-ssl) instead.
|
||||
Installation of Shynet is easy! Follow the [Basic Installation](#basic-installation) guide or the [Basic Installation with Docker Compose](#basic-installation-with-docker-compose) below for a minimal installation, or if you are going to be running Shynet over HTTPS through a reverse proxy. If you'd like to run Shynet over HTTPS without a reverse proxy, skip ahead to [Installation with SSL](#installation-with-ssl) instead.
|
||||
|
||||
> **These commands assume Ubuntu.** If you're installing Shynet on a different platform, the process will be different.
|
||||
|
||||
@ -49,6 +51,27 @@ Before continuing, please be sure to have the latest version of Docker installed
|
||||
|
||||
10. Finally, click on "Manage" in the top right of the service's page to get the tracking script code. Inject this script on all pages you'd like the service to track.
|
||||
|
||||
|
||||
### Basic Installation with Docker Compose
|
||||
|
||||
> Make sure you have `docker-compose` installed. If not, [install it](https://docs.docker.com/compose/install/)
|
||||
|
||||
1. Clone the repository.
|
||||
|
||||
2. Using [TEMPLATE.env](/TEMPLATE.env) as a template, confiure the environment for your Shynet instance and place the modified config in a file called `.env` in the root of the repository. Do _not_ change the port number at the end; you can set the public facing port in the next step.
|
||||
|
||||
3. On line 2 of the `nginx.conf` file located in the root of the repository, replace `example.com` with your hostname. Then, in the `docker-compose.yml` file, set the port number by replacing `8080` in line 38 ( `- 8080:80` ) with whatever local port you want to bind it to. For example, set the port number to `- 80:80` if you want your site will be available via HTTP (port 80) at `http://<your hostname>`.
|
||||
|
||||
4. Launch the Shynet server for the first time by running `docker-compose up -d`. If you get an error like "permission denied" or "Couldn't connect to Docker daemon", either prefix the command with `sudo` or add your user to the `docker` group.
|
||||
|
||||
5. Create an admin user by running `docker exec -it shynet_main ./manage.py registeradmin <your email>`. A temporary password will be printed to the console.
|
||||
|
||||
6. Set the hostname of your Shynet instance by running `docker exec -it shynet_main ./manage.py hostname <your public hostname>`, where `<your public hostname>` is the same as the hostname you set in step 3. This setting affects the URL that the tracking script sends its results to, so make sure it's correct. (Example hostnames: shynet.example.com or example.com:8000.)
|
||||
|
||||
7. Set the whitelabel of your Shynet instance by running `docker exec -it shynet_main ./manage.py whitelabel <whitelabel>`. While this setting doesn't affect any core operations of Shynet, it lets you rename Shynet to whatever you want. (Example whitelabels: "My Shynet Instance" or "Acme Analytics".)
|
||||
|
||||
Your site should now be accessible at `http://hostname:port`. Now you can follow steps 9-10 of the [Basic Installation](#basic-installation) guide above to get Shynet integrated on your sites.
|
||||
|
||||
## Heroku
|
||||
|
||||
You may wish to deploy Shynet on Heroku. Note that Heroku's free offerings (namely the free Postgres addon) are unlikely to support running any Shynet instance that records more than a few hundred requests per day — the database will quickly fill up. In most cases, the more cost-effective option for running Shynet is renting a VPS from a full cloud service provider. However, if you're sure Heroku is the right option for you, or you just want to try Shynet out, you can use the Quick Deploy button then follow the steps below.
|
||||
@ -61,6 +84,20 @@ Once you deploy, you'll need to setup an admin user, whitelabel, and hostname be
|
||||
2. `heroku run --app=<your app> ./manage.py hostname <the hostname where you will run Shynet>`
|
||||
3. `heroku run --app=<your app> ./manage.py whitelabel "<your Shynet instance's name>"`
|
||||
|
||||
## Render
|
||||
|
||||
[Render](https://render.com) is a modern cloud platform to build and run all your apps and websites with free SSL, a global CDN, private networks and auto deploys from Git. To deploy Shynet, click the `Deploy to Render` button and follow the steps below.
|
||||
|
||||
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/render-examples/shynet)
|
||||
|
||||
Once your deploy has completed, use the **Render Shell** to configure your app:
|
||||
|
||||
1. Set your email: `./manage.py registeradmin your-email@example.com`
|
||||
1. Add your onrender.com domain: `./manage.py hostname your-shynet-domain.onrender.com`
|
||||
1. Set your whitelabel: `./manage.py whitelabel "Your Shynet Instance Name"`
|
||||
|
||||
See the [Render docs](https://render.com/docs/deploy-shynet) for more information on deploying your application on Render.
|
||||
|
||||
---
|
||||
|
||||
## Advanced Usage
|
||||
|
@ -1,6 +1,7 @@
|
||||
version: '3'
|
||||
services:
|
||||
shynet:
|
||||
container_name: shynet_main
|
||||
image: milesmcc/shynet:latest
|
||||
restart: unless-stopped
|
||||
expose:
|
||||
@ -16,6 +17,7 @@ services:
|
||||
depends_on:
|
||||
- db
|
||||
db:
|
||||
container_name: shynet_database
|
||||
image: postgres
|
||||
restart: always
|
||||
environment:
|
||||
@ -26,6 +28,18 @@ services:
|
||||
- shynet_db:/var/lib/postgresql/data
|
||||
networks:
|
||||
- internal
|
||||
webserver:
|
||||
container_name: shynet_webserver
|
||||
image: nginx
|
||||
restart: always
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf
|
||||
ports:
|
||||
- 8080:80
|
||||
depends_on:
|
||||
- shynet
|
||||
networks:
|
||||
- internal
|
||||
volumes:
|
||||
shynet_db:
|
||||
networks:
|
||||
|
19
nginx.conf
Normal file
19
nginx.conf
Normal file
@ -0,0 +1,19 @@
|
||||
server {
|
||||
server_name example.com;
|
||||
access_log /var/log/nginx/bin.access.log;
|
||||
error_log /var/log/nginx/bin.error.log error;
|
||||
|
||||
|
||||
location / {
|
||||
proxy_pass http://shynet:8080;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Protocol $scheme;
|
||||
proxy_set_header X-Url-Scheme $scheme;
|
||||
}
|
||||
listen 80;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user