bespoken / bst

:wrench: Bespoken Tools - Tools for making voice apps faster and better
https://bespoken.io
Apache License 2.0
191 stars 20 forks source link

Is it possible to run bst withot proxy? #248

Closed falent closed 7 years ago

falent commented 7 years ago

It is a great project but is it possible to run bst without proxy as http server? I have my own server and I would rather use my own address without proxy ;)

jperata commented 7 years ago

What parts of the toolset do you want to use without the proxy, if you're talking about the bst speak for example you can set an endpoint, for example: $ bst speak Hello World --url https://my.skill.com/skill/path

falent commented 7 years ago

Thanks jperta for your answer.

I'm looking something for production version for my skill. I don't want to host my skill in AWS. So the best solution would be to have something like bst but without proxy.

So I have my own server and https address. I start my skill on my server and after that I put address my server's address into developer.amazon.com skill configuration.

So insteas address: https://proxy.bespoken.tools?node....

I would have my own address: https://celero.pl/myskill

Do you know any solution for that?

jperata commented 7 years ago

I'm probably missing what is what you are trying to do, $ bst speak Hello World --url https://celero.pl/myskill will send a Alexa like Request to your server address so that you can test it without a proxy.

falent commented 7 years ago

I just would like to host my skill in my server without proxy and I'm asking if it is possible with bst great tool :P

you tell me about sennding a request... nope. It isn't my intention ;)

I would like to find a solution that I can start my skill in my https server. I don't know if bst supports it but if yes I would be very grateful.

I have no idea how to host lambda skill local in my own server. bst solution is great but it can not be used in production skill.

jperata, do you know how to host my skill as a lambda function in my own server so I can run it and after that give my https address into developer.amazon.com website. So it would alwasys call my https server if somebody use my skill

jkelvie commented 7 years ago

Hi @falent let me make sure I understand: 1) You have a Lambda, which you have tested locally with bst 2) You want to deploy the Lambda on a dedicated server - rather than as a "normal" Lambda hosted at AWS

Is that right?

falent commented 7 years ago

Exactly!!!

jkelvie commented 7 years ago

Great, so that is possible - you can use this class programmatically: http://docs.bespoken.tools/en/latest/api/classes/lambdaserver.html

If you want to see an example of it in action, take a look here: https://github.com/bespoken/streamer/blob/WSB/bin/server.js

Though one question - why not just use ExpressJS if you want to run your own server?

If you use Express, you can still use the proxy tool with it, instead just enter: bst proxy http <ExpressPort>

falent commented 7 years ago

John could you please tell me how can I do it?

Do I need just add this code into my skill at the top?

const bst = require('bespoken-tools');

const server = new bst.LambdaServer('lib/index.js', 10000, true);
server.start();
jkelvie commented 7 years ago

Yes, that is the code that is needed. But you cannot just add it to your skill (because otherwise it will load itself). In my example, I put it in it's own file under a /bin directory.

You also need to make sure to add us as a dependency in your package.json.

Let me know how it goes!

falent commented 7 years ago

Thanks John :) How should I start my skill after that? I should: 1) add a file myskill/bin/server.js 2) edit file /bin/server.js

const bst = require('bespoken-tools');

const server = new bst.LambdaServer('myskill/index.js', 10000, true); server.start();

3) Execute code? but how? bst lambda myskill/bin/server.js

jkelvie commented 7 years ago

Just run: node myskill/bin/server.js

This assumes you are running the command from the directory that contains myskill.