-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -524,5 +524,3 @@ volumes: | |
| generated-config: | ||
| generated-metadata: | ||
| mariadb-data: | ||
|
|
||
|
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <?php | ||
| require_once '/vendor/autoload.php'; | ||
| use PhpAmqpLib\Connection\AMQPStreamConnection; | ||
|
|
||
| $connection = new AMQPStreamConnection('mq', 5672, 'guest', 'password'); | ||
| $channel = $connection->channel(); | ||
|
|
||
| $channel->queue_declare('refreshInstance', false, false, false, false); | ||
|
|
||
| echo " [*] Waiting for messages. To exit press CTRL+C\n"; | ||
|
|
||
| $callback = function ($msg) { | ||
| echo ' [x] Received ', $msg->body, "\n"; | ||
| if ($msg->body == "REFRESH_THIS_INSTANCE") { | ||
| echo "Received REFRESH message!\n"; | ||
| shell_exec( "/csp-tap/InCommonTAP-Examples/Workbench/scripts/refresh-this-instance.sh" ); | ||
| } | ||
| }; | ||
|
|
||
| $channel->basic_consume('refreshInstance', '', false, true, false, false, $callback); | ||
|
|
||
| while ($channel->is_consuming()) { | ||
| $channel->wait(); | ||
| } | ||
|
|
||
| $channel->close(); | ||
| $connection->close(); | ||
| ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
Workbench/webproxy/container_files/httpd/refresh/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title>Refresh Instance</title> | ||
| </head> | ||
| <body> | ||
| <img src="../csp_logo.jpg"><br/> | ||
| <?php | ||
| require_once '/vendor/autoload.php'; | ||
| use PhpAmqpLib\Connection\AMQPStreamConnection; | ||
| use PhpAmqpLib\Message\AMQPMessage; | ||
|
|
||
| if ($_POST["confirm"] != "") { | ||
| $btn_disabled = true; | ||
| } | ||
| ?> | ||
| <?php | ||
| if ($btn_disabled != true) { ?> | ||
|
|
||
| Are you sure you want to refresh this instance? It will be unavailable while refreshing. | ||
| <br /><br /> | ||
| Please type in the hostname of this instance to confirm you want to refresh. | ||
| <br /><br /> | ||
|
|
||
| <form method = "POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> | ||
| Confirmation: <input type="text" name="confirm" id="confirm" value="<?php echo $confirm;?>"> | ||
| <br /><br /> | ||
| <button type = "submit" id = "btn-submit">Confirm</button> | ||
| </form> | ||
| <?php | ||
| } | ||
|
|
||
| if ($_SERVER["REQUEST_METHOD"] === 'POST') { | ||
| if (strcmp($_POST["confirm"], getenv("CSPHOSTNAME")) == 0) { | ||
| echo "Your request to refresh this instance is confirmed. <br/><br/>The refresh will start immediately (" . date("h:i:sa") . " GMT)."; | ||
|
|
||
|
|
||
| $connection = new AMQPStreamConnection('mq', 5672, 'guest', 'password'); | ||
| $channel = $connection->channel(); | ||
|
|
||
| $channel->queue_declare('refreshInstance', false, false, false, false); | ||
|
|
||
| $msg = new AMQPMessage('REFRESH_THIS_INSTANCE'); | ||
| $channel->basic_publish($msg, '', 'refreshInstance'); | ||
|
|
||
| $channel->close(); | ||
| $connection->close(); | ||
|
|
||
| } else { | ||
| echo "Invalid confirmation. Please re-try using your actual hostname."; | ||
| } | ||
| } | ||
| ?> | ||
|
|
||
| </body> | ||
| </html> |