Thread: [Cppcms-users] cppblog and systemd
Brought to you by:
artyom-beilis
|
From: Paolo B. <pao...@gm...> - 2015-03-15 21:50:50
|
I wanted to write a systemd file to execute cppblog, here is the content: -------- >8 [Unit] Description=A high performance blog based on cppcms After=network.target [Service] Type=simple WorkingDirectory=/var/blog ExecStart=/usr/bin/cppblog -c config.js [Install] WantedBy=multi-user.target -------- >8 As you can see it is very simple and apparently it works, however I would like to execute cppblog as a http user, so I added User=http in the [Service] section. However just changing the executing user the cppblog crashes with a "address already in use error," here is the log: Failed: system: Address already in use 0x7f146c5f6ebb: booster::system::system_error::system_error(booster::system::error_code const&) + 0x13b in /usr/lib/libcppcms.so.1 0x7f146c2c7bb7: booster::aio::acceptor::bind(booster::aio::endpoint const&) + 0x67 in /usr/lib/libbooster.so.0 0x7f146c6cfce0: cppcms::impl::cgi::fastcgi_api_unix_socket_factory(cppcms::service&, std::string, int) + 0xc0 in /usr/lib/libcppcms.so.1 0x7f146c5f0bac: cppcms::service::setup_acceptor(cppcms::json::value const&, int, int) + 0x68c in /usr/lib/libcppcms.so.1 0x7f146c5f137e: cppcms::service::start_acceptor(bool) + 0x17e in /usr/lib/libcppcms.so.1 0x7f146c5f3e19: cppcms::service::run() + 0x29 in /usr/lib/libcppcms.so.1 0x41d036: main + 0x76 in /usr/bin/cppblog 0x7f146b30e800: __libc_start_main + 0xf0 in /usr/lib/libc.so.6 0x41de39: _start + 0x29 in /usr/bin/cppblog To make the situation even more confusing, if I try to execute via command line with sudo -u it works fine... What am I doing wrong? Any idea of what I can try? |
|
From: Marcel H. <ke...@co...> - 2015-03-16 10:04:35
Attachments:
signature.asc
|
I suppose you are trying to use a port below 1024, because that are root only ports. Try to use an other port. Btw: why don't you use nginx as http server and fast_cgi as recommended by [0]? Greetings, Marcel [0] http://cppcms.com/wikipp/en/page/cppcms_1x_tut_web_server_config |
|
From: Artyom B. <art...@ya...> - 2015-03-16 11:00:43
|
First of all according to the error check if somebody uses this port... I'm not familiar with systemd but CppCMS service should have all you need Note: (a) you can define the user and daemon settings at cppcms level Take a look on this: http://cppcms.com/wikipp/en/page/cppcms_1x_config#daemon(b) you can define user the service runs under in the same section @Marcel nginx can't start/stop fastcgi service by his own... one of the reasons I really don't like it so you need to configure the service independently. BTW it uses fastcgi according to the backtrace Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ From: Marcel Hellwig <ke...@co...> To: cpp...@li... Sent: Monday, March 16, 2015 11:48 AM Subject: Re: [Cppcms-users] cppblog and systemd I suppose you are trying to use a port below 1024, because that are root only ports. Try to use an other port. Btw: why don't you use nginx as http server and fast_cgi as recommended by [0]? Greetings, Marcel [0] http://cppcms.com/wikipp/en/page/cppcms_1x_tut_web_server_config ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: Artyom B. <art...@ya...> - 2015-03-16 11:02:38
|
Note - you try to use Unix socket factory (not TCP) - make sure you have correct permissions on that socketand you can remove it. Probably it should run under same user as web server - or use TCP/IP instead However just changing the executing user the cppblog crashes with a "address already in use error," here is the log: Failed: system: Address already in use 0x7f146c5f6ebb: booster::system::system_error::system_error(booster::system::error_code const&) + 0x13b in /usr/lib/libcppcms.so.1 0x7f146c2c7bb7: booster::aio::acceptor::bind(booster::aio::endpoint const&) + 0x67 in /usr/lib/libbooster.so.0 0x7f146c6cfce0: cppcms::impl::cgi::fastcgi_api_unix_socket_factory(cppcms::service&, std::string, int) + 0xc0 in /usr/lib/libcppcms.so.1 0x7f146c5f0bac: cppcms::service::setup_acceptor(cppcms::json::value const&, int, int) + 0x68c in /usr/lib/libcppcms.so.1 0x7f146c5f137e: cppcms::service::start_acceptor(bool) + 0x17e in /usr/lib/libcppcms.so.1 0x7f146c5f3e19: cppcms::service::run() + 0x29 in /usr/lib/libcppcms.so.1 0x41d036: main + 0x76 in /usr/bin/cppblog 0x7f146b30e800: __libc_start_main + 0xf0 in /usr/lib/libc.so.6 0x41de39: _start + 0x29 in /usr/bin/cppblog To make the situation even more confusing, if I try to execute via command line with sudo -u it works fine... What am I doing wrong? Any idea of what I can try? ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: Paolo B. <pao...@gm...> - 2015-03-16 11:39:43
|
I am using nginx, but I need to start the cppcms application separately. Am I wrong? On Mon, Mar 16, 2015 at 10:48 AM, Marcel Hellwig <ke...@co...> wrote: > I suppose you are trying to use a port below 1024, because that are root > only ports. Try to use an other port. > > Btw: why don't you use nginx as http server and fast_cgi as recommended > by [0]? > > Greetings, > Marcel > > [0] http://cppcms.com/wikipp/en/page/cppcms_1x_tut_web_server_config > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
|
From: Paolo B. <pao...@gm...> - 2015-03-16 11:43:38
|
Sorry, the answer was meant to Marcel, the other email were eaten by gmail spam filter... On Mon, Mar 16, 2015 at 12:39 PM, Paolo Bolzoni <pao...@gm...> wrote: > I am using nginx, but I need to start the cppcms application > separately. Am I wrong? > > On Mon, Mar 16, 2015 at 10:48 AM, Marcel Hellwig <ke...@co...> wrote: >> I suppose you are trying to use a port below 1024, because that are root >> only ports. Try to use an other port. >> >> Btw: why don't you use nginx as http server and fast_cgi as recommended >> by [0]? >> >> Greetings, >> Marcel >> >> [0] http://cppcms.com/wikipp/en/page/cppcms_1x_tut_web_server_config >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub for all >> things parallel software development, from weekly thought leadership blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> |
|
From: Tolga H. <fas...@gm...> - 2015-03-16 11:48:19
|
What is your configuration lines about fcgi port? Does http have permissions for /var/blog and such? Do you execute via su command in /var/blog? On Mon, Mar 16, 2015, 13:40 Paolo Bolzoni <pao...@gm...> wrote: > I am using nginx, but I need to start the cppcms application > separately. Am I wrong? > > On Mon, Mar 16, 2015 at 10:48 AM, Marcel Hellwig <ke...@co...> > wrote: > > I suppose you are trying to use a port below 1024, because that are root > > only ports. Try to use an other port. > > > > Btw: why don't you use nginx as http server and fast_cgi as recommended > > by [0]? > > > > Greetings, > > Marcel > > > > [0] http://cppcms.com/wikipp/en/page/cppcms_1x_tut_web_server_config > > > > > > ------------------------------------------------------------ > ------------------ > > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > > by Intel and developed in partnership with Slashdot Media, is your hub > for all > > things parallel software development, from weekly thought leadership > blogs to > > news, videos, case studies, tutorials and more. Take a look and join the > > conversation now. http://goparallel.sourceforge.net/ > > _______________________________________________ > > Cppcms-users mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > ------------------------------------------------------------ > ------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
|
From: Marius C. <mf...@gm...> - 2015-03-16 11:49:02
|
Yes, you are wrong. Cppcms is an application only when it runs using the internal web server. This is however only recommended for debugging right now. You could also use the internal sever if you really, really need it on an embedded device which has too little memory but otherwise cppcms is just a library that nginx will call just as it calls other extensions like php ( you don't need to start php, do you ). This is my understanding of things I've read in the official docs which I really recommend reading a bit, they will help clear up some things. On Mon, Mar 16, 2015 at 1:39 PM, Paolo Bolzoni <pao...@gm...> wrote: > I am using nginx, but I need to start the cppcms application > separately. Am I wrong? > > On Mon, Mar 16, 2015 at 10:48 AM, Marcel Hellwig <ke...@co...> wrote: >> I suppose you are trying to use a port below 1024, because that are root >> only ports. Try to use an other port. >> >> Btw: why don't you use nginx as http server and fast_cgi as recommended >> by [0]? >> >> Greetings, >> Marcel >> >> [0] http://cppcms.com/wikipp/en/page/cppcms_1x_tut_web_server_config >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub for all >> things parallel software development, from weekly thought leadership blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: Paolo B. <pao...@gm...> - 2015-03-16 11:59:56
|
The documentation states "Nginx supports only FastCGI protocol with external application start." And this is what I wanted to do with systemd, ensure that before nginx is executed cppblog also is. On Mon, Mar 16, 2015 at 12:48 PM, Marius Cirsta <mf...@gm...> wrote: > Yes, you are wrong. Cppcms is an application only when it runs using > the internal web server. This is however only recommended for > debugging right now. You could also use the internal sever if you > really, really need it on an embedded device which has too little > memory but otherwise cppcms is just a library that nginx will call > just as it calls other extensions like php ( you don't need to start > php, do you ). > > This is my understanding of things I've read in the official docs > which I really recommend reading a bit, they will help clear up some > things. > > > On Mon, Mar 16, 2015 at 1:39 PM, Paolo Bolzoni > <pao...@gm...> wrote: >> I am using nginx, but I need to start the cppcms application >> separately. Am I wrong? >> >> On Mon, Mar 16, 2015 at 10:48 AM, Marcel Hellwig <ke...@co...> wrote: >>> I suppose you are trying to use a port below 1024, because that are root >>> only ports. Try to use an other port. >>> >>> Btw: why don't you use nginx as http server and fast_cgi as recommended >>> by [0]? >>> >>> Greetings, >>> Marcel >>> >>> [0] http://cppcms.com/wikipp/en/page/cppcms_1x_tut_web_server_config >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >>> by Intel and developed in partnership with Slashdot Media, is your hub for all >>> things parallel software development, from weekly thought leadership blogs to >>> news, videos, case studies, tutorials and more. Take a look and join the >>> conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Cppcms-users mailing list >>> Cpp...@li... >>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub for all >> things parallel software development, from weekly thought leadership blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: Marius C. <mf...@gm...> - 2015-03-16 12:46:27
|
Turns our you're right, my apologies ... One question though, when did you get that error ? Was it when booting or did you just start the service manually ? I also assume you made sure all previous instances were dead ? That could also be an issue. On Mon, Mar 16, 2015 at 1:59 PM, Paolo Bolzoni <pao...@gm...> wrote: > The documentation states "Nginx supports only FastCGI protocol with > external application start." > And this is what I wanted to do with systemd, ensure that before nginx > is executed cppblog also is. > > On Mon, Mar 16, 2015 at 12:48 PM, Marius Cirsta <mf...@gm...> wrote: >> Yes, you are wrong. Cppcms is an application only when it runs using >> the internal web server. This is however only recommended for >> debugging right now. You could also use the internal sever if you >> really, really need it on an embedded device which has too little >> memory but otherwise cppcms is just a library that nginx will call >> just as it calls other extensions like php ( you don't need to start >> php, do you ). >> >> This is my understanding of things I've read in the official docs >> which I really recommend reading a bit, they will help clear up some >> things. >> >> >> On Mon, Mar 16, 2015 at 1:39 PM, Paolo Bolzoni >> <pao...@gm...> wrote: >>> I am using nginx, but I need to start the cppcms application >>> separately. Am I wrong? >>> >>> On Mon, Mar 16, 2015 at 10:48 AM, Marcel Hellwig <ke...@co...> wrote: >>>> I suppose you are trying to use a port below 1024, because that are root >>>> only ports. Try to use an other port. >>>> >>>> Btw: why don't you use nginx as http server and fast_cgi as recommended >>>> by [0]? >>>> >>>> Greetings, >>>> Marcel >>>> >>>> [0] http://cppcms.com/wikipp/en/page/cppcms_1x_tut_web_server_config >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >>>> by Intel and developed in partnership with Slashdot Media, is your hub for all >>>> things parallel software development, from weekly thought leadership blogs to >>>> news, videos, case studies, tutorials and more. Take a look and join the >>>> conversation now. http://goparallel.sourceforge.net/ >>>> _______________________________________________ >>>> Cppcms-users mailing list >>>> Cpp...@li... >>>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >>> by Intel and developed in partnership with Slashdot Media, is your hub for all >>> things parallel software development, from weekly thought leadership blogs to >>> news, videos, case studies, tutorials and more. Take a look and join the >>> conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Cppcms-users mailing list >>> Cpp...@li... >>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub for all >> things parallel software development, from weekly thought leadership blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: Paolo B. <pao...@gm...> - 2015-03-16 15:01:39
|
The problem is if I type: $ sudo -u http cppblog -c config.js & and start nginx is works fine. If I start it via systemd using the .service file *without* user it starts fine, but as root. If I start it with the user setting it crashes. Probably systemd does something strange to change the user. Oh, well. I'll try again later with Artyom suggestion. Or I'll simply move to lighttpd... On Mon, Mar 16, 2015 at 1:46 PM, Marius Cirsta <mf...@gm...> wrote: > Turns our you're right, my apologies ... One question though, when > did you get that error ? Was it when booting or did you just start the > service manually ? > I also assume you made sure all previous instances were dead ? That > could also be an issue. > > On Mon, Mar 16, 2015 at 1:59 PM, Paolo Bolzoni > <pao...@gm...> wrote: >> The documentation states "Nginx supports only FastCGI protocol with >> external application start." >> And this is what I wanted to do with systemd, ensure that before nginx >> is executed cppblog also is. >> >> On Mon, Mar 16, 2015 at 12:48 PM, Marius Cirsta <mf...@gm...> wrote: >>> Yes, you are wrong. Cppcms is an application only when it runs using >>> the internal web server. This is however only recommended for >>> debugging right now. You could also use the internal sever if you >>> really, really need it on an embedded device which has too little >>> memory but otherwise cppcms is just a library that nginx will call >>> just as it calls other extensions like php ( you don't need to start >>> php, do you ). >>> >>> This is my understanding of things I've read in the official docs >>> which I really recommend reading a bit, they will help clear up some >>> things. >>> >>> >>> On Mon, Mar 16, 2015 at 1:39 PM, Paolo Bolzoni >>> <pao...@gm...> wrote: >>>> I am using nginx, but I need to start the cppcms application >>>> separately. Am I wrong? >>>> >>>> On Mon, Mar 16, 2015 at 10:48 AM, Marcel Hellwig <ke...@co...> wrote: >>>>> I suppose you are trying to use a port below 1024, because that are root >>>>> only ports. Try to use an other port. >>>>> >>>>> Btw: why don't you use nginx as http server and fast_cgi as recommended >>>>> by [0]? >>>>> >>>>> Greetings, >>>>> Marcel >>>>> >>>>> [0] http://cppcms.com/wikipp/en/page/cppcms_1x_tut_web_server_config >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >>>>> by Intel and developed in partnership with Slashdot Media, is your hub for all >>>>> things parallel software development, from weekly thought leadership blogs to >>>>> news, videos, case studies, tutorials and more. Take a look and join the >>>>> conversation now. http://goparallel.sourceforge.net/ >>>>> _______________________________________________ >>>>> Cppcms-users mailing list >>>>> Cpp...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >>>> by Intel and developed in partnership with Slashdot Media, is your hub for all >>>> things parallel software development, from weekly thought leadership blogs to >>>> news, videos, case studies, tutorials and more. Take a look and join the >>>> conversation now. http://goparallel.sourceforge.net/ >>>> _______________________________________________ >>>> Cppcms-users mailing list >>>> Cpp...@li... >>>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >>> by Intel and developed in partnership with Slashdot Media, is your hub for all >>> things parallel software development, from weekly thought leadership blogs to >>> news, videos, case studies, tutorials and more. Take a look and join the >>> conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Cppcms-users mailing list >>> Cpp...@li... >>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub for all >> things parallel software development, from weekly thought leadership blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |