Over a million developers have joined DZone.

Setting Up Tyk Portal and Developer Registrations

This tutorial will show you how to get around a bug in Tyk that prevents you from using custom domains as portals.

Learn how API management supports better integration in Achieving Enterprise Agility with Microservices and API Management, brought to you in partnership with 3scale

There was this long-running bug that was hitting us when we tried setting up a Tyk portal. The issue was with Tyk not allowing custom domains to be set up as portals. While the settings, as advised by Tyk, mention the dashboard and portal port as 3000, ideally, it should be set as 80 to get the portal configured seamlessly. I learned the hard way after so many attempts of getting this done on port 3000.

Image titleSetting up Portal Domain

Add to /etc/hosts File

  • dashboard.tyk-local.com

  • portal.tyk-local.com

Most likely, Apache2 or some other web server is already be listening to port 80. Make sure to stop those listeners to free up the port.

Stop Apache2 Web Server

 /etc/init.d/apache2 stop 

Configure the Tyk Gateway

sudo /opt/tyk-gateway/install/setup.sh 

Configure the Tyk Dashboard

sudo /opt/tyk-dashboard/install/setup.sh 

Configure the Tyk Pump

sudo /opt/tyk-pump/install/setup.sh 

Initial Start to Set Up the Tyk License

sudo service tyk-pump start
sudo service tyk-dashboard start

Access http://dashboard.tyk-local.com/ and add the license in the prompt.

Restart the Tyk Dashboard and start the Tyk Gateway

sudo service tyk-dashboard restart
sudo service tyk-gateway start

Fix the Tyk Bootstrap Script to Listen to Port 80

Edit /opt/tyk-dashboard/install/bootstrap.sh and remove :3000 from all references — we're going to use port 80 as the default for the dashboard.

# Usage ./bootstrap.sh DASHBOARD_HOSTNAME

RANDOM_USER=$(env LC_CTYPE=C tr -dc "a-z0-9" < /dev/urandom | head -c 10)

echo "Creating Organisation"
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/admin/organisations 2>&1)
#echo $ORGDATA

ORGID=$(echo $ORGDATA | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["Meta"]')
echo "ORGID: $ORGID"
echo "Adding new user"
USER_DATA=$(curl --silent --header "admin-auth: 12345" --header "Content-Type:application/json" --data '{"first_name": "John","last_name": "Smith","email_address": "'$RANDOM_USER'@default.com","password":"'$PASS'", "active": true,"org_id": "'$ORGID'"}' http://$LOCALIP/admin/users 2>&1)
#echo $USER_DATA

USER_CODE=$(echo $USER_DATA | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["Message"]')
USER_LIST=$(curl --silent --header "authorization: $USER_CODE" http://$LOCALIP/api/users 2>&1)
#echo $USER_LIST

USER_ID=$(echo $USER_LIST | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["users"][0]["id"]')
echo "NEW ID: $USER_ID"
echo "Setting password"
OK=$(curl --silent --header "authorization: $USER_CODE" --header "Content-Type:application/json" http://$LOCALIP/api/users/$USER_ID/actions/reset --data '{"new_password":"'$PASS'"}')

echo ""
echo "DONE"
echo "===="
echo "Login at http://$LOCALIP/"
echo "User: $RANDOM_USER@default.com"
echo "Pass: $PASS"
echo ""

Save and Exit the Bootstrap Script, then Execute

sudo /opt/tyk-dashboard/install/bootstrap.sh dashboard.tyk-local.com

root@llovizna:/home/pradeeban#  sudo /opt/tyk-dashboard/install/bootstrap.sh dashboard.tyk-local.com

Creating Organisation
ORGID: 579794145ee8571e46000001
Adding new user
USER AUTH: 6936a780a8e448fd73e3d7ef64eb8059
NEW ID: 5797941458149ac06a14e801
Setting password



Login at http://dashboard.tyk-local.com/
User: c9og13fnc8@default.com
Pass: test123

Image title

Tyk Developer Portal

Now, you are good to log into the Tyk dashboard with the given credentials.

Set Portal Domain


This would give you a message, "CNAME updated."

Now if you access http://portal.tyk-local.com/portal/ it would say, "Home page not found." This is expected as you have not set up the portal and the welcome page yet. 

Follow this document to get those set up.

Once you have set this up, your portal is ready for developers to register, log in, and consumes the APIs defined in the API catalogue.

Unleash the power of your APIs with future-proof API management - Create your account and start your free trial today, brought to you in partnership with 3scale.

custom,web server,portal,dashboard

Published at DZone with permission of Pradeeban Kathiravelu, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}