xively / mosquitto

Ruby binding against libmosquitto (http://mosquitto.org/) - a high performance MQTT protocol (http://mqtt.org) client
Other
58 stars 16 forks source link

installing the gem in heroku environment #13

Closed rolandjitsu closed 10 years ago

rolandjitsu commented 10 years ago

Hey @methodmissing / @errordeveloper, I have just tried to deploy an app that uses this gem on Heroku but, unfortunately, it does not build because of the libmosquitto lib.

Could you suggest a way to solve this? Or this is just the way it is and there is no solution for it?

erkki commented 10 years ago

@rolandjitsu I believe the correct way would be to use a custom buildpack which installs libmosquitto, similar to eg https://github.com/mcollina/heroku-buildpack-imagemagick

rolandjitsu commented 10 years ago

@erkki, I'm not exactly an expert in writing shell scripts, do you have, perhaps, an example of how I could write a simple buildpack such as that one?

erkki commented 10 years ago

@rolandjitsu check out https://github.com/ddollar/heroku-buildpack-apt, that would enable you to install arbitrary apt packages as dependencies

rolandjitsu commented 10 years ago

@erkki, I managed to install some buildpacks, but it seems like this lib needs to be build from source, is that an issue?

The current Ubuntu packages aren't on 1.3.1 yet - it's recommended to build libmosquitto from source (see below) until further notice. OpenSSL is an optional dependency - libmosquitto builds without it, however TLS specific features would not be available.

wget http://mosquitto.org/files/source/mosquitto-1.3.1.tar.gz
tar xzf mosquitto-1.3.1.tar.gz
cd mosquitto-1.3.1
cmake .
sudo make install

Because this is not exactly an apt-get anymore and it fails to find any lib called mosquitto.

erkki commented 10 years ago

yeah if installing from source would need to use a similar approach but have one of the buildpacks do the building

rolandjitsu commented 10 years ago

@erkki, so create a new buildpack that does the commands:

wget http://mosquitto.org/files/source/mosquitto-1.3.1.tar.gz
tar xzf mosquitto-1.3.1.tar.gz
cd mosquitto-1.3.1
cmake .
sudo make install

Is it as easy as pasting this commands into a shell script and push to git? Or do you actually have to write way more just for this?

erkki commented 10 years ago

should be pretty much that, check one of the existing buildpacks re where to put this exactly

rolandjitsu commented 10 years ago

@erkki, thanks, I'll try to do just that, I hope I can manage :)

rolandjitsu commented 10 years ago

I just gave it a shot on heroku-buildpack-mosquitto, but it is failing and it's rejected by Heroku. @erkki or if anyone could help out it would be great :) Because I have no clue what I'm doing.

Heroku Docs: Some docs can be found at that link, it did not help me though :)

errordeveloper commented 10 years ago

@rolandjitsu https://github.com/rolandjitsu, what error message do you get from Heroku?

On 25 May 2014 20:20, Roland notifications@github.com wrote:

I just gave it a shot on heroku-buildpack-mosquittohttps://github.com/rolandjitsu/heroku-buildpack-mosquitto, but it is failing and it's rejected by Heroku.

@erkki https://github.com/erkki or if anyone could help out it would be great :) Because I have no clue what I'm doing.

Reply to this email directly or view it on GitHubhttps://github.com/xively/mosquitto/issues/13#issuecomment-44143078 .

rolandjitsu commented 10 years ago

Hey @errordeveloper, I have created a stackoverflow post with the description of what I am doing, the repo that I created quickly with a build package and what is the error that I get.

errordeveloper commented 10 years ago

@erkki https://github.com/erkki, @methodmissinghttps://github.com/methodmissing I think this can be closed...

On 26 May 2014 06:53, Roland notifications@github.com wrote:

Hey @errordeveloper https://github.com/errordeveloper, I have created a stackoverflowhttp://stackoverflow.com/questions/23859847/heroku-buildpack-for-installing-libmosquittopost with the description of what I am doing, the repo https://github.com/rolandjitsu/heroku-buildpack-mosquitto that I created quickly with a build package and what is the error that I get.

Reply to this email directly or view it on GitHubhttps://github.com/xively/mosquitto/issues/13#issuecomment-44159202 .

methodmissing commented 10 years ago

Thanks Ilya - closing.

rolandjitsu commented 10 years ago

@methodmissing, @errordeveloper, @erkki I managed to get a bit further with it, but now I get some other issues with it. I get the following error:

/tmp/buildpackJO4Ao/bin/compile: line 40: cmake: command not found
set -e; for d in lib client src; do make -C ${d}; done
make[1]: Entering directory `/tmp/fakesu-mosquitto-cN5z/mosquitto-1.3.1/lib'
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SRV -c mosquitto.c -o mosquitto.o
In file included from mosquitto.c:46:
mosquitto_internal.h:51:20: error: ares.h: No such file or directory
In file included from mosquitto.c:46:
mosquitto_internal.h:238: error: expected specifier-qualifier-list before 'ares_channel'
In file included from mosquitto.c:55:
tls_mosq.h:40:6: warning: #warning "TLS-PSK not supported, openssl too old."
mosquitto.c: In function 'mosquitto_loop':
mosquitto.c:841: error: 'struct mosquitto' has no member named 'achan'
mosquitto.c:844: warning: implicit declaration of function 'ares_fds'
mosquitto.c:844: error: 'struct mosquitto' has no member named 'achan'
mosquitto.c:924: error: 'struct mosquitto' has no member named 'achan'
mosquitto.c:925: warning: implicit declaration of function 'ares_process'
mosquitto.c:925: error: 'struct mosquitto' has no member named 'achan'
make[1]: *** [mosquitto.o] Error 1
make[1]: Leaving directory `/tmp/fakesu-mosquitto-cN5z/mosquitto-1.3.1/lib'
make: *** [mosquitto] Error 2
       mosquitto installed
cp: cannot stat `/app/tmp/cache/.tools/mosquitto/bin/mosquitto': No such file or directory
errordeveloper commented 10 years ago

Sure, you just need to install cmake. On 26 May 2014 15:00, "Roland" notifications@github.com wrote:

I managed to get a bit further with it, but now I get some other issues with it. I get the following error:

/tmp/buildpackJO4Ao/bin/compile: line 40: cmake: command not found set -e; for d in lib client src; do make -C ${d}; done make[1]: Entering directory /tmp/fakesu-mosquitto-cN5z/mosquitto-1.3.1/lib' cc -Wall -ggdb -O2 -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SRV -c mosquitto.c -o mosquitto.o In file included from mosquitto.c:46: mosquitto_internal.h:51:20: error: ares.h: No such file or directory In file included from mosquitto.c:46: mosquitto_internal.h:238: error: expected specifier-qualifier-list before 'ares_channel' In file included from mosquitto.c:55: tls_mosq.h:40:6: warning: #warning "TLS-PSK not supported, openssl too old." mosquitto.c: In function 'mosquitto_loop': mosquitto.c:841: error: 'struct mosquitto' has no member named 'achan' mosquitto.c:844: warning: implicit declaration of function 'ares_fds' mosquitto.c:844: error: 'struct mosquitto' has no member named 'achan' mosquitto.c:924: error: 'struct mosquitto' has no member named 'achan' mosquitto.c:925: warning: implicit declaration of function 'ares_process' mosquitto.c:925: error: 'struct mosquitto' has no member named 'achan' make[1]: *** [mosquitto.o] Error 1 make[1]: Leaving directory/tmp/fakesu-mosquitto-cN5z/mosquitto-1.3.1/lib' make: *\ [mosquitto] Error 2 mosquitto installed cp: cannot stat `/app/tmp/cache/.tools/mosquitto/bin/mosquitto': No such file or directory

Reply to this email directly or view it on GitHubhttps://github.com/xively/mosquitto/issues/13#issuecomment-44191417 .