Skip to content

fixes for refresh #109

Merged
merged 1 commit into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Workbench/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ services:
- net
ports:
- 15672:15672
- 5672:5672
healthcheck:
test: curl -s 127.0.0.1:15672 > /dev/null
interval: 30s
Expand Down
8 changes: 6 additions & 2 deletions Workbench/scripts/refreshListener.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
require_once '/vendor/autoload.php';
require_once '/home/csprootuser/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;

$connection = new AMQPStreamConnection('mq', 5672, 'guest', 'password');
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'password');
$channel = $connection->channel();

$channel->queue_declare('refreshInstance', false, false, false, false);
Expand All @@ -15,6 +15,10 @@
echo "Received REFRESH message!\n";
shell_exec( "/csp-tap/InCommonTAP-Examples/Workbench/scripts/refresh-this-instance.sh" );
}
if ($msg->body == "REFRESH_THIS_INSTANCE_DELETE_DATA") {
echo "Received REFRESH-DELETE message!\n";
shell_exec( "/csp-tap/InCommonTAP-Examples/Workbench/scripts/refresh-this-instance.sh -dv" );
}
};

$channel->basic_consume('refreshInstance', '', false, true, false, false, $callback);
Expand Down
1 change: 1 addition & 0 deletions Workbench/webproxy/container_files/httpd/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ <h3>Welcome to the InCommon TAP Workbench!</h3>
</ul>
<br /><br /><br />
<a href="https://__CSPHOSTNAME__/status" target="TAP-WB-STATUS">Container Status</a>
<br />
<a href="https://__CSPHOSTNAME__/refresh/" target="TAP-WB-REFRESH">Refresh this instance</a>


11 changes: 9 additions & 2 deletions Workbench/webproxy/container_files/httpd/refresh/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
<br /><br />

<form method = "POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
Confirmation: <input type="text" name="confirm" id="confirm" value="<?php echo $confirm;?>">
Confirmation: <input type="text" name="confirm" id="confirm" value="<?php echo $confirm;?>"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="delvol" id="delvol" value="delvol">
<label for="delvol">Delete data volumes during refresh?</label>

<br /><br />
<button type = "submit" id = "btn-submit">Confirm</button>
</form>
Expand All @@ -40,7 +43,11 @@

$channel->queue_declare('refreshInstance', false, false, false, false);

$msg = new AMQPMessage('REFRESH_THIS_INSTANCE');
if (isset($_POST["delvol"])) {
$msg = new AMQPMessage('REFRESH_THIS_INSTANCE_DELETE_DATA');
} else {
$msg = new AMQPMessage('REFRESH_THIS_INSTANCE');
}
$channel->basic_publish($msg, '', 'refreshInstance');

$channel->close();
Expand Down