Docker images for Tock
Several docker files are available in the Docker Hub.
This project contains the source to build and deploy the docker files, and also provides docker-compose files for the whole Tock stack.
- Windows users, you need to run dos2unix to format the mongo setup script first:
dos2unix ./scripts/setup.sh
#get the last docker-compose file
curl -o docker-compose.yml https://raw.githubusercontent.com/voyages-sncf-technologies/tock-docker/master/docker-compose.yml
#get the script to start mongo in replicaset mode
mkdir -p scripts && curl -o scripts/setup.sh https://raw.githubusercontent.com/voyages-sncf-technologies/tock-docker/master/scripts/setup.sh && chmod +x scripts/setup.sh
#get the last tag
curl -o .env https://raw.githubusercontent.com/voyages-sncf-technologies/tock-docker/master/.env
#launch the stack
docker-compose up
And go to http://localhost to use the admin interface.
The default login/password is admin@app.com/password.
In order to reach the mongo database from a client (if you run the bot in Intellij Idea for example), you need to add in your /etc/hosts (C:\windows\system32\drivers\etc\hosts for windows) these lines:
127.0.0.1 mongo
127.0.0.1 mongo2
127.0.0.1 mongo3
#get the last docker-compose-bot file
curl -o docker-compose.yml https://raw.githubusercontent.com/voyages-sncf-technologies/tock-docker/master/docker-compose-bot.yml
#get the script to start mongo in replicaset mode
mkdir -p scripts && curl -o scripts/setup.sh https://raw.githubusercontent.com/voyages-sncf-technologies/tock-docker/master/scripts/setup.sh && chmod +x scripts/setup.sh
#get the last tag
curl -o .env https://raw.githubusercontent.com/voyages-sncf-technologies/tock-docker/master/.env
#launch the stack
docker-compose -f docker-compose-bot.yml up
This docker-compose file starts the NLP stack with the Open Data Bot.
- Edit the file bot-open-data-variables.env and set the required env variables.
You will need a (free) SNCF Open Data key and
-
optionally a Messenger application with "messages" and "messaging_postbacks" webhook events activated - look at the Facebook documentation and Tock Messenger Configuration instructions.
-
optionally a Google Assistant project (see https://developers.google.com/actions/sdk/create-a-project ) - sample project file here: google_actions_fr.json Look at Tock Google Assistant configuration.
#get the file
curl -o bot-open-data-variables.env https://raw.githubusercontent.com/voyages-sncf-technologies/tock-docker/master/bot-open-data-variables.env
Then edit the values:
#Sncf open data api user
tock_bot_open_data_sncf_api_user=
- Also to test the bot with Messenger or Google Assistant, a secure ssl tunnel (for example ngrok) is required:
ngrok http 8080
- Then run the bot
#get the last docker compose file
curl -o docker-compose-bot-open-data.yml https://raw.githubusercontent.com/voyages-sncf-technologies/tock-docker/master/docker-compose-bot-open-data.yml
#get the script to start mongo in replicaset mode
mkdir -p scripts && curl -o scripts/setup.sh https://raw.githubusercontent.com/voyages-sncf-technologies/tock-docker/master/scripts/setup.sh && chmod +x scripts/setup.sh
#get the last tag
curl -o .env https://raw.githubusercontent.com/voyages-sncf-technologies/tock-docker/master/.env
#launch the stack
docker-compose -f docker-compose-bot-open-data.yml up
- Take the ngrok value (ie https://xxxx.ngrok.io ) and use it
- In the webhook interface of Messenger settings, to specify :
- the url : https://xxxx.ngrok.io/messenger
- the verify token you set in tock_bot_open_data_webhook_verify_token env var
- In the Google Assistant project file
- In the webhook interface of Messenger settings, to specify :
Now you can start to talk to the bot!
git clone https://github.com/voyages-sncf-technologies/tock-docker.git
cd tock-docker
mvn package docker:build