Compare commits
No commits in common. "c63245ff3c44de0751fb4ae34cda421a86262c0d" and "d2b0c4651093e558b2f015dfe4715732c79b8073" have entirely different histories.
c63245ff3c
...
d2b0c46510
|
@ -1 +0,0 @@
|
||||||
*.swp
|
|
31
README.md
31
README.md
|
@ -27,19 +27,6 @@ This repository will be automagically pulled by the web server each time somethi
|
||||||
|
|
||||||
Dear Developers, Please use pushes sparingly because it takes a while for the server to replace all code variables.
|
Dear Developers, Please use pushes sparingly because it takes a while for the server to replace all code variables.
|
||||||
|
|
||||||
What this thing does basicalle equates to:
|
|
||||||
```
|
|
||||||
ssh <user>@<threadr.ip|no public access set up currently>
|
|
||||||
cd /var/www/git
|
|
||||||
sudo -u www-data -s
|
|
||||||
rm -rf ./web-deployment
|
|
||||||
git clone <ssh git repository link>
|
|
||||||
cd web-deployment
|
|
||||||
./deployment-script
|
|
||||||
exit
|
|
||||||
logout
|
|
||||||
```
|
|
||||||
|
|
||||||
## Symlinks
|
## Symlinks
|
||||||
The following files and directories are linked to areas where they can be accessed by the web server:
|
The following files and directories are linked to areas where they can be accessed by the web server:
|
||||||
* `threadr/` → `threadr.lostcave.ddnss.de/threadr/` (all files acessible by the web server, READMEs get deleted on deployment)
|
* `threadr/` → `threadr.lostcave.ddnss.de/threadr/` (all files acessible by the web server, READMEs get deleted on deployment)
|
||||||
|
@ -64,6 +51,24 @@ The main index.html on the server. It redirects to ThreadR.
|
||||||
This script is executed each time (or most of the time) the repository gets pushed.
|
This script is executed each time (or most of the time) the repository gets pushed.
|
||||||
It contains the commands to execute the code variable replcement system and some other useful tasks.
|
It contains the commands to execute the code variable replcement system and some other useful tasks.
|
||||||
Its working directory is the root of the git repository.
|
Its working directory is the root of the git repository.
|
||||||
|
### [strassenkind.php](./strassenkind.php), [internal.css](./internal.css), [commands_status.conf](./commands_status.conf), [commands_ondemand.conf](./commands_ondemand.conf), [commands_git.conf](./commands_git.conf)
|
||||||
|
~~The internal status page. strassenkind.php is the index, internal.css is the stylesheet strassenkind.php uses
|
||||||
|
and the .conf files are lists of commands to be executed by the status page. The status page auto-refreshes to display up-to-date information on the commands in commands_status.conf.
|
||||||
|
It is advised to put commands that have a high disk usage or start/stop/restart/reload system services etc. on the commands_ondemand.conf file as the ondemand status page does not auto-refresh.
|
||||||
|
The file commands_git.conf contains the commands that would be executed by the deployment WebHook. These are there to provide a fast and simple backup solution.
|
||||||
|
The alternative to foce-updating ThreadR via the status page would be:~~
|
||||||
|
```
|
||||||
|
ssh <user>@<threadr.ip|no public access set up currently>
|
||||||
|
cd /var/www/git
|
||||||
|
sudo -u www-data -s
|
||||||
|
rm -rf ./web-deployment
|
||||||
|
git clone <ssh git repository link>
|
||||||
|
cd web-deployment
|
||||||
|
./deployment-script
|
||||||
|
exit
|
||||||
|
logout
|
||||||
|
```
|
||||||
|
DEPRECATED: The administration framework will be turned into its own project and completely overhauled.
|
||||||
### [LICENSE.md](./LICENSE.md)
|
### [LICENSE.md](./LICENSE.md)
|
||||||
A copy of the Apache 2.0 license, the license this project is under
|
A copy of the Apache 2.0 license, the license this project is under
|
||||||
### [NOTICE](./NOTICE)
|
### [NOTICE](./NOTICE)
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
echo "pushd /var/www/git/; rm -rvf web-deployment; git clone git@strassenkind.ip:root/web-deployment.git; popd" | bash -
|
||||||
|
echo "pushd /var/www/git/web-deployment; chmod +x deployment-script.sh; ./deployment-script.sh; popd" | bash -
|
|
@ -0,0 +1,2 @@
|
||||||
|
sync
|
||||||
|
echo `cat /var/log/apt-get_update_has_run` "\n"; apt list --upgradable
|
|
@ -0,0 +1,15 @@
|
||||||
|
uptime
|
||||||
|
free -h
|
||||||
|
df -h
|
||||||
|
cat /var/run/reboot-required
|
||||||
|
who
|
||||||
|
sensors
|
||||||
|
|
||||||
|
systemctl status apache2.service
|
||||||
|
systemctl status sshd.service
|
||||||
|
systemctl status gitea.service
|
||||||
|
systemctl status mysql.service
|
||||||
|
systemctl status FAHClient.service
|
||||||
|
|
||||||
|
tail -n 20 /var/www/admin.strassenkind.ip/stdout.log
|
||||||
|
tail -n 20 /var/www/admin.strassenkind.ip/stderr.log
|
|
@ -0,0 +1,61 @@
|
||||||
|
body {
|
||||||
|
background-color: #B6BDBD;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* code blocks */
|
||||||
|
pre {
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-right: 20px;
|
||||||
|
margin-top: 0px;
|
||||||
|
background-color: white;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #888A85;
|
||||||
|
border-width: 1px;
|
||||||
|
font-size: 11pt;
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
pre.commandLine {
|
||||||
|
background-color: #2E3436;
|
||||||
|
color: #C3F097;
|
||||||
|
}
|
||||||
|
/* in-line code block */
|
||||||
|
span.codeBlockInText{
|
||||||
|
background-color: white;
|
||||||
|
border-color: black;
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 1px;
|
||||||
|
font-size: 11pt;
|
||||||
|
font-family: monospace;
|
||||||
|
padding-left: 5px;
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
/* code highlighting */
|
||||||
|
span.structure {
|
||||||
|
color: #FCAF3E;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
span.primitive {
|
||||||
|
color: #729FCF;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
span.className {
|
||||||
|
color: #8AE234;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
span.type {
|
||||||
|
color: #729FCF;
|
||||||
|
}
|
||||||
|
span.value {
|
||||||
|
color: #C17D11;
|
||||||
|
}
|
||||||
|
span.function {
|
||||||
|
color: #75507B;
|
||||||
|
}
|
||||||
|
span.name {
|
||||||
|
color: #8AE234;
|
||||||
|
}
|
||||||
|
span.comment {
|
||||||
|
color: #888A85;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
<?php
|
||||||
|
function get_command_list($command_file_name){
|
||||||
|
echo "Getting commands from file $command_file_name...\n";
|
||||||
|
$command_file = fopen($command_file_name, "r") or die("Could not read file $command_file_name. Aborting.\n");
|
||||||
|
$commands = explode(PHP_EOL, fread($command_file, filesize($command_file_name)));
|
||||||
|
fclose($command_file);
|
||||||
|
echo "Done.\n";
|
||||||
|
return $commands;
|
||||||
|
}
|
||||||
|
|
||||||
|
$status_commands = get_command_list("commands_status.conf");
|
||||||
|
$ondemand_commands = get_command_list("commands_ondemand.conf");
|
||||||
|
$git_commands = get_command_list("commands_git.conf");
|
||||||
|
?>
|
||||||
|
-->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title> Strassenkind Server Status Page </title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||||
|
<?php
|
||||||
|
if (!isset($_POST['ondemand']) && !isset($_POST['git'])) {
|
||||||
|
echo "<meta http-equiv=\"refresh\" content=\"20\" />";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</head>
|
||||||
|
<body class="status_page">
|
||||||
|
<h1> Strassenkind Server Status </h1>
|
||||||
|
<hr />
|
||||||
|
<?php
|
||||||
|
function add_button($button_text, $button_action){
|
||||||
|
if (!isset($_POST[$button_action])) {
|
||||||
|
echo "<form action=\"\" method=\"post\"><input type=\"submit\" value=\"$button_text\" name=\"$button_action\" /></form>";
|
||||||
|
} else {
|
||||||
|
echo "<a href=\"\"><button> Return to regular status commands </button></a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
add_button("Run ondemand commands", "ondemand");
|
||||||
|
add_button("Force ThreadR update", "git");
|
||||||
|
?>
|
||||||
|
<hr />
|
||||||
|
<?php
|
||||||
|
function execute_command_list($commands){
|
||||||
|
foreach ($commands as $command) {
|
||||||
|
if ($command != ""){
|
||||||
|
// === is here on purpose.
|
||||||
|
if (strpos($command, '>') === false) {
|
||||||
|
$command = $command . " 2>&1";
|
||||||
|
}
|
||||||
|
$output = shell_exec($command);
|
||||||
|
echo "<pre class=\"commandLine\"> " . htmlspecialchars($command, $flags=ENT_DISALLOWED | ENT_HTML5 | ENT_QUOTES) . " </pre>\n<pre class=\"commandLine\"> " . htmlspecialchars($output, $flags=ENT_DISALLOWED | ENT_HTML5 | ENT_QUOTES) . " </pre>\n<hr />";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// run ondemand command list if demanded
|
||||||
|
if (isset($_POST['ondemand'])) {
|
||||||
|
execute_command_list($ondemand_commands);
|
||||||
|
} elseif (isset($_POST['git'])) {
|
||||||
|
execute_command_list($git_commands);
|
||||||
|
} else {
|
||||||
|
//run status command list otherwise
|
||||||
|
execute_command_list($status_commands);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue