├── .gitignore ├── Dockerfile ├── tyk_analytics.with_mongo_and_gateway.conf ├── bootstrap.sh └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | tyk_dash_compose.conf 2 | tyk_dash_local.conf 3 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:buster-slim 2 | 3 | ENV TYKVERSION 3.0.4 4 | ENV TYKLISTENPORT 3000 5 | ARG TYKVERSION=3.1.2~257.a9f5267 6 | 7 | LABEL Description="Tyk Dashboard docker image" Vendor="Tyk" Version=$TYKVERSION 8 | 9 | RUN apt-get update \ 10 | && apt-get upgrade -y \ 11 | && apt-get install -y --no-install-recommends \ 12 | curl ca-certificates apt-transport-https gnupg \ 13 | && curl -L https://packagecloud.io/tyk/tyk-dashboard/gpgkey | apt-key add - \ 14 | && apt-get purge -y gnupg \ 15 | && apt-get autoremove -y \ 16 | && rm -rf /root/.cache 17 | 18 | RUN echo "deb https://packagecloud.io/tyk/tyk-dashboard/debian/ jessie main" | tee /etc/apt/sources.list.d/tyk_tyk-dashboard.list \ 19 | && apt-get update \ 20 | && apt-get install --allow-unauthenticated -f --force-yes -y tyk-dashboard=$TYKVERSION \ 21 | && rm -rf /var/lib/apt/lists/* 22 | 23 | 24 | COPY ./tyk_analytics.with_mongo_and_gateway.conf /opt/tyk-dashboard/tyk_analytics.conf 25 | VOLUME ["/opt/tyk-dashboard"] 26 | WORKDIR /opt/tyk-dashboard 27 | 28 | ENTRYPOINT ["/opt/tyk-dashboard/tyk-analytics", "--conf=/opt/tyk-dashboard/tyk_analytics.conf"] 29 | -------------------------------------------------------------------------------- /tyk_analytics.with_mongo_and_gateway.conf: -------------------------------------------------------------------------------- 1 | { 2 | "listen_port": 3000, 3 | "tyk_api_config": { 4 | "Host": "http://tyk_gateway", 5 | "Port": "8080", 6 | "Secret": "352d20ee67be67f6340b4c0605b044b7" 7 | }, 8 | "shared_node_secret": "352d20ee67be67f6340b4c0605b044b7", 9 | "mongo_url": "mongodb://mongo:27017/tyk_analytics", 10 | "license_key": "", 11 | "page_size": 10, 12 | "admin_secret": "12345", 13 | "redis_port": 6379, 14 | "redis_host": "redis", 15 | "redis_password": "", 16 | "force_api_defaults": false, 17 | "notify_on_change": true, 18 | "license_owner": "NA", 19 | "hash_keys": true, 20 | "email_backend": {}, 21 | "hide_listen_path": false, 22 | "use_sentry": false, 23 | "sentry_code": "", 24 | "sentry_js_code": "", 25 | "show_org_id": true, 26 | "enable_duplicate_slugs": true, 27 | "host_config" : { 28 | "override_hostname": "tyk.docker", 29 | "disable_org_slug_prefix": true, 30 | "enable_host_names": true, 31 | "hostname": "localhost", 32 | "portal_domains": {}, 33 | "portal_root_path": "/portal" 34 | }, 35 | "http_server_options": { 36 | "use_ssl": false, 37 | "certificates": [ 38 | {} 39 | ] 40 | }, 41 | "ui": { 42 | "login_page": {}, 43 | "nav" : {}, 44 | "uptime": {}, 45 | "portal": {}, 46 | "designer": {} 47 | }, 48 | "home_dir": "/opt/tyk-dashboard", 49 | "enable_aggregate_lookups": true, 50 | "aggregate_lookup_cutoff": "01/07/2016" 51 | } 52 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Usage ./bootstrap.sh DASHBOARD_HOSTNAME 3 | 4 | LOCALIP=$1 5 | RANDOM_USER=$(env LC_CTYPE=C tr -dc "a-z0-9" < /dev/urandom | head -c 10) 6 | PASS="test123" 7 | 8 | echo "Creating Organisation" 9 | ORGDATA=$(curl --silent --header "admin-auth: 12345" --header "Content-Type:application/json" --data '{"owner_name": "Default Org.","owner_slug": "default", "cname_enabled": true, "cname": ""}' http://$LOCALIP:3000/admin/organisations 2>&1) 10 | #echo $ORGDATA 11 | ORGID=$(echo $ORGDATA | python -c 'import json,sys;obj=json.load(sys.stdin);print(obj["Meta"])') 12 | echo "ORGID: $ORGID" 13 | 14 | echo "Adding new user" 15 | USER_DATA=$(curl --silent --header "admin-auth: 12345" --header "Content-Type:application/json" --data '{"first_name": "John","last_name": "Smith","email_address": "'$RANDOM_USER'@example.com","password":"'$PASS'", "active": true,"org_id": "'$ORGID'"}' http://$LOCALIP:3000/admin/users 2>&1) 16 | #echo $USER_DATA 17 | USER_CODE=$(echo $USER_DATA | python -c 'import json,sys;obj=json.load(sys.stdin);print(obj["Message"])') 18 | echo "USER AUTH: $USER_CODE" 19 | 20 | USER_LIST=$(curl --silent --header "authorization: $USER_CODE" http://$LOCALIP:3000/api/users 2>&1) 21 | #echo $USER_LIST 22 | 23 | USER_ID=$(echo $USER_LIST | python -c 'import json,sys;obj=json.load(sys.stdin);print(obj["users"][0]["id"])') 24 | echo "NEW ID: $USER_ID" 25 | 26 | echo "Setting password" 27 | OK=$(curl --silent --header "authorization: $USER_CODE" --header "Content-Type:application/json" http://$LOCALIP:3000/api/users/$USER_ID/actions/reset --data '{"new_password":"'$PASS'"}') 28 | 29 | echo "" 30 | 31 | echo "DONE" 32 | echo "====" 33 | echo "Login at http://$LOCALIP:3000/" 34 | echo "User: $RANDOM_USER@example.com" 35 | echo "Pass: $PASS" 36 | echo "" 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | We would like to deprecate this repo as the release automation builds official images from the repo itself. 2 | 3 | If you'd like this repo to keep going, please do describe your use case in an issue and we can work something out. 4 | 5 | # ~~Official~~ Tyk Dashboard Docker Build 6 | 7 | This container only contains the Tyk Dashboard, the Tyk Gateway is provided as a separate container and needs to be set up and running (with the Dashboard enabled) before it will work with this container. 8 | 9 | The following ports are required to be open: 10 | 11 | For Redis: 6379 12 | For MongoDB: 27017 13 | 14 | # Building a specific version of the dashboard 15 | 16 | Assuming you want to build an image called `tykdb`, tagged `test` with version 3.2.1 of the dashboard: 17 | 18 | ``` 19 | % docker build --build-arg=TYKVERSION=3.2.1 -t tykdb:test . 20 | ``` 21 | 22 | # Quickstart 23 | 24 | 1. Ensure you have set up Redis, Mongo and Tyk Gateway containers 25 | 2. Set up the docker instance IP as the dashboard hostname (in your /etc/hosts file or as a DNS): 26 | 127.0.0.1 dashboard.tyk.docker 27 | 28 | 3. Run the Dashboard 29 | 30 | `docker run -d --name tyk_dashboard -p 3000:3000 --link tyk_redis:redis --link tyk_mongo:mongo --link tyk_gateway:tyk_gateway tykio/tyk-dashboard` 31 | 32 | 4. You should now be able to access your Dashboard at `http://dashboard.tyk.docker:3000/` (note for OSX users, replace 127.0.0.1 with whatever IP address your docker VM runs) 33 | 34 | 5. Enter your Dashboard License. Go to `http://dashboard.tyk.docker:3000/`. You will see a screen asking for a license, enter it in the section marked “**Already have a license?**” and click `Use this license`. 35 | 36 | 6. Grab the bootstrap script from our [tyk-dashboard github repo](https://github.com/TykTechnologies/tyk-dashboard-docker) and run: 37 | 38 | ./bootstrap.sh dashboard.tyk.docker 39 | 40 | To use an external configuration files, use the `-v` option to mount 41 | it over `/opt/tyk-dashboard/tyk_analytics.conf` 42 | --------------------------------------------------------------------------------