Installing Tyk on docker - windows

This is a Knowledge document which explains how to set up Tyk on docker when using windows. At the time of writing this document, the docker image from tyk-pro-docker-demo has only a setup.sh script which cannot be used in windows.

Use the procedure as described in the github repository to clone the respository, edit the /etc/hosts file, update license and run the docker compose up command.

You will see that the next step is to run the ./setup.sh script to create a user and organization. In a windows environment, you will have call a few API’s manually to set this up. These API calls are described below.

Ensure that tyk dashboard is up and running on 3000 port

Create an orginization

POST /admin/organisations HTTP/1.1
Host: localhost:3000
admin-auth: 12345
Content-Type: application/json
User-Agent: PostmanRuntime/7.13.0
Accept: /
Cache-Control: no-cache
Postman-Token: 00011438-c567-441a-b573-455aa73cd4c0,23207f0b-9626-489d-8bf3-bdfb251ff5f3
Host: localhost:3000
accept-encoding: gzip, deflate
content-length: 102
Connection: keep-alive
cache-control: no-cache

{“owner_name”: “TestOrg5 Ltd.”,
“owner_slug”: “testorg”,
“cname_enabled”:true,
“cname”: “localhost”}

Create a user
POST /admin/users HTTP/1.1
Host: localhost:3000
Content-Type: application/json
admin-auth: 12345
User-Agent: PostmanRuntime/7.13.0
Accept: /
Cache-Control: no-cache
Postman-Token: 3d2ff0e3-4e56-468d-9782-90accecfc14d,6723a063-c421-40b5-aa83-8468bc02edec
Host: localhost:3000
accept-encoding: gzip, deflate
content-length: 143
Connection: keep-alive
cache-control: no-cache

{“first_name”: “Seenu”,
“last_name”: “Mathew”,
“email_address”: “[email protected]”,
“active”: true,
“org_id”: “5d0171ffd37cb30001a698d2”}

Set up a password
POST /api/users/5d017217464bb61a57a070f9/actions/reset HTTP/1.1
Host: localhost:3000
Authorization: 7345682e71034a3650a0865d307cc6ce
Content-Type: application/json
User-Agent: PostmanRuntime/7.13.0
Accept: /
Cache-Control: no-cache
Postman-Token: 27679be1-a1bc-47d5-bad0-9606cdbe72d0,8ae1a113-0bbf-4acd-9bc2-7324140b3b06
Host: localhost:3000
accept-encoding: gzip, deflate
content-length: 28
Connection: keep-alive
cache-control: no-cache

{“new_password”:“password’”}

Set up portal catalouge

POST /api/portal/catalogue HTTP/1.1
Host: localhost:3000
Authorization: 7345682e71034a3650a0865d307cc6ce
Content-Type: application/json
User-Agent: PostmanRuntime/7.13.0
Accept: /
Cache-Control: no-cache
Postman-Token: 43ba0e2d-4a66-4856-8c5d-a0434d395d82,6beb95a5-196e-46da-af9a-671cf13f09e3
Host: localhost:3000
accept-encoding: gzip, deflate
content-length: 38
Connection: keep-alive
cache-control: no-cache

{“org_id”: “5d0171ffd37cb30001a698d2”}

strong textCreate portal pages

POST /api/portal/pages? HTTP/1.1
Host: localhost:3000
Authorization: 7345682e71034a3650a0865d307cc6ce
Content-Type: application/json
User-Agent: PostmanRuntime/7.13.0
Accept: /
Cache-Control: no-cache
Postman-Token: bb669ee5-d065-4790-9477-b8b81684a528,e7ba8d71-e54b-4d68-9383-3f23fdd9a53d
Host: localhost:3000
accept-encoding: gzip, deflate
content-length: 725
Connection: keep-alive
cache-control: no-cache

{“is_homepage”: true,
“template_name”:“”, “title”:“Tyk Developer Portal”,
“slug”:“home”,
“fields”:
{“JumboCTATitle”: “Tyk Developer Portal”,
“SubHeading”: “Sub Header”,
“JumboCTALink”: “#cta”,
“JumboCTALinkTitle”: “Your awesome APIs, hosted with Tyk!”,
“PanelOneContent”: “Panel 1 content.”,
“PanelOneLink”: “#panel1”,
“PanelOneLinkTitle”: “Panel 1 Button”,
“PanelOneTitle”: “Panel 1 Title”,
“PanelThereeContent”: “”,
“PanelThreeContent”: “Panel 3 content.”,
“PanelThreeLink”: “#panel3”,
“PanelThreeLinkTitle”: “Panel 3 Button”,
“PanelThreeTitle”: “Panel 3 Title”,
“PanelTwoContent”: “Panel 2 content.”,
“PanelTwoLink”: “#panel2”,
“PanelTwoLinkTitle”: “Panel 2 Button”,
“PanelTwoTitle”: “Panel 2 Title”}
}

Setup Portal configuration

POST /api/portal/configuration HTTP/1.1
Host: localhost:3000
Authorization: 7345682e71034a3650a0865d307cc6ce
Content-Type: application/json
User-Agent: PostmanRuntime/7.13.0
Accept: /
Cache-Control: no-cache
Postman-Token: 84659b12-e53a-4069-9573-59e4dff6fa01,d9b264d2-a5fc-48d7-b337-1c2d05ea6c65
Host: localhost:3000
accept-encoding: gzip, deflate
content-length: 2
Connection: keep-alive
cache-control: no-cache

{}

Login with your email address and password you had reset

Hi Seenu,

Thanks for this - really helpful. Will get our docs guy to run through it and update the documentation.

Hi @Seenu_Mathew, I was wondering whether you could share your Windows setup? I tried this yesterday on a Win 10 Pro machine yesterday. I was getting the following error (via PowerShell as Admin) when creating an Organisation. I can see the Dashboard login screen, so the Docker setup is fine.

At line:15 char:14
+ {"owner_name": "TestOrg5 Ltd.",
+              ~
Unexpected token ':' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

Hi @marks,

Sure, Here is a screenshot of my query. Have you set the Content-Type: application/json ?

Regards
Seenu Mathew

Hi @Seenu_Mathew,
Thanks for that. I’ve now got it up and running successfully, so I’m going to write up the process.

Thank you very much @marks

Please do add it here by providing the link.
Also a good idea would be to build a setup.bat file so that windows users can launch it.

Best Regards
Seenu Mathew

@Seenu_Mathew, See https://tyk.io/docs/get-started/with-tyk-on-premise/installation/docker/docker-pro-demo/docker-pro-demo-windows/

and:

https://tyk.io/docs/get-started/with-tyk-on-premise/installation/docker/docker-pro-demo/docker-pro-wsl/

Regards
Mark

Is there a setup.bat file that can be created so that these commands can be run?