-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
communication not happening in Production mode #7
Comments
ps -x output3443 pts/0 Sl 0:00 spring server | telegram_bot_app | started 9 mins ago |
I am bit confused here, since I don't know how to upload the ssl public key to telegram. I could get only how to generate ssl key link from telegram, https://core.telegram.org/bots/self-signed. Am I right here ? |
From the Telegram documents, I found below link. https://core.telegram.org/bots/api#setwebhook It talks of uploading the cert file as below, which I haven't done.
|
Hi! I haven't tried self-issued certs, but have added param for it https://github.com/telegram-bot-rb/telegram-bot/blob/master/lib/tasks/telegram-bot.rake#L18. Try to set CERT envar when running I also have never run puma with ssl, always used nginx as frontend. Please check that it works fine and you can access server via https in browser. |
@printercu Thanks, I am getting new error after passing the CERT env when running set_webhook task for which I have created new issue. |
@printercu, please let me know how are you configuring the https setup in your case ? |
You can comment out |
Yes, now error does not appear, but server is not getting any message.
|
Does puma receive any other requests? I've tried https://172.104.41.236 and it's not working. |
Sorry, mentioned wrong issue in commit, reopen. Should be closing #8 |
Yes, for me browser is showing "Unable to connect". Puma is not receiving any requests. Please clarify my doubt. Why are you using nginx, since puma can server the requests ? $ puma -b 'ssl://172.104.41.236?key=/home/fueb/server.key&cert=/home/fueb/server.crt'
|
With below change, now puma is able to get request, but from telegram communication not happening. $ puma -b 'ssl://0.0.0.0:3000?key=/home/fueb/server.key&cert=/home/fueb/server.crt'
|
I also did execute the curl command and still no communication from telegram bot.
|
Puma has not been accepting requests without
I use nginx because it manages virtual hosts for me, and i can have multiple applications even on single domain on different subdomains. All of them can use standard ports (80/443), with multiple pumas you have to use different port for each instance.
Since you've added port to address, url has changed, and you need to tell telegram to use new one. Have you run |
Now, I am using nginx and my configurations as below, but still no request from telegram.
I ran set_webhook task by disabling the async in secret.yml file. I async mode enabled it again. I did run the puma server with nginx and now I could see home page of rails but from telegram bot no requests made. Edit:
|
Fails with rails 500 error page. |
Yes, that is correct since under production mode. Here is my production.log file content, when execute that curl command
|
I am passing server.crt file. $ bin/rake telegram:bot:set_webhook RAILS_ENV=production CERT="/home/fueb/server.crt" |
Does nginx use it? |
I've checked your cert from #8, it shows different info |
It's not necessary to run nginx, i thought you was almost done with puma, there was just set old url for webhook, when you changed port. |
My nginx configuration.
|
I don't know why this certs are different. My suggestion is at least not to use expired certs, as one of them expired on 09/18, and other on 10/3. |
So you run set_webhook again with new cert and still no updates from telegram? |
Yes, still no updates from telegram. |
I'll try to run bot with self-signed cert and come back with result later. |
Thanks.
…On Oct 6, 2017 7:22 PM, "printercu" ***@***.***> wrote:
I'll try to run bot with self-signed cert and come back with result later.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABH5x4SRFfhRovZaYhjlygkt43bwfz61ks5spjC1gaJpZM4Pu21J>
.
|
Finally have checked everything. I've also had a problem, before found this guide on self-signed certs for telegram. The problem for me was that I haven't provided an ip when created certificate (just copied command from telegram's guide). Here is list of command to run sample app from scratch: cd /tmp
git clone https://github.com/telegram-bot-rb/telegram_bot_app.git
cd telegram_bot_app/
bundle install
cp config/secrets.yml.sample config/secrets.yml
nano config/secrets.yml
# configure bot for prod. Sample file aliases prod to dev.
nano config/environments/production.rb
# Add this line. Use
# routes.default_url_options = {host: '%YOUR_IP_ADDR%', protocol: 'https', port: 8443}
# This is from telegram's guide.
# IMPORTANT! provide your ip address in CN field:
openssl req -newkey rsa:2048 -sha256 -nodes -keyout YOURPRIVATE.key -x509 -days 365 -out YOURPUBLIC.pem -subj "/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=%YOUR_IP_ADDR%"
RAILS_ENV=production rake telegram:bot:set_webhook CERT=YOURPUBLIC.pem
# Make sure it said: `Setting webhook for default...`
RAILS_ENV=production puma -b 'ssl://0.0.0.0:8443?key=YOURPRIVATE.key&cert=YOURPUBLIC.pem' If encounter any problem, try |
Thanks, I will check it with your steps and report it. |
Where should I run this command.
|
I followed your steps as below and still there is no communication.
|
Please run |
Yes, here it the output
|
This means ssl certificate is not suitable for telegram. I had same error, when copied this command without changing: |
Yes, I followed as you guided as below.
|
:( Can you please try all other fields untouched, may be this matters. This is the last resort to make it work. Do you run |
No port is provided in url. Please update |
Yes, I corrected it, rerun seb_webook and puma. Now it started to work finally. Thanks a lot @printercu. |
Now it works with nginx and puma combination and standard port 443. |
Hello, may I ask you share here configurations for: |
I tried in development mode and it is working fine but in production mode communication is not happening.
Please help me to resolve this issue.
My configuration details.
telegram_bot_app » Rails.application.routes.url_helpers.telegram_webhook_url
=> "https://172.104.41.236/telegram/404717147:xxxxxyyyyzz-GETlwnnetV9olinux3xbrIvuuQjxtvSoz4"
$ bin/rake telegram:bot:set_webhook RAILS_ENV=production
/home/fueb/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
/home/fueb/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
/home/fueb/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.1/lib/active_support/core_ext/numeric/conversions.rb:138: warning: constant ::Fixnum is deprecated
/home/fueb/.rvm/gems/ruby-2.4.1/gems/activejob-5.0.1/lib/active_job/arguments.rb:38: warning: constant ::Fixnum is deprecated
/home/fueb/.rvm/gems/ruby-2.4.1/gems/activejob-5.0.1/lib/active_job/arguments.rb:38: warning: constant ::Bignum is deprecated
Running via Spring preloader in process 3455
Setting webhook for default...
fueb@localhost:~/telegram_bot_app$ puma -b 'ssl://172.104.41.236?key=webhook_pkey.pem&cert=webhook_cert.pem'
Puma starting in single mode...
/home/fueb/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
/home/fueb/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
/home/fueb/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.1/lib/active_support/core_ext/numeric/conversions.rb:138: warning: constant ::Fixnum is deprecated
/home/fueb/.rvm/gems/ruby-2.4.1/gems/activejob-5.0.1/lib/active_job/arguments.rb:38: warning: constant ::Fixnum is deprecated
/home/fueb/.rvm/gems/ruby-2.4.1/gems/activejob-5.0.1/lib/active_job/arguments.rb:38: warning: constant ::Bignum is deprecated
Use Ctrl-C to stop
Thanks.
The text was updated successfully, but these errors were encountered: