Jump to content
  • 0

Provisioning Plesk Accounts On Same Server As Blesta Is Not Possible


Max

Question

Not sure if this is a supported configuration, but for testing purposes I'm trying to provision a Plesk webhosting account on the same Plesk server Blesta is running on.

Problem is that Plesk has the nasty habit of restarting Apache every time a new website is added to the system.

So when I activate a new Plesk order through the Blesta admin interface with "use module" checked, this causes Plesk to restart Apache, and this kills all connections and the running Blesta PHP process.

[Sat Apr 26 22:22:06 2014] [notice] caught SIGTERM, shutting down
[Sat Apr 26 22:22:15 2014] [error] FastCGI process 14718 still did not exit, terminating forcefully

Receive an error in my browser ("502 Bad gateway" returned by the nginx reverse proxy in front of Apache, indicating connection to Apache was lost)

And that Plesk succeeded adding the website is not registered in Blesta, module log shows webspace:add was last API command sent, and no reply registered.

 

Not sure if Plesk is the only hosting panel affected by this, or others may have the same problem as well.

May be better to postpone the creation of new hosting accounts until next cron run, and provision them from there.

Link to comment
Share on other sites

16 answers to this question

Recommended Posts

  • 0

Unfortunately, there's no workaround. Plesk is killing Blesta while it's in the middle of performing a task. If you could configure plesk not to restart apache, or if you ran blesta under a different web server (nginx/lighttpd/etc.) or entirely separate server you probably wouldn't have any problems.

Link to comment
Share on other sites

  • 0

Another ugly workaround may be for Blesta not to wait for the response from Plesk (which doesn't come until after Apache has been restarted)

There are 9 seconds between the moment Apache is asked to terminate nicely, and it forcible kills the PHP FastCGI process.

So it does have time to simply mark the service active, if no negative response is received within a second or so.

 

Only problem is that it then is not able to store the newly created webspace id returned by Plesk.

But think that can be retrieved by domain name later on.

Link to comment
Share on other sites

  • 0

Another thought: you could allow cron to provision as it runs outside of apache and so should not be affected.

 

Yeah, marking the invoice paid, and let cron deal with it does create it ok.

Just a bit annoying. Not only occurs on creation, but also on other admin actions like suspend/delete.

Link to comment
Share on other sites

  • 0

Thanks.

 

 

Tried setting the restart interval to 300.

That seems to work sufficiently for my testing purposes, but be aware that it is not a solution one could recommend to other customers wanting to put this in production.

 

It seems that Plesk doesn't treat a "Apache restart interval" of 300 as "restart Apache 5 minutes after a change" but as "restart Apache at most every 5 minutes"

 

  •  First request from Blesta to Plesk still sends SIGTERM to Apache instantly
  •  If you have an ongoing stream of subsequent requests those are all handled fine.
  •  If you do nothing for 10 minutes, the next request from Blesta to Plesk will send SIGTERM instantly again.
Link to comment
Share on other sites

  • 0

Hello,

 

I would like to know if with the recent version of Blesta and Plesk 12 this problem is still happening when blesta is installed on the same server than plesk. May be it's a bug for only old version as the post is old. 

 

Regards,

No it is still happen and if you ask me you should never put your website and billing script on same server with users,first thing is security but even if you secure it there is also issue when server is offline...not only client sites are down but they can't even open ticket or see update because with them your site is also down.They will  not see that as very profesional behave(I wouldn't),you should make your website independent and in case server or network fail(will fail sometime trust me) you can communicate with your clients.Plesk has built in Nginx support,by default it is used as proxy but you can use it to serve everything  insted Apache,just one tips...before switch, install apache to nginx .htaccess auto converter extension,you can find it in extensions.At this way all apache  .htaccess rules will work without touching anything.

I didn't try this and I don't know for sure does switching to Nginx will stop killing process but it could work.

Link to comment
Share on other sites

  • 0

I explore this whole thing and find out that Plesk doesn't use Apache graceful restart,because of this every time something is changed Plesk will restart Apache and kill all process,now Plesk KB provide steps how to change this and use Apache gradeful restart and it could work in this situation,or at least it should provide more time for Blesta to get response.I will try this tomorow myself and also try to use Nginx only and i will post results.

 

To enable graceful restart, you should add the parameter "restart_apache_gracefully" with a "true" value to the "misc" table of the "psa" database. For that:

  1. Log in to the Plesk database:

    mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa
  2. Apply the following SQL query:

    mysql> INSERT INTO misc VALUES ('restart_apache_gracefully', 'true');
Link to comment
Share on other sites

  • 0

Hi Nelsa,

 

I recently posted a solution for this issue a few days back in the Contribute section, maybe you missed it. And it is exactly the solution you finally got to. Check this:

 

http://www.blesta.com/forums/index.php?/topic/6246-plesk-issues-with-apache-restarts/

 

I am wondering how still most people haven't got to grips with this issue as yet, as the solution is already documented on the official Plesk site...maybe the Plesk KB need to update their article titles to be more specific to the issue rather than just "How to enable Apache graceful restart in Plesk".

 

Thanks.

Link to comment
Share on other sites

  • 0

W

 

Hi Nelsa,

 

I recently posted a solution for this issue a few days back in the Contribute section, maybe you missed it. And it is exactly the solution you finally got to. Check this:

 

http://www.blesta.com/forums/index.php?/topic/6246-plesk-issues-with-apache-restarts/

 

I am wondering how still most people haven't got to grips with this issue as yet, as the solution is already documented on the official Plesk site...maybe the Plesk KB need to update their article titles to be more specific to the issue rather than just "How to enable Apache graceful restart in Plesk".

 

Thanks.

Well my website is hosted on independent sistem and I didn't have this issue,to be honest I wouldn't know it exist if I didn't see this thread and I simple missed your thread.Like I said i don't recommend anyone to host main site at any  production server,main website with billing and support sistem should be online when production server is not,it is not nice filing when your site is offline and you visit provider site to find out what is issue....and it is also offline.now I will test also first solution with Nginx simple because resellers don't have permision to change apache restart intervals and they can't edit plesk database,but they can switch from Apache to Nginx on domain level.

Link to comment
Share on other sites

  • 0

Hah..I providde Plesk for years and now I first time try to use auto install extension...Plesk is excellent hosting panel but I must admit Aplication auto installer is worst I ever use(try to use)..well I mean when it comes to scripts they offer for auto install.extension it self is excellent with advanced toolkit.But they miss so many popular scripts....so much sponsored and scripts end users and resellers can't install at all....and most of them are not in top 1000 most popular..but there is not Blesta and most other popular billing  scripts...I will have to install it by foot to try these solutions....while I don't need to change anything for myself maybe some of the resellers will try to use blesta on same account.

Link to comment
Share on other sites

  • 0

I second what you say about keeping the main site along with billing/support seperate from the Provisioning Server(Plesk/cPanel/Proxmox) and is the most ideal setup. But, it would also mean having the added burden of managing & maintaining multiple servers in the setup.

 

Also, small/budget businesses often have only limited resources at their disposal so, it makes sense to have everything bundled within one server which makes it easier for them to maintain just that one server.

 

The option to have both Plesk & Blesta(or any other billing) on the same box would appeal to those with limited resources or for those having a limited number of Plesk clients. And the solution to restart apache gracefully should work smoothly & efficiently even under heavy workload, provided your server is capable of handling such tasks.

 

I do not know how the Nginx solution would resolve the issue and I would be interested with your test results.

 

Thanks.

Link to comment
Share on other sites

  • 0

Results:

 

1)

Editing Plesk database and setting graceful restart will work and i tryed 10 times ,every time Account created completly,without editing database it just create user without subscription.

2)

Switching to Nginx only partialy worked...well can say didn't worked at all and you will have issue with .htaccess directives,I recommand installing nginx to .htaccess auto converter extension,very nice extension that allows any nginx or Apache directives to work without converting and editing anything.

Extension can be installed simple by visiting Extensions-->Extension Catalog

After installation every directive  will be served what ever configuration you have.

And wired thing is that Nginx is also restarted just like Apache and if you add service manualy you'll see actualy how server go offline but on Plesk side account and subscription is created successfully but of course problem is Blesta didn't get response and service is not added to client,need to add it without "module checkbox selected" manualy.

 

Now in my case without editing PSA database Plesk couldn't finish creating account at all,it just add customer without subscription.After switching to Nginx  Plesk succeed to create account and subscription, but since switching to Nginx didn't change Plesk behave blesta still didn't get response and service ,while exist in Plesk,in Blesta not.

I would love to find solution that doesn't require Administrator permissions,since resellers will not be able to implement two working solutions,till than they can at least ask provider to implement it and point provider to working solution.

Link to comment
Share on other sites

  • 0

Thanks for the results.

 

I think the "Apache with graceful restarts" would be a safe bet rather than the nginx one. It is much more straight forward and does not need additional extensions to get the job done.

 

By the way you should not be surprised to see Nginx restarting, since Plesk would restart the web server(Apache/Nginx) by default for any changes made according to the "Apache restart interval" setting.

 

The guys at Plesk should rather update the default behaviour of Plesk to rather restart Apache gracefully and just get done with the issue. I am not sure what is actually holding them back from such a change.

 

Thanks.

Link to comment
Share on other sites

  • 0

Hi,I'm not surprised..since I know how plesk work I expect nginx to be restarted,I hoped time frame will not be the same(I was right  but it is not as blesta need) because half second may let blesta to finish task....nginx to .htaccess converter is recommanded,since switching from Nginx to Apache and vice versa is done on domain level and with just one click  ,having this extension will allow your clients(if you give them permission) to switch without thinking about directives.Now of course if you didn't give permissions to users and resellers to change hosting settings and you don't use  Nginx than you don't need it at all.

When it comes to graceful restart,yes it is working solution  but like I say it would be nice to have solution that can be implemented without Admin permissions,for resellers. As you probably know providers are not always willing to edit even config. file or settings through GUI.And to be honest today is everyone hosting provider..buy cPanel  and WHCMS and fire :)....probably there is bunch of them that don't dare even log in through console.

Any way I don't think Plesk will implement graceful restart by default,it is not first option  and sometimes it can lead to some errors,it is used as default option when need it , but that is different story

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...