Compare commits

...

8 Commits

Author SHA1 Message Date
R. Miles McCain
1b344fb90c Bump version 2020-05-28 22:02:50 +00:00
R. Miles McCain
d164306f8b Make email verification optional (fixes #30) 2020-05-28 22:01:22 +00:00
R. Miles McCain
c61d23caf1 Add health check endpoint (fixes #31) 2020-05-28 22:00:49 +00:00
R. Miles McCain
fcfbbe8809 Remove confusing setup variables; migrate to commands. 2020-05-28 21:47:17 +00:00
R. Miles McCain
1bb4aac32f Use $PORT env variable 2020-05-28 21:40:43 +00:00
R. Miles McCain
d895eac14d Add note about watching the repo 2020-05-24 01:47:01 +00:00
R. Miles McCain
5cce890ff6 Add localhost help to guide 2020-05-21 21:06:55 -04:00
R. Miles McCain
387c1e375d Add database connection timeout 2020-05-21 20:59:58 -04:00
12 changed files with 91 additions and 98 deletions

View File

@@ -32,4 +32,4 @@ RUN python manage.py collectstatic --noinput && \
# Launch # Launch
USER appuser USER appuser
EXPOSE 8080 EXPOSE 8080
ENTRYPOINT [ "./entrypoint.sh" ] CMD [ "./entrypoint.sh" ]

View File

@@ -13,6 +13,9 @@
--- ---
## 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
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 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.
@@ -29,29 +32,24 @@ Before continuing, please be sure to have the latest version of Docker installed
3. Configure an environment file for Shynet, using [this file](/TEMPLATE.env) as a template. (This file is typically named `.env`.) Make sure you set the database settings, or Shynet won't be able to run. 3. Configure an environment file for Shynet, using [this file](/TEMPLATE.env) as a template. (This file is typically named `.env`.) Make sure you set the database settings, or Shynet won't be able to run.
4. Launch the Shynet server by running `docker run --env-file=<your env file> milesmcc/shynet:latest`. Watch the output of the script; if it's the first run, you'll see a temporary password printed that you can use to log in. You may need to bind Docker's port 8080 (where Shynet runs) to your local port 80 (http); this can be done using the flag `-p 80:8080` after `run`. 4. Launch the Shynet server for the first time by running `docker run --env-file=<your env file> milesmcc/shynet:latest`. Provided you're using the default environment information (i.e., `PERFORM_CHECKS_AND_SETUP` is `True`), you'll see a few warnings about not having an admin user or host setup; these are normal. Don't worry — we'll do this in the next step. You only need to stop if you see a stacktrace about being unable to connect to the database.
5. Visit your service's homepage, and verify everything looks right! You should see a login prompt. Log in with the credentials from step 4. You'll probably be prompted to "confirm your email"—if you haven't set up an email server, the confirmation email will be printed to the console instead. 5. Create an admin user by running `docker run --env-file=<your env file> milesmcc/shynet:latest ./manage.py registeradmin <your email>`. A temporary password will be printed to the console.
6. Create a service by clicking "+ Create Service" in the top right hand corner. Fill out the options as appropriate. Once you're done, press "create" and you'll be redirected to your new service's analytics page. 6. Set the hostname of your Shynet instance by running `docker run --env-file=<your env file> milesmcc/shynet:latest ./manage.py hostname <your public hostname>`, where `<your public hostname>` is the _publicly accessible hostname_ of your instance, including port. This setting affects the URL that the tracking script sends its results to, so make sure it's correct. (Example hostnames: `shynet.rmrm.io` or `example.com:8000`.)
7. 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. 7. Set the whitelabel of your Shynet instance by running `docker run --env-file=<your env file> milesmcc/shynet:latest ./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"`.)
## Updating Your Configuration 8. Launch your webserver by running `docker run --env-file=<your env file> milesmcc/shynet:latest`. You may need to bind Docker's port 8080 (where Shynet runs) to your local port 80 (http); this can be done using the flag `-p 80:8080` after `run`. Visit your service's homepage, and verify everything looks right! You should see a login prompt. Log in with the credentials from step 5. You'll probably be prompted to "confirm your email"—if you haven't set up an email server, the confirmation email will be printed to the console instead.
When you first setup Shynet, you set a number of environment variables that determine first-run initialization settings (these variables start with `SHYNET_`). Once they're first set, though, changing them won't have any effect. Be sure to run the following commands in the same way that you deploy Shynet (i.e., linked to the same database). 9. Create a service by clicking "+ Create Service" in the top right hand corner. Fill out the options as appropriate. Once you're done, press "create" and you'll be redirected to your new service's analytics page.
* Create an admin account by running `docker run --env-file=<your env file> milesmcc/shynet:latest python manage.py registeradmin <your email>`. The command will print a temporary password that you'll be able to use to log in. 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.
* Configure Shynet's hostname (e.g. `shynet.example.com` or `localhost:8000`) by running `docker run --env-file=<your env file> milesmcc/shynet:latest python manage.py hostname "<your hostname>"`. This doesn't affect Shynet's bind port; instead, it determines what hostname to inject into the tracking script. (So you'll want to use the "user-facing" hostname here.)
* Name your Shynet instance by running `docker run --env-file=<your env file> milesmcc/shynet:latest python manage.py whitelabel "<your instance name>"`. This could be something like "My Shynet Server" or "Acme Analytics"—whatever suits you.
--- ---
## Enhancements ## Enhancements
### Installation with SSL ### Installation with SSL
If you are going to be running Shynet through a reverse proxy, please see [Configuring a Reverse Proxy](#configuring-a-reverse-proxy) instead. If you are going to be running Shynet through a reverse proxy, please see [Configuring a Reverse Proxy](#configuring-a-reverse-proxy) instead.
@@ -184,4 +182,8 @@ Here are solutions for some common issues. If your situation isn't described her
#### I changed the `SHYNET_WHITELABEL`/`SHYNET_HOST` environment variable, but nothing happened! #### I changed the `SHYNET_WHITELABEL`/`SHYNET_HOST` environment variable, but nothing happened!
* Those values only affect how your Shynet instance is setup on first run; once it's configured, they have no effect. See [updating your configuration](#updating-your-configuration) for help on how to update your configuration. * Those values only affect how your Shynet instance is setup on first run; once it's configured, they have no effect. See [updating your configuration](#updating-your-configuration) for help on how to update your configuration. (Note: these environment variables are not present in newer Shynet versions; they have been removed from the guide.)
#### 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.

View File

@@ -25,6 +25,7 @@ django-redis-cache = "*"
pycountry = "*" pycountry = "*"
ipaddress = "*" ipaddress = "*"
html2text = "*" html2text = "*"
django-health-check = "*"
[pipenv] [pipenv]
allow_prereleases = true allow_prereleases = true

94
Pipfile.lock generated
View File

@@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "e66668cad32f92f11324d92caa0e3e83afcb3cafe471f3ba1f178fc090dd7b6b" "sha256": "327b897f359bad486c08fc88fb70a1f9d2edaf1aadafcb1d31e5b3e144125ff7"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": {}, "requires": {},
@@ -66,18 +66,26 @@
}, },
"django": { "django": {
"hashes": [ "hashes": [
"sha256:051ba55d42daa3eeda3944a8e4df2bc96d4c62f94316dea217248a22563c3621", "sha256:db4c9b29615d17f808f2b1914d5cd73cd457c9fd90581195172c0888c210d944",
"sha256:9aaa6a09678e1b8f0d98a948c56482eac3e3dd2ddbfb8de70a868135ef3b5e01" "sha256:dd96f98ec1c3e60877d45cea7350215f16de409848d23cced8443db1b188bd9b"
], ],
"index": "pypi", "index": "pypi",
"version": "==3.0.6" "version": "==3.1a1"
}, },
"django-allauth": { "django-allauth": {
"hashes": [ "hashes": [
"sha256:7ab91485b80d231da191d5c7999ba93170ef1bf14ab6487d886598a1ad03e1d8" "sha256:f17209410b7f87da0a84639fd79d3771b596a6d3fc1a8e48ce50dabc7f441d30"
], ],
"index": "pypi", "index": "pypi",
"version": "==0.41.0" "version": "==0.42.0"
},
"django-health-check": {
"hashes": [
"sha256:0563827e003d25fd4d9ebbd7467dea5f390435628d645aaa63f8889deaded73a",
"sha256:9e6b7d93d4902901474efd4e25d31b5aaea7563b570c0260adce52cd3c3a9e36"
],
"index": "pypi",
"version": "==3.12.1"
}, },
"django-ipware": { "django-ipware": {
"hashes": [ "hashes": [
@@ -237,11 +245,11 @@
}, },
"redis": { "redis": {
"hashes": [ "hashes": [
"sha256:174101a3ce04560d716616290bb40e0a2af45d5844c8bd474c23fc5c52e7a46a", "sha256:2ef11f489003f151777c064c5dbc6653dfb9f3eade159bcadc524619fddc2242",
"sha256:7378105cd8ea20c4edc49f028581e830c01ad5f00be851def0f4bc616a83cd89" "sha256:6d65e84bc58091140081ee9d9c187aab0480097750fac44239307a3bdf0b1251"
], ],
"index": "pypi", "index": "pypi",
"version": "==3.5.0" "version": "==3.5.2"
}, },
"requests": { "requests": {
"hashes": [ "hashes": [
@@ -266,10 +274,10 @@
}, },
"six": { "six": {
"hashes": [ "hashes": [
"sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a", "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
"sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c" "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"
], ],
"version": "==1.14.0" "version": "==1.15.0"
}, },
"sqlparse": { "sqlparse": {
"hashes": [ "hashes": [
@@ -310,20 +318,20 @@
}, },
"whitenoise": { "whitenoise": {
"hashes": [ "hashes": [
"sha256:0f9137f74bd95fa54329ace88d8dc695fbe895369a632e35f7a136e003e41d73", "sha256:60154b976a13901414a25b0273a841145f77eb34a141f9ae032a0ace3e4d5b27",
"sha256:62556265ec1011bd87113fb81b7516f52688887b7a010ee899ff1fd18fd22700" "sha256:6dd26bfda3af29177d8ab7333a0c7b7642eb615ce83764f4d15a9aecda3201c4"
], ],
"index": "pypi", "index": "pypi",
"version": "==5.0.1" "version": "==5.1.0"
} }
}, },
"develop": { "develop": {
"appdirs": { "appdirs": {
"hashes": [ "hashes": [
"sha256:9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92", "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41",
"sha256:d8b24664561d0d34ddfaec54636d502d7cea6e29c3eaf68f3df6180863e2166e" "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"
], ],
"version": "==1.4.3" "version": "==1.4.4"
}, },
"attrs": { "attrs": {
"hashes": [ "hashes": [
@@ -356,36 +364,36 @@
}, },
"regex": { "regex": {
"hashes": [ "hashes": [
"sha256:021a0ae4d2baeeb60a3014805a2096cb329bd6d9f30669b7ad0da51a9cb73349", "sha256:1386e75c9d1574f6aa2e4eb5355374c8e55f9aac97e224a8a5a6abded0f9c927",
"sha256:04d6e948ef34d3eac133bedc0098364a9e635a7914f050edb61272d2ddae3608", "sha256:27ff7325b297fb6e5ebb70d10437592433601c423f5acf86e5bc1ee2919b9561",
"sha256:099568b372bda492be09c4f291b398475587d49937c659824f891182df728cdf", "sha256:329ba35d711e3428db6b45a53b1b13a0a8ba07cbbcf10bbed291a7da45f106c3",
"sha256:0ff50843535593ee93acab662663cb2f52af8e31c3f525f630f1dc6156247938", "sha256:3a9394197664e35566242686d84dfd264c07b20f93514e2e09d3c2b3ffdf78fe",
"sha256:1b17bf37c2aefc4cac8436971fe6ee52542ae4225cfc7762017f7e97a63ca998", "sha256:51f17abbe973c7673a61863516bdc9c0ef467407a940f39501e786a07406699c",
"sha256:1e2255ae938a36e9bd7db3b93618796d90c07e5f64dd6a6750c55f51f8b76918", "sha256:579ea215c81d18da550b62ff97ee187b99f1b135fd894a13451e00986a080cad",
"sha256:2bc6a17a7fa8afd33c02d51b6f417fc271538990297167f68a98cae1c9e5c945", "sha256:70c14743320a68c5dac7fc5a0f685be63bc2024b062fe2aaccc4acc3d01b14a1",
"sha256:3ab5e41c4ed7cd4fa426c50add2892eb0f04ae4e73162155cd668257d02259dd", "sha256:7e61be8a2900897803c293247ef87366d5df86bf701083b6c43119c7c6c99108",
"sha256:3b059e2476b327b9794c792c855aa05531a3f3044737e455d283c7539bd7534d", "sha256:8044d1c085d49673aadb3d7dc20ef5cb5b030c7a4fa253a593dda2eab3059929",
"sha256:4df91094ced6f53e71f695c909d9bad1cca8761d96fd9f23db12245b5521136e", "sha256:89d76ce33d3266173f5be80bd4efcbd5196cafc34100fdab814f9b228dee0fa4",
"sha256:5493a02c1882d2acaaf17be81a3b65408ff541c922bfd002535c5f148aa29f74", "sha256:99568f00f7bf820c620f01721485cad230f3fb28f57d8fbf4a7967ec2e446994",
"sha256:5b741ecc3ad3e463d2ba32dce512b412c319993c1bb3d999be49e6092a769fb2", "sha256:a7c37f048ec3920783abab99f8f4036561a174f1314302ccfa4e9ad31cb00eb4",
"sha256:652ab4836cd5531d64a34403c00ada4077bb91112e8bcdae933e2eae232cf4a8", "sha256:c2062c7d470751b648f1cacc3f54460aebfc261285f14bc6da49c6943bd48bdd",
"sha256:669a8d46764a09f198f2e91fc0d5acdac8e6b620376757a04682846ae28879c4", "sha256:c9bce6e006fbe771a02bda468ec40ffccbf954803b470a0345ad39c603402577",
"sha256:73a10404867b835f1b8a64253e4621908f0d71150eb4e97ab2e7e441b53e9451", "sha256:ce367d21f33e23a84fb83a641b3834dd7dd8e9318ad8ff677fbfae5915a239f7",
"sha256:7ce4a213a96d6c25eeae2f7d60d4dad89ac2b8134ec3e69db9bc522e2c0f9388", "sha256:ce450ffbfec93821ab1fea94779a8440e10cf63819be6e176eb1973a6017aff5",
"sha256:8127ca2bf9539d6a64d03686fd9e789e8c194fc19af49b69b081f8c7e6ecb1bc", "sha256:ce5cc53aa9fbbf6712e92c7cf268274eaff30f6bd12a0754e8133d85a8fb0f5f",
"sha256:b5b5b2e95f761a88d4c93691716ce01dc55f288a153face1654f868a8034f494", "sha256:d466967ac8e45244b9dfe302bbe5e3337f8dc4dec8d7d10f5e950d83b140d33a",
"sha256:b7c9f65524ff06bf70c945cd8d8d1fd90853e27ccf86026af2afb4d9a63d06b1", "sha256:d881c2e657c51d89f02ae4c21d9adbef76b8325fe4d5cf0e9ad62f850f3a98fd",
"sha256:f7f2f4226db6acd1da228adf433c5c3792858474e49d80668ea82ac87cf74a03", "sha256:e565569fc28e3ba3e475ec344d87ed3cd8ba2d575335359749298a0899fe122e",
"sha256:fa09da4af4e5b15c0e8b4986a083f3fd159302ea115a6cc0649cd163435538b8" "sha256:ea55b80eb0d1c3f1d8d784264a6764f931e172480a2f1868f2536444c5f01e01"
], ],
"version": "==2020.5.7" "version": "==2020.5.14"
}, },
"toml": { "toml": {
"hashes": [ "hashes": [
"sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c", "sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f",
"sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e" "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88"
], ],
"version": "==0.10.0" "version": "==0.10.1"
}, },
"typed-ast": { "typed-ast": {
"hashes": [ "hashes": [

View File

@@ -24,6 +24,10 @@ ALLOWED_HOSTS=*
# Set to True (capitalized) if you want people to be able to sign up for your Shynet instance (not recommended) # Set to True (capitalized) if you want people to be able to sign up for your Shynet instance (not recommended)
SIGNUPS_ENABLED=False SIGNUPS_ENABLED=False
# Should user email addresses be verified? Only set this to `required` if you've setup the email settings and allow
# public sign-ups; otherwise, it's unnecessary.
ACCOUNT_EMAIL_VERIFICATION=none
# The timezone of the admin panel. Affects how dates are displayed. # The timezone of the admin panel. Affects how dates are displayed.
TIME_ZONE=America/New_York TIME_ZONE=America/New_York
@@ -47,15 +51,8 @@ ONLY_SUPERUSERS_CREATE=True
# Will skip only if value is False. # Will skip only if value is False.
PERFORM_CHECKS_AND_SETUP=True PERFORM_CHECKS_AND_SETUP=True
# Your admin user's email. A temporary password will be printed # The port that Shynet should bind to. Don't set this if you're deploying on Heroku.
# to the console on first run. PORT=8080
SHYNET_ADMIN_EMAIL=you@example.com
# The domain on which you'll be hosting Shynet.
SHYNET_HOST=shynet.example.com
# What you'd like to call your Shynet instance.
SHYNET_WHITELABEL=My Shynet Instance
# Redis, queue, and parellization settings; not necessary for single-instance deployments. # Redis, queue, and parellization settings; not necessary for single-instance deployments.
# Don't uncomment these unless you know what you are doing! # Don't uncomment these unless you know what you are doing!

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
if [[ ! $PERFORM_CHECKS_AND_SETUP == False ]]; then if [[ ! $PERFORM_CHECKS_AND_SETUP == False ]]; then
./startup_checks.sh ./startup_checks.sh && exec ./webserver.sh
fi else
exec ./webserver.sh
./webserver.sh fi

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
"""Django's command-line utility for administrative tasks.""" """Django's command-line utility for administrative tasks."""
import os import os
import sys import sys

View File

@@ -14,7 +14,7 @@ import os
from django.contrib.messages import constants as messages from django.contrib.messages import constants as messages
# Increment on new releases # Increment on new releases
VERSION = "v0.4.1" VERSION = "v0.5.0"
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -43,6 +43,9 @@ INSTALLED_APPS = [
"django.contrib.staticfiles", "django.contrib.staticfiles",
"django.contrib.sites", "django.contrib.sites",
"django.contrib.humanize", "django.contrib.humanize",
"health_check",
"health_check.db",
"health_check.cache",
"rules.apps.AutodiscoverRulesConfig", "rules.apps.AutodiscoverRulesConfig",
"a17t", "a17t",
"core", "core",
@@ -105,6 +108,7 @@ else:
"PASSWORD": os.environ.get("DB_PASSWORD"), "PASSWORD": os.environ.get("DB_PASSWORD"),
"HOST": os.environ.get("DB_HOST"), "HOST": os.environ.get("DB_HOST"),
"PORT": os.environ.get("DB_PORT"), "PORT": os.environ.get("DB_PORT"),
"OPTIONS": {"connect_timeout": 5},
} }
} }
@@ -207,6 +211,7 @@ ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_EMAIL_SUBJECT_PREFIX = "" ACCOUNT_EMAIL_SUBJECT_PREFIX = ""
ACCOUNT_USER_DISPLAY = lambda k: k.email ACCOUNT_USER_DISPLAY = lambda k: k.email
ACCOUNT_SIGNUPS_ENABLED = os.getenv("ACCOUNT_SIGNUPS_ENABLED", "False") == "True" ACCOUNT_SIGNUPS_ENABLED = os.getenv("ACCOUNT_SIGNUPS_ENABLED", "False") == "True"
ACCOUNT_EMAIL_VERIFICATION = os.getenv("ACCOUNT_EMAIL_VERIFICATION", "none")
LOGIN_REDIRECT_URL = "/" LOGIN_REDIRECT_URL = "/"

View File

@@ -21,5 +21,6 @@ urlpatterns = [
path("accounts/", include("allauth.urls")), path("accounts/", include("allauth.urls")),
path("ingress/", include(("analytics.ingress_urls", "ingress")), name="ingress"), path("ingress/", include(("analytics.ingress_urls", "ingress")), name="ingress"),
path("dashboard/", include(("dashboard.urls", "dashboard"), namespace="dashboard")), path("dashboard/", include(("dashboard.urls", "dashboard"), namespace="dashboard")),
path("healthz/", include('health_check.urls')),
path("", include(("core.urls", "core"), namespace="core")), path("", include(("core.urls", "core"), namespace="core")),
] ]

View File

@@ -3,7 +3,7 @@
# Start Gunicorn processes # Start Gunicorn processes
echo Launching Shynet web server... echo Launching Shynet web server...
exec gunicorn shynet.wsgi:application \ exec gunicorn shynet.wsgi:application \
--bind 0.0.0.0:8080 \ --bind 0.0.0.0:${PORT:-8080} \
--workers ${NUM_WORKERS:-1} \ --workers ${NUM_WORKERS:-1} \
--timeout 100 \ --timeout 100 \
--certfile=cert.pem \ --certfile=cert.pem \

View File

@@ -13,33 +13,12 @@ if [[ ${sanity_results[0]} == True ]]; then
echo "Database is ready to go." echo "Database is ready to go."
fi fi
if [[ -n $SHYNET_ADMIN_EMAIL && ${sanity_results[1]} == True ]]; then if [[ -n $SHYNET_ADMIN_EMAIL && ${sanity_results[1]} == True ]]; then
echo "Creating an admin user..." echo "Warning: no admin user available. Consult docs for instructions."
{
temppwd=$( ./manage.py registeradmin $SHYNET_ADMIN_EMAIL ) && echo "Admin user ($SHYNET_ADMIN_EMAIL) created! Password: $temppwd"
} || {
echo "Failed to create admin, exiting" & exit 1
}
else
echo "Making no changes to admin user."
fi fi
if [[ -n $SHYNET_HOST && ${sanity_results[2]} == True ]]; then if [[ -n $SHYNET_HOST && ${sanity_results[2]} == True ]]; then
echo "Setting hostname..." echo "Warning: Shynet's hostname is not set. The script won't work correctly. Consult docs for instructions."
{
./manage.py hostname $SHYNET_HOST && echo "Hostname set to $SHYNET_HOST!"
} || {
echo "Failed setting hostname, exiting" & exit 1
}
else
echo "Making no changes to hostname."
fi fi
if [[ -n $SHYNET_WHITELABEL && ${sanity_results[3]} == True ]]; then if [[ -n $SHYNET_WHITELABEL && ${sanity_results[3]} == True ]]; then
echo "Setting whitelabel..." echo "Warning: Shynet's whitelabel is not set. Consult docs for instructions."
{
./manage.py whitelabel "$SHYNET_WHITELABEL" && echo "Whitelabel set! Whitelabel: $SHYNET_WHITELABEL"
} || {
echo "Failed to set whitelabel, exiting" & exit 1
}
else
echo "Making no changes to whitelabel."
fi fi
echo "Startup checks complete!" echo "Startup checks complete!"

View File

@@ -2,6 +2,6 @@
# Start Gunicorn processes # Start Gunicorn processes
echo Launching Shynet web server... echo Launching Shynet web server...
exec gunicorn shynet.wsgi:application \ exec gunicorn shynet.wsgi:application \
--bind 0.0.0.0:8080 \ --bind 0.0.0.0:${PORT:-8080} \
--workers ${NUM_WORKERS:-1} \ --workers ${NUM_WORKERS:-1} \
--timeout 100 --timeout 100