AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Cannot load default ChatScript bot on an EC2 instance
  [ # 16 ]

I can, over the coming weekend (or maybe earlier), investigate your situation. Of course, I would probably need to login to your amazon instance and confirm all the setup details. If you want to email me your details (and change your password after), I could do that.


  [ # 17 ]

Hey Bruce,

Thanks for your reply I am sorry I haven’t had a chance to respond sooner.

In the meantime I will send you all the details for the server so you can check it out.
Because this really has me stumped.


  [ # 18 ]

I believe I can help you. is only equal to LOCALHOST on your machine or a machine setup that way.  On Amazon EC2 you have a public, or possibly elastic ip, and then you have the PRIVATE IP.  You need to use this private ip for setting things up under the hood, and when people hit your public address amazon maps it in the background.

//Example for SERVER:
I opened port 8080 in my EC2 security group, and then i connected to the console, via TERMINAL (I am on mac today).

navigate to where your chatscript BINARIES are and:


./LinuxChatScript64 interface= port=8080

Please note, is a PRIVATE IP ADDRESS assigned to the same EC2 instance.  You will see it at the top of your shell when connecting, and you can see it when viewing the EC2 instance properties on amazon.

//Example for CLIENT:

./LinuxChatScript64 local

//A little more help:

If you wish to use the example front end files such as the /BETTER/ html setup, you must edit the files to use the above mentioned private ip of your own EC2 and the corresponding port if you deviated.

//To automate starting and keeping it running with CRONJOBS
//The following will try every minute to start.

//TO ADD THE FOLLOWING LINE execute: crontab -e (If it asks which editor I personall choose nano)

*/1 * * * * cd /var/www/html/ChatScript/BINARIES && ./LinuxChatScript64 interface= port=8080

Hope this helps,

Brian Hodge - Technical Director - Kadho Inc. / Kadho Sports
.(JavaScript must be enabled to view this email address)


  [ # 19 ]

Just to be clear. localhost is still on amazon ec2, I just mean that I will not map or resolve to much for you.  To follow up, locate your own private ip address for that ec2 instance, make sure the port you chose is open, 1024 if default I believe, but as you can see I went with 8080 for some silly reason.  I don’t suggest you block out that port I will be changing it.

Edit the html files that came with ChatScript, they have vars in place to change ip and port.
Make sure this is your PUBLIC ip or DNS.

$port = 8080;      // <<<<<<< your port number if different from 1024
$bot = “KadhoBot”;    // <<<<<<< desired botname, or “” for default bot

Just wanted to make sure that I was clear and not having you think you could merely copy and paste my input.

We are successfully running Chatbot on both AWS and AWS China with this setup.  Its just a socket server, so after that you can connect to it however you want, from whatever application that supports sockets.

Brian Hodge - Technical Director - Kadho Inc. / Kadho Sports
.(JavaScript must be enabled to view this email address)


  [ # 20 ]

I got it to work! Hurray!

Only thing is it is load the Rose by default but I have specified to use the Harry bot in the web interface folders.
What can I do?


  [ # 21 ]

Sorry to spam here, but I am also struggling to keep the CS instance up as well how did you guys achieve to keep it up?


  [ # 22 ]

I mentioned it above, you need Cronjobs, (a crontab) to keep the server up.

//To automate starting and keeping it running with CRONJOBS
//The following will try every minute to start. (This is excessive)

//TO ADD THE FOLLOWING LINE execute: crontab -e (If it asks which editor I personally choose nano)

*/1 * * * * cd /path/to/ChatScript/BINARIES && ./LinuxChatScript64 interface=privateIpAddress port=1024.

As far as the bot, you’ll have to Build the bot.  Connect to your server, ./LinuxChatScript64 client=privateIpAddress:1024 (As the moderator stated, it is not good practice to paste IP/ports in forums, but in this case, they are private IPs).

Once you have logged into the server

> :build Harry

Also, on the sample web UI they provide, Rosy is “hard - coded”
var botName = ‘someCoolBotName’;  // change this to your bot name

Glad you got it running!

Brian Hodge - Technical Director - Kadho Inc. / Kadho Sports
.(JavaScript must be enabled to view this email address)


  [ # 23 ]

Ok, seems pretty straight forward.
But where did you create the crontab and how can you tell that it is working once implemented?


  [ # 24 ]

in terminal type > crontab -e then add the contents, save, and you will see it says it saved the crontab.  It will run on its own.  To check if it worked you could check the port you set the CS server to run on, sudo lsof -t -i:1024.  This will return the pid.  to stop it and see if it starts up auto, do kill -9 pid (pid being the value just returned with the prior command).  Obviously you would want to stop the instance you manually started first so you can be sure crontab started it.



  [ # 25 ]

I hope you don’t mind but I have emailed you with a screen shot of what I have as I just want to make sure that I am doing it
right if thats ok?


  [ # 26 ]

there is also a copy of a crontab in folder other os etc, LINUX subfolder


  [ # 27 ]

Well then, if that’s the case how can I access that on the amazon AMI because I created the crontab file inside the ChatScript folder


  [ # 28 ]

I am confused when you say you created the crontab in the CS folder. 

(Is this an Ubuntu instance?  Or Amazon AMI?)

-SSH into your EC2 Linux Instance. 

-An example for china aws.  (You can click connect on the AWS page, in EC2 Instances > Your Instance > Top of page, and it will give you the formatted command.

ssh -i “awsprivkey.pem” .(JavaScript must be enabled to view this email address)
(I have to assume you have done this before.)

-Type the command, crontab -e.
-On my Ubuntu 16.04 instance, this then asked me to choose between 4 text editors.  I chose nano, as it is what I always use on linux, and its simple.
-You should be in a file now with a bunch of commented out information about crontabs.
-Add the follwing line, with no # in front of it, which comments things out.
    */5 * * * * cd /home/theuserIChose/ChatScript/BINARIES && ./LinuxChatScript64 interface=ec2.private.ip port=chosenPort

The above will make it restart your server every 5 minutes.  Tune to your liking.

Image Attachments

  [ # 29 ]

Hi guys,

I just spun up a new server with ubuntu instead of Amazon AMI and it worked!
Honestly guys, I want to thank you guys for putting up with me! smile

Just one more thing though, the bot responds with a blank response like this.
What could be causing it?

Image Attachments

  [ # 30 ]

Install PHP raspberry

sudo apt-get update
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

Then refresh webpage.


 < 1 2 3 > 
2 of 3
  login or register to react