Triggering an old build on buildbot externally? - httprequest

I am running a buildbot buildserver. I have a job my-job that gets triggered each time a git push is made. All builds are kept and can be rebuild when I am logged in. The URL to an old build looks like this:
http://buildbot.internal:8010/builders/my-job/builds/924
Now I need to trigger an old build from a Java HTTP client implementation I have made (e.g http-get), is that possible?
I have not been able to find any documentation for this type of usage.

In Buildbot-0.8.x, the best way to do this is to simulate a click of the "Rebuild" button in the web UI, which means POSTing the data that a web browser would POST for that form.

Related

Automatically Update PM2 Processes

I'm looking to automate how my bots are updated. They're hosted on a VPS from GalaxyGate and kept alive using PM2. I use VSCode to develop them, then I push to GitHub and pull the code from there to the VPS to update them directly in production. However, this currently has to be done manually and I always forget the git commands that I'm supposed to run.
I'm looking to have this process automated; ideally the server would periodically run some sort of script to update all bots that are hosted on it. It would fetch GitHub and apply the new changes (if any) and properly restart the bots, so I have a few questions:
Is this possible, and if so, how would I go about doing that?
Are there any risks/downsides with such a system?
Any help would be appreciated

Trigger more than one URL after IntelliJ Run configuration is run

I have a Run configuration which builds an exploded web app, deploys it to tomcat, and opens the home page after that. However, I want to hit a few URLs to set some state in the app before opening the home page (Or after opening the homepage; it does not matter). Is there a way to trigger a few URL hits after the run configuration? This feature would be similar to "before launch." Instead, it would be "after launch".
There is no such feature at the moment, you can vote for the related feature request.
It's not as simple as it looks since it's not clear what would trigger the after event. The app server doesn't exit/terminate, but is still running, therefore it's not possible to use another run configuration with your app server added in its Before launch steps, otherwise you could create a Shell script configuration that would call curl/wget.
For the app server the proper after event would be the moment when the artifact deployment is complete which requires the tight integration with this specific app server so that IDE knows the exact moment when it happens and allows to call some custom action.
This might be possible with the custom plug-in as IDE already knows when the artifact deployment is complete.
A really hacky workaround would be to run some tiny HTTP server and open its URL from the IDE instead of your real app server. This custom server would call the URLs/APIs you need and then open a browser for your real app URL.

How to terminate an EventSource CGI?

A bit unsure where to look for this one...
Context:
HTML5 web page, that uses HTML5 EventSource / server-side events to get refresh notifications
OpenWrt BarrierBreaker server, running uHTTPd as the web server
a two-level CGI script that provides the server-side events:
the CGI is a shell script (ash, not bash), that parses QUERY_STRING, and calls...
a C application that do the true data extraction (from an SQLite database) and pushes the data to the web page
Everything works, except for a little detail: when the web page is closed,
the C application keeps running. Since it doesn't expect any user input, its current structure is a simple while(1). So after some time, the openwrt box has dozens of copies of the app running.
So the question: how can the application be changed to detect that the client isn't there anymore, and that it should quits?
Thanks
[Edit]
Since posting this a few hours ago, i investigated if the information was somehow available in the script's input stream. It appears it isn't.
I also found http://html5doctor.com/server-sent-events/ that describes a strategy to do exactly this in a Node.js environment, but I have no idea how to translate this in a script-based one.
[/Edit]

Make our own "Application unavailable" page

We need to completly stop our application during an upgrade because we have to execute a critical mysql script.
So our application will be turned off during several minute then Cloudbees will display a basic "Application unavailable" page. We would like to change this by our own page with our logo, like we did it when we have our own apache/tomcat server. Could it be possible ?
Btw, is there a page with active sessions like we have in the Tomcat manager ?
Thanks for your help,
You can use beta-featured blue-green support to switch your application to another instance running a "maintenance" page
with latest SDK (1.3.1), run bees app:proxy:update -a acme-maintenance -al www.acme.com to reconfigure the http router for www.acme.com to the maintenance app, then let your application run the mysql upgrade script, and restore the router configuration after completion.
Warning : this feature is in beta and subject to instabilities / API changes
At the moment there isn't an easy way to do that - but there is a feature which will be out there soon to make that easy (amongst other things).
The only way currently is to have an app (another app) - which is your simple page - you then remove the domain name from your current app and add it to that app (etc) - messy, but possible.
In terms of sessions, the operations tab of the web console shows information like that, there is also the newrelic console which provides other insights.

How to start an application on the server from a webpage

Example:
The user login to the webpage => Click on a button
This action starts the executable "CreatePrettyPicture"
The file "prettypicture.jpg" is created on the server
When the user reloads the page the pretty picture "PrettyPicture.jpg" is shown on the page.
If I could start the application with a parameter it would be even better.
The server is a using Debian and as web server I'm using Apache. Please let me know if you need more information about the server configuration.
The possibility of several users clicking on the button at the same time is not a part of the problem.
You need to read up on CGI Scripts.
It's also possible that PHP is already available on your server, but I wouldn't recommend using it unless you're already familiar with it and know all of the security pitfalls, which from the question appears very unlikely.
You would be better of using a server side script with your apache installation to start the executable. This is probably easier with PHP (which should be easy to install if it isnt already), here are the commands. As long as you dont actually use any input with the page it should be safe enough.