From fcc1fbf9c61c63d185750f468156c540bdddfc30 Mon Sep 17 00:00:00 2001 From: Griefed <griefed@griefed.de> Date: Tue, 10 Nov 2020 21:51:35 +0100 Subject: [PATCH] Add .github stuffs and fix readme stuffs --- .github/ISSUE_TEMPLATE/bug-report.md | 64 +++++++++++ .github/ISSUE_TEMPLATE/config.yml | 1 + .../ISSUE_TEMPLATE/documentation-request.md | 14 +++ .github/ISSUE_TEMPLATE/pull_request.md | 27 +++++ .gitlab-ci.yml | 4 +- .gitlab/.readme_variables | 22 ++-- .gitlab/readme_template | 101 ++++++++++++++++-- 7 files changed, 215 insertions(+), 18 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug-report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/documentation-request.md create mode 100644 .github/ISSUE_TEMPLATE/pull_request.md diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..3d580bd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,64 @@ +--- +name: Bug Report +about: Report a bug with the container / image +--- + +* **What is the current behavior?** + + + +* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem** + + + +* **What is the expected behavior?** + + + +* **What is the motivation / use case for changing the behavior?** + + + +* **Please tell us about your environment:** + + - Docker Image: griefed/image:tag e.g. griefed/d-zone:proxy + - docker & docker-compose Version: Use `docker version && docker-compose version` + +``` +Client: Docker Engine - Community + Version: 19.03.13 + API version: 1.40 + Go version: go1.13.15 + Git commit: 4484c46d9d + Built: Wed Sep 16 17:02:52 2020 + OS/Arch: linux/amd64 + Experimental: false + +Server: Docker Engine - Community + Engine: + Version: 19.03.13 + API version: 1.40 (minimum version 1.12) + Go version: go1.13.15 + Git commit: 4484c46d9d + Built: Wed Sep 16 17:01:20 2020 + OS/Arch: linux/amd64 + Experimental: false + containerd: + Version: 1.3.7 + GitCommit: 8fba4e9a7d01810a393d5d25a3621dc101981175 + runc: + Version: 1.0.0-rc10 + GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd + docker-init: + Version: 0.18.0 + GitCommit: fec3683 +docker-compose version 1.25.0, build unknown +docker-py version: 4.1.0 +CPython version: 3.8.5 +OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020 +``` + + - Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] + +* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc) + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/documentation-request.md b/.github/ISSUE_TEMPLATE/documentation-request.md new file mode 100644 index 0000000..66deb71 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation-request.md @@ -0,0 +1,14 @@ +--- +name: Documentation Request +about: Request for documentation about a certain aspect of the docker image / container +--- + +# Documentation Request + +<!-- Delete this line and everything below it, but read below first for information on what you should include --> +Please include the following: + + * Links to any existing documentation if it exists but is unclear. + * Information on what feature/aspect of this container needs updating / expansion. + * What you're currently trying to do with the container that has led you to require the given feature. + * Some background on what information you might like to see in the documentation. diff --git a/.github/ISSUE_TEMPLATE/pull_request.md b/.github/ISSUE_TEMPLATE/pull_request.md new file mode 100644 index 0000000..9ba36a2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/pull_request.md @@ -0,0 +1,27 @@ +--- +name: Pull Request +about: Pull request for a change / addition / fix you made to the repository. +--- + +* **Please check if the PR fulfills these requirements** +- [ ] Tests for the changes have been added (for bug fixes / features) +- [ ] Docs have been added / updated (for bug fixes / features) + + +* **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...) + + + +* **What is the current behavior?** (You can also link to an open issue here) + + + +* **What is the new behavior (if this is a feature change)?** + + + +* **Does this PR introduce a breaking change?** (What changes might users need to make in their application due to this PR?) + + + +* **Other information**: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 593adaa..5f2e83e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,7 +46,7 @@ test_port: - shell script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker build --network host --tag $CI_REGISTRY_IMAGE:arm-port -f Dockerfile.port . + - docker build --network host --tag $CI_REGISTRY_IMAGE:arm-port -f Dockerfile.port . - docker push $CI_REGISTRY_IMAGE:arm-port test_proxy: @@ -55,7 +55,7 @@ test_proxy: - shell script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker build --network host --tag $CI_REGISTRY_IMAGE:arm-proxy -f Dockerfile.proxy . + - docker build --network host --tag $CI_REGISTRY_IMAGE:arm-proxy -f Dockerfile.proxy . - docker push $CI_REGISTRY_IMAGE:arm-proxy publish_port: diff --git a/.gitlab/.readme_variables b/.gitlab/.readme_variables index 8094848..904a39e 100644 --- a/.gitlab/.readme_variables +++ b/.gitlab/.readme_variables @@ -1,10 +1,12 @@ -export GITHUB_REPONAME='docker-template-repo' -export GITHUB_USERNAME='username' -export DOCKERHUB_REPONAME='template-repo' -export DOCKERHUB_TAG='tag' -export DOCKERHUB_USERNAME='username' -export DESCRIPTION='This is an example description for the docker-template-repo. This text should be replaced with an adequate description of the repo this template was clone for. Blablablablablabla you know the drill.' -export CREATOR_USERNAME='Griefed' -export CREATOR_REPONAME='template' -export EXAMPLE_SITE_LINK='https://www.example.com' -export CONTAINER_PORT='1234' +export GITHUB_REPONAME='docker-D-Zone' +export GITHUB_USERNAME='Griefed' +export DOCKERHUB_REPONAME='d-zone' +export DOCKERHUB_TAG_ONE='port' +export DOCKERHUB_TAG_TWO='proxy' +export DOCKERHUB_USERNAME='griefed' +export DESCRIPTION='D-Zone is a graphical simulation meant to abstractly represent the activity in your Discord server. This is not meant for any actual monitoring or diagnostics, only an experiment in the abstraction of chatroom data represented via autonomous characters in a scene.' +export CREATOR_USERNAME='d-zone-org' +export CREATOR_REPONAME='d-zone' +export EXAMPLE_SITE_LINK='https://pixelatomy.com/dzone/?s=default' +export CONTAINER_PORT='3000' +export BASE_IMAGE='alpine' \ No newline at end of file diff --git a/.gitlab/readme_template b/.gitlab/readme_template index 4b74c9d..6c2e249 100644 --- a/.gitlab/readme_template +++ b/.gitlab/readme_template @@ -24,31 +24,37 @@ Using this image allows us to use the same user/group ids in the container as on ## Deployment -### Pre-built images +Tags | Description +-----|------------- +$DOCKERHUB_TAG_ONE | Use tag `$DOCKERHUB_TAG_ONE` if accessing $CREATOR_REPONAME via IP:PORT +$DOCKERHUB_TAG_TWO | Use tag `$DOCKERHUB_TAG_TWO` if accessing $CREATOR_REPONAME through a reverse proxy line NGINX + ```docker-compose.yml version: '3.6' services: $DOCKERHUB_REPONAME: container_name: $DOCKERHUB_REPONAME - image: griefed/$DOCKERHUB_REPONAME + image: $DOCKERHUB_USERNAME/$DOCKERHUB_REPONAME restart: unless-stopped volumes: - ./path/to/config:/config environment: + - TOKEN=<YOUR_BOT_TOKEN_HERE> - TZ=Europe/Berlin - PUID=1000 # User ID - PGID=1000 # Group ID ports: - - 80:$CONTAINER_PORT + - 3000:$CONTAINER_PORT - $CONTAINER_PORT2 ``` ## Raspberry Pi -To run this container on a Raspberry Pi, use the `arm`-tag. I've tested it on a Raspberry Pi 3B. +To run this container on a Raspberry Pi, use the `arm`-prefix for the `$DOCKERHUB_TAG_ONE`- and `$DOCKERHUB_TAG_TWO`-tags. I've tested the `$DOCKERHUB_TAG_ONE`-tag on a Raspberry Pi 3B. -`griefed/$DOCKERHUB_REPONAME:arm` +`$DOCKERHUB_USERNAME/$DOCKERHUB_REPONAME:$DOCKERHUB_TAG_ONE-arm` +`$DOCKERHUB_USERNAME/$DOCKERHUB_REPONAME:$DOCKERHUB_TAG_TWO-arm` ## Configuration @@ -60,7 +66,7 @@ data volume | Contains your/the containers important data. TZ | Timezone PUID | for UserID PGID | for GroupID -ports | The port where the service will be available at. +ports | The port where $DOCKERHUB_REPONAME will be available at. Only relevant when using `$DOCKERHUB_USERNAME/$DOCKERHUB_REPONAME:$DOCKERHUB_TAG_ONE` ## User / Group Identifiers @@ -75,6 +81,88 @@ In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as bel uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup) ``` +## Specify channels to ignore: +D-Zone will, by default, listen to all channels on the servers which your bot is connected to. +If you want to set ignoreChannels, you need to edit your `discord-config.json`file in the folder you specified in your `volumes:`. +Edit the "servers" block on a per server basis, e.g.: +```json + "servers": [ + { + "id": "<YOUR_SERVER_ID_HERE", + "default": true, + "ignoreChannels": ["TEXTCHANNEL_ID1","TEXTCHANNEL_ID2","TEXTCHANNEL_ID3"] + } + ] +``` +If you want to define multiple servers, see https://github.com/d-zone-org/d-zone/blob/master/discord-config-example.json + +## Running D-Zone behind a reverse proxy like NGINX + +If you want to serve d-zone with a reverse proxy like nginx and HTTPS, then this may be of help to you: + +```docker-compose.yml +version: '3.6' +services: + d-zone: + container_name: $DOCKERHUB_REPONAME + image: griefed/$DOCKERHUB_REPONAME:$DOCKERHUB_TAG_TWO + restart: unless-stopped + volumes: + - ./path/to/config/files:/config + environment: + - TOKEN=<YOUR_BOT_TOKEN_HERE> + - TZ=Europe/Berlin + - PUID=1000 #User ID + - PGID=1000 #Group ID +``` + +I use a dockerized NGINX as a reverse proxy, specifically [linuxserver/swag](https://hub.docker.com/r/linuxserver/swag). + +```nginx +server { + listen 443 ssl; + listen [::]:443 ssl; + + server_name SUBDMOAIN.*; + + include /config/nginx/ssl.conf; + + client_max_body_size 0; + + # enable for ldap auth, fill in ldap details in ldap.conf + #include /config/nginx/ldap.conf; + + # enable for Authelia + #include /config/nginx/authelia-server.conf; + + location / { + # enable the next two lines for http auth + #auth_basic "Restricted"; + #auth_basic_user_file /config/nginx/.htpasswd; + + # enable the next two lines for ldap auth + #auth_request /auth; + #error_page 401 =200 /ldaplogin; + + # enable for Authelia + #include /config/nginx/authelia-location.conf; + + include /config/nginx/proxy.conf; + resolver 127.0.0.11 valid=30s; + + proxy_set_header HOST $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_pass_request_headers on; + set $upstream_app d-zone; + set $upstream_port 3000; + set $upstream_proto http; + proxy_pass $upstream_proto://$upstream_app:$upstream_port; + } +} +``` + ### Building the image yourself Use the [Dockerfile](https://github.com/Griefed/$GITHUB_REPONAME/Dockerfile) to build the image yourself, in case you want to make any changes to it @@ -100,6 +188,7 @@ services: ``` 1. Clone the repository: `git clone https://github.com/Griefed/$GITHUB_REPONAME.git ./$GITHUB_REPONAME` +1. Rename **Dockerfile.$DOCKERHUB_TAG_ONE** to **Dockerfile**: `mv Dockerfile.$DOCKERHUB_TAG_ONE Dockerfile` 1. Prepare docker-compose.yml file as seen above 1. `docker-compose up -d --build $DOCKERHUB_REPONAME` 1. Visit IP.ADDRESS.OF.HOST:8080 -- GitLab