├── LICENSE ├── README.md ├── accelerator.env ├── datasources-prometheus.yml ├── docker-compose.yml └── prometheus.yml /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 KOGA Mitsuhiro 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-unity-accelerator 2 | Docker images for Unity Accelerator with Prometheus and Grafana 3 | 4 | ## Environment variables 5 | 6 | `accelerator.env` example 7 | 8 | ``` 9 | COLLAB_REGISTRATION_TOKEN=ft0bJvbRD 10 | DISABLE_USAGE_STATS=yes 11 | ``` 12 | 13 | | Variable | Usage | 14 | |---|---| 15 | | COLLAB_REGISTRATION_TOKEN | Accelerate [Unity Collaborate](https://unity3d.com/unity/features/collaborate) | 16 | | DISABLE_USAGE_STATS | Set to true to disable usage stats – leaving usage stats enabled can help improve the Accelerator’s features and performance by giving Unity valuable feedback. | 17 | | USER | The user name for the local, built-in dashboard. | 18 | | PASSWORD | The password for the local, built-in dashboard. | 19 | | CERT_HOSTNAME | The hostname to use for TLS support. This is used for redirects, etc. and goes along with CERT_PEM and KEY_PEM below. | 20 | | CERT_PEM | The path to a cert.pem to use for TLS support. If you set CERT_HOSTNAME but do not set CERT_PEM, /cert.pem will be assumed. | 21 | | KEY_PEM | The path to a key.pem to use for TLS support. If you set CERT_HOSTNAME but do not set KEY_PEM, /key.pem will be assumed. | 22 | 23 | 24 | | variable | usage | 25 | |----|----| 26 | | UNITY_ACCELERATOR_PERSIST | Container default is /agent. This is the directory where unity-accelerator.cfg resides as well as other persisted data (cachedir possibly being different). | 27 | | UNITY_ACCELERATOR_LOG_STDOUT | Container default is true. This, if true, will output logs to stdout only; false if you want actual log files written within the persist directory. | 28 | 29 | see also 30 | - https://hub.docker.com/r/unitytechnologies/accelerator 31 | - https://docs.unity3d.com/Manual/UnityAccelerator.html#docker 32 | 33 | ## Usage 34 | 35 | ``` 36 | # Pull images 37 | docker-compose pull 38 | 39 | # Run services 40 | docker-compose up -d 41 | ``` 42 | 43 | - Metrics reports: http://localhost:8080/metrics 44 | - Health page: http://localhost:8080/api/health-agent 45 | 46 | ## Additional Services 47 | 48 | - Grafana: http://localhost:3000/ 49 | - default admin user is admin/admin 50 | - Prometheus: http://localhost:9090/ 51 | -------------------------------------------------------------------------------- /accelerator.env: -------------------------------------------------------------------------------- 1 | # COLLAB_REGISTRATION_TOKEN=ft0bJvbRD 2 | # DISABLE_USAGE_STATS=yes 3 | -------------------------------------------------------------------------------- /datasources-prometheus.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | deleteDatasources: 4 | - name: Unity Accelerator 5 | orgId: 1 6 | 7 | datasources: 8 | - name: Unity Accelerator 9 | type: prometheus 10 | access: proxy 11 | url: http://prometheus:9090 12 | orgId: 1 13 | isDefault: true 14 | version: 1 15 | editable: false 16 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | volumes: 4 | accelerator-volume: 5 | driver: 'local' 6 | prometheus-volume: 7 | driver: 'local' 8 | grafana-volume: 9 | driver: 'local' 10 | 11 | services: 12 | accelerator: 13 | image: unitytechnologies/accelerator 14 | volumes: 15 | - accelerator-volume:/agent 16 | env_file: 17 | - ./accelerator.env 18 | ports: 19 | - "10080:10080" 20 | - "8080:80" 21 | - "443:443" 22 | healthcheck: 23 | test: /bin/bash -c "echo > /dev/tcp/127.0.0.1/80" || exit 1 24 | prometheus: 25 | image: prom/prometheus 26 | volumes: 27 | - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro 28 | - prometheus-volume:/prometheus 29 | ports: 30 | - "9090:9090" 31 | depends_on: 32 | accelerator: 33 | condition: service_healthy 34 | healthcheck: 35 | test: > 36 | netstat -t -n -l 37 | | awk '$$1 ~ /^tcp6?$$/ && $$4 ~ /:9090$$/{rc=1}END{exit !rc}' 38 | grafana: 39 | image: grafana/grafana 40 | volumes: 41 | - ./datasources-prometheus.yml:/etc/grafana/provisioning/datasources/datasources-prometheus.yml:ro 42 | - grafana-volume:/var/lib/grafana 43 | ports: 44 | - "3000:3000" 45 | depends_on: 46 | prometheus: 47 | condition: service_healthy 48 | healthcheck: 49 | test: /bin/bash -c "echo > /dev/tcp/127.0.0.1/3000" || exit 1 50 | -------------------------------------------------------------------------------- /prometheus.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 5s 3 | 4 | scrape_configs: 5 | - job_name: 'unity-accelerator' 6 | static_configs: 7 | - targets: 8 | - accelerator:80 9 | --------------------------------------------------------------------------------