文章目录
- docker create shy-net
-
- docker run --name pgsql --net shy-net -p 5432:5432 -e POSTGRES_PASSWORD=pgsql -d postgres:latest
- 登录数据库 docker exec -it pgsql bash su - postgres -c psql 配置用户 postgres=# CREATE USER shynet WITH PASSWORD 'password'; CREATE ROLE postgres=# CREATE DATABASE shynetdb OWNER shynet; CREATE DATABASE postgres=# GRANT ALL PRIVILEGES ON DATABASE shynetdb to shynet; GRANT postgres=# exit
- 查看pgsql网络 docker inspect pgsql | grep IP 配置文件shynet.env # This file shows all of the environment variables you can # set to configure Shynet, as well as information about their # effects. Make a copy of this file to configure your deployment. # Database settings (PostgreSQL) DB_NAME=shynetdb DB_USER=shynet DB_PASSWORD=password DB_HOST=172.19.0.2 DB_PORT=5432 # Database settings (SQLite) - comment PostgreSQL settings # SQLITE=True # DB_NAME=/var/local/shynet/db # Email settings (optional) EMAIL_HOST_USER=example EMAIL_HOST_PASSWORD=example_password EMAIL_HOST=smtp.example.com EMAIL_PORT=465 EMAIL_USE_SSL=True # Comment out EMAIL_USE_SSL & uncomment EMAIL_USE_TLS if your SMTP server uses TLS. # EMAIL_USE_TLS=True SERVER_EMAIL=Shynet <[email protected]> # General Django settings DJANGO_SECRET_KEY=random_string # For better security, set this to your deployment's domain. Comma separated. ALLOWED_HOSTS=* # Set to True (capitalized) if you want people to be able to sign up for your Shynet instance (not recommended) ACCOUNT_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. # This must match a value from the IANA's tz database. # Wikipedia has a list of valid strings: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones TIME_ZONE=America/New_York # Set to "False" if you will not be serving content over HTTPS SCRIPT_USE_HTTPS=True # How frequently should the monitoring script "phone home" (in ms)? SCRIPT_HEARTBEAT_FREQUENCY=5000 # How much time can elapse between requests from the same user before a new # session is created, in seconds? SESSION_MEMORY_TIMEOUT=1800 # Should only superusers (admins) be able to create services? This is helpful # when you'd like to invite others to your Shynet instance but don't want # them to be able to create services of their own. ONLY_SUPERUSERS_CREATE=True # 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. PERFORM_CHECKS_AND_SETUP=True # The port that Shynet should bind to. Don't set this if you're deploying on Heroku. PORT=8080 # Set to "False" if you do not want the version to be displayed on the frontend. SHOW_SHYNET_VERSION=True # Redis, queue, and parellization settings; not necessary for single-instance deployments. # Don't uncomment these unless you know what you are doing! # NUM_WORKERS=1 # Make sure you set a REDIS_CACHE_LOCATION if you have more than one frontend worker/instance. # REDIS_CACHE_LOCATION=redis://redis.default.svc.cluster.local/0 # If CELERY_BROKER_URL is set, make sure CELERY_TASK_ALWAYS_EAGER is False and # that you have a separate queue consumer running somewhere via `celeryworker.sh`. # CELERY_TASK_ALWAYS_EAGER=False # CELERY_BROKER_URL=redis://redis.default.svc.cluster.local/1 # Should Shynet show third-party icons in the dashboard? SHOW_THIRD_PARTY_ICONS=True # Should Shynet block collection of IP addresses globally? BLOCK_ALL_IPS=False # Should Shynet include the date and site ID when hashing users? # This will prevent any possibility of cross-site tracking provided # that IP collection is also disabled, and external keys (primary # keys) aren't supplied. It will also prevent sessions from spanning # one day to another. AGGRESSIVE_HASH_SALTING=True # Custom location url to link to in frontend. # $LATITUDE will get replaced by the latitude, $LONGITUDE will get # replaced by the longitude. # Examples: # - https://www.openstreetmap.org/?mlat=$LATITUDE&mlon=$LONGITUDE (default) # - https://www.google.com/maps/search/?api=1&query=$LATITUDE,$LONGITUDE # - https://www.mapquest.com/near-$LATITUDE,$LONGITUDE LOCATION_URL=https://www.openstreetmap.org/?mlat=$LATITUDE&mlon=$LONGITUDE # How many services should be displayed on dashboard page? # Set to big number if you don't want pagination at all. DASHBOARD_PAGE_SIZE=5 # Should background bars be scaled to full width? USE_RELATIVE_MAX_IN_BAR_VISUALIZATION=True 启动 docker run --name shynet -it -d -p 8003:8080 --net shy-net --env-file=/home/emperinter/shynet.env milesmcc/shynet:latest 进入容器创建管理员 emperinter@win:/home/emperinter$ docker exec -it shynet bash bash-5.1$ python manage.py registeradmin [email protected] Successfully created a Shynet superuser Email address: [email protected] Password: 0NIrXIozvPIv

无聊搜到了Shynet这个统计工具,就尝试搭建了一下。最初是以为和嵌入到Django中的,后续发现是一个单独的统计工具,类似Matomo。
docker create shy-net
docker create shy-net
docker run --name pgsql --net shy-net -p 5432:5432 -e POSTGRES_PASSWORD=pgsql -d postgres:latest
docker run --name pgsql --net shy-net -p 5432:5432 -e POSTGRES_PASSWORD=pgsql -d postgres:latest
- 登录数据库
docker exec -it pgsql bash
su - postgres -c psql
- 配置用户
postgres=# CREATE USER shynet WITH PASSWORD 'password';
CREATE ROLE
postgres=# CREATE DATABASE shynetdb OWNER shynet;
CREATE DATABASE
postgres=# GRANT ALL PRIVILEGES ON DATABASE shynetdb to shynet;
GRANT
postgres=# exit
docker exec -it pgsql bash
su - postgres -c psql
postgres=# CREATE USER shynet WITH PASSWORD 'password';
CREATE ROLE
postgres=# CREATE DATABASE shynetdb OWNER shynet;
CREATE DATABASE
postgres=# GRANT ALL PRIVILEGES ON DATABASE shynetdb to shynet;
GRANT
postgres=# exit
- 查看pgsql网络
docker inspect pgsql | grep IP
- 配置文件
shynet.env
# This file shows all of the environment variables you can
# set to configure Shynet, as well as information about their
# effects. Make a copy of this file to configure your deployment.
# Database settings (PostgreSQL)
DB_NAME=shynetdb
DB_USER=shynet
DB_PASSWORD=password
DB_HOST=172.19.0.2
DB_PORT=5432
# Database settings (SQLite) - comment PostgreSQL settings
# SQLITE=True
# DB_NAME=/var/local/shynet/db
# Email settings (optional)
EMAIL_HOST_USER=example
EMAIL_HOST_PASSWORD=example_password
EMAIL_HOST=smtp.example.com
EMAIL_PORT=465
EMAIL_USE_SSL=True
# Comment out EMAIL_USE_SSL & uncomment EMAIL_USE_TLS if your SMTP server uses TLS.
# EMAIL_USE_TLS=True
SERVER_EMAIL=Shynet <[email protected]>
# General Django settings
DJANGO_SECRET_KEY=random_string
# For better security, set this to your deployment's domain. Comma separated.
ALLOWED_HOSTS=*
# Set to True (capitalized) if you want people to be able to sign up for your Shynet instance (not recommended)
ACCOUNT_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.
# This must match a value from the IANA's tz database.
# Wikipedia has a list of valid strings: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TIME_ZONE=America/New_York
# Set to "False" if you will not be serving content over HTTPS
SCRIPT_USE_HTTPS=True
# How frequently should the monitoring script "phone home" (in ms)?
SCRIPT_HEARTBEAT_FREQUENCY=5000
# How much time can elapse between requests from the same user before a new
# session is created, in seconds?
SESSION_MEMORY_TIMEOUT=1800
# Should only superusers (admins) be able to create services? This is helpful
# when you'd like to invite others to your Shynet instance but don't want
# them to be able to create services of their own.
ONLY_SUPERUSERS_CREATE=True
# 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.
PERFORM_CHECKS_AND_SETUP=True
# The port that Shynet should bind to. Don't set this if you're deploying on Heroku.
PORT=8080
# Set to "False" if you do not want the version to be displayed on the frontend.
SHOW_SHYNET_VERSION=True
# Redis, queue, and parellization settings; not necessary for single-instance deployments.
# Don't uncomment these unless you know what you are doing!
# NUM_WORKERS=1
# Make sure you set a REDIS_CACHE_LOCATION if you have more than one frontend worker/instance.
# REDIS_CACHE_LOCATION=redis://redis.default.svc.cluster.local/0
# If CELERY_BROKER_URL is set, make sure CELERY_TASK_ALWAYS_EAGER is False and
# that you have a separate queue consumer running somewhere via `celeryworker.sh`.
# CELERY_TASK_ALWAYS_EAGER=False
# CELERY_BROKER_URL=redis://redis.default.svc.cluster.local/1
# Should Shynet show third-party icons in the dashboard?
SHOW_THIRD_PARTY_ICONS=True
# Should Shynet block collection of IP addresses globally?
BLOCK_ALL_IPS=False
# Should Shynet include the date and site ID when hashing users?
# This will prevent any possibility of cross-site tracking provided
# that IP collection is also disabled, and external keys (primary
# keys) aren't supplied. It will also prevent sessions from spanning
# one day to another.
AGGRESSIVE_HASH_SALTING=True
# Custom location url to link to in frontend.
# $LATITUDE will get replaced by the latitude, $LONGITUDE will get
# replaced by the longitude.
# Examples:
# - https://www.openstreetmap.org/?mlat=$LATITUDE&mlon=$LONGITUDE (default)
# - https://www.google.com/maps/search/?api=1&query=$LATITUDE,$LONGITUDE
# - https://www.mapquest.com/near-$LATITUDE,$LONGITUDE
LOCATION_URL=https://www.openstreetmap.org/?mlat=$LATITUDE&mlon=$LONGITUDE
# How many services should be displayed on dashboard page?
# Set to big number if you don't want pagination at all.
DASHBOARD_PAGE_SIZE=5
# Should background bars be scaled to full width?
USE_RELATIVE_MAX_IN_BAR_VISUALIZATION=True
- 启动
docker run --name shynet -it -d -p 8003:8080 --net shy-net --env-file=/home/emperinter/shynet.env milesmcc/shynet:latest
- 进入容器创建管理员
emperinter@win:/home/emperinter$ docker exec -it shynet bash
bash-5.1$ python manage.py registeradmin [email protected]
Successfully created a Shynet superuser
Email address: [email protected]
Password: 0NIrXIozvPIv
docker inspect pgsql | grep IP
shynet.env# This file shows all of the environment variables you can
# set to configure Shynet, as well as information about their
# effects. Make a copy of this file to configure your deployment.
# Database settings (PostgreSQL)
DB_NAME=shynetdb
DB_USER=shynet
DB_PASSWORD=password
DB_HOST=172.19.0.2
DB_PORT=5432
# Database settings (SQLite) - comment PostgreSQL settings
# SQLITE=True
# DB_NAME=/var/local/shynet/db
# Email settings (optional)
EMAIL_HOST_USER=example
EMAIL_HOST_PASSWORD=example_password
EMAIL_HOST=smtp.example.com
EMAIL_PORT=465
EMAIL_USE_SSL=True
# Comment out EMAIL_USE_SSL & uncomment EMAIL_USE_TLS if your SMTP server uses TLS.
# EMAIL_USE_TLS=True
SERVER_EMAIL=Shynet <[email protected]>
# General Django settings
DJANGO_SECRET_KEY=random_string
# For better security, set this to your deployment's domain. Comma separated.
ALLOWED_HOSTS=*
# Set to True (capitalized) if you want people to be able to sign up for your Shynet instance (not recommended)
ACCOUNT_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.
# This must match a value from the IANA's tz database.
# Wikipedia has a list of valid strings: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TIME_ZONE=America/New_York
# Set to "False" if you will not be serving content over HTTPS
SCRIPT_USE_HTTPS=True
# How frequently should the monitoring script "phone home" (in ms)?
SCRIPT_HEARTBEAT_FREQUENCY=5000
# How much time can elapse between requests from the same user before a new
# session is created, in seconds?
SESSION_MEMORY_TIMEOUT=1800
# Should only superusers (admins) be able to create services? This is helpful
# when you'd like to invite others to your Shynet instance but don't want
# them to be able to create services of their own.
ONLY_SUPERUSERS_CREATE=True
# 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.
PERFORM_CHECKS_AND_SETUP=True
# The port that Shynet should bind to. Don't set this if you're deploying on Heroku.
PORT=8080
# Set to "False" if you do not want the version to be displayed on the frontend.
SHOW_SHYNET_VERSION=True
# Redis, queue, and parellization settings; not necessary for single-instance deployments.
# Don't uncomment these unless you know what you are doing!
# NUM_WORKERS=1
# Make sure you set a REDIS_CACHE_LOCATION if you have more than one frontend worker/instance.
# REDIS_CACHE_LOCATION=redis://redis.default.svc.cluster.local/0
# If CELERY_BROKER_URL is set, make sure CELERY_TASK_ALWAYS_EAGER is False and
# that you have a separate queue consumer running somewhere via `celeryworker.sh`.
# CELERY_TASK_ALWAYS_EAGER=False
# CELERY_BROKER_URL=redis://redis.default.svc.cluster.local/1
# Should Shynet show third-party icons in the dashboard?
SHOW_THIRD_PARTY_ICONS=True
# Should Shynet block collection of IP addresses globally?
BLOCK_ALL_IPS=False
# Should Shynet include the date and site ID when hashing users?
# This will prevent any possibility of cross-site tracking provided
# that IP collection is also disabled, and external keys (primary
# keys) aren't supplied. It will also prevent sessions from spanning
# one day to another.
AGGRESSIVE_HASH_SALTING=True
# Custom location url to link to in frontend.
# $LATITUDE will get replaced by the latitude, $LONGITUDE will get
# replaced by the longitude.
# Examples:
# - https://www.openstreetmap.org/?mlat=$LATITUDE&mlon=$LONGITUDE (default)
# - https://www.google.com/maps/search/?api=1&query=$LATITUDE,$LONGITUDE
# - https://www.mapquest.com/near-$LATITUDE,$LONGITUDE
LOCATION_URL=https://www.openstreetmap.org/?mlat=$LATITUDE&mlon=$LONGITUDE
# How many services should be displayed on dashboard page?
# Set to big number if you don't want pagination at all.
DASHBOARD_PAGE_SIZE=5
# Should background bars be scaled to full width?
USE_RELATIVE_MAX_IN_BAR_VISUALIZATION=True
docker run --name shynet -it -d -p 8003:8080 --net shy-net --env-file=/home/emperinter/shynet.env milesmcc/shynet:latest
emperinter@win:/home/emperinter$ docker exec -it shynet bash
bash-5.1$ python manage.py registeradmin [email protected]
Successfully created a Shynet superuser
Email address: [email protected]
Password: 0NIrXIozvPIv
