Skip to content

Commit

Permalink
add support for normal docker up command (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
sedkis authored Nov 9, 2023
1 parent beb0d2a commit 802df3b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
### Tyk Dashboard License, enter here:
TYK_DB_LICENSEKEY=
DASH_LICENSE=eyJhbGc...
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Once you have a license, Run these commands:

1. `git clone https://github.com/TykTechnologies/tyk-pro-docker-demo && cd tyk-pro-docker-demo`

2. `up.sh`
2. For a bootstrapped install, run `up.sh`
OR
2. Add your Tyk Dashboard license to .env (see .env.example) and run `docker-compose up`

hint: you may need to give the executable permissions if you have an error:
```bash
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
image: tykio/tyk-dashboard:v5.2.2
container_name: tyk-dashboard
environment:
- TYK_DB_LICENSEKEY=${DASH_LICENSE:?License key missing from Docker environment file "".env" file. Review The Getting Started steps in README.md.}
- TYK_DB_STORAGE_MAIN_TYPE=postgres
- TYK_DB_STORAGE_MAIN_CONNECTIONSTRING=user=postgres password=topsecretpassword host=tyk-postgres port=5432 database=tyk_analytics
depends_on:
Expand All @@ -20,6 +21,8 @@ services:
command: --bootstrap
ports:
- 3001:3001
environment:
- PORTAL_LICENSEKEY=${DASH_LICENSE:?License key missing from Docker environment file "".env" file. Review The Getting Started steps in README.md.}
env_file:
- ./confs/tyk_portal.env
networks:
Expand Down
19 changes: 14 additions & 5 deletions up.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
#!/bin/bash

# Path to the .env file
env_file=".env"

# Check if the .env file exists
if [ -f "$env_file" ]; then
echo ".env file already exists. Skipping creation."
else
# The .env file does not exist, create it and prompt for the license key
echo "Creating .env file..."
touch "$env_file"

if grep -q "TYK_DB_LICENSEKEY" ./confs/tyk_analytics.env; then
echo "TYK_DB_LICENSEKEY exists in the file! Skipping.."
else
read -n2048 -s -p 'Please enter your Tyk Pro License key: ' license_key
echo TYK_DB_LICENSEKEY=$license_key >> confs/tyk_analytics.env
echo PORTAL_LICENSEKEY=$license_key >> confs/tyk_portal.env
echo

echo "DASH_LICENSE=$license_key" >> "$env_file"
echo ".env file created and keys added."
fi

echo "Bringing Tyk Trial deployment UP..."
Expand Down

0 comments on commit 802df3b

Please sign in to comment.