Compare commits

..

No commits in common. "master" and "3.0.11" have entirely different histories.

13 changed files with 5310 additions and 14182 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
node_modules

View File

@ -1,13 +1,13 @@
# PiCluster
![Pic](https://git.poster.place/verita84/picluster/raw/branch/master/images/piclusterLogo.png)
![Pic](https://git.rage.lol/verita84/picluster/raw/branch/master/images/piclusterLogo.png)
PiCluster is a simple way to manage Docker containers on multiple hosts. I created this because I found Docker Swarm not that good and Kubernetes was too difficult to install currently on ARM. PiCluster will only build and run images from Dockerfile's on the host specified in the config file. This software will work on regular x86 hardware also and is not tied to ARM.
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)
![Pic](https://git.poster.place/verita84/picluster/raw/branch/master/images/picluster-mainscreen.png)
![Pic](https://git.rage.lol/verita84/picluster/raw/branch/master/images/picluster-mainscreen.png)
## Features
@ -63,7 +63,7 @@ git clone -b dev https://git.rage.lol/verita84/picluster.git picluster
```
## Config file reference
[See Wiki](https://git.poster.place/verita84/picluster/wiki/Config-Reference)
[See Wiki](https://git.rage.lol/verita84/picluster/wiki/Config-Reference)
## Try PiCluster in Docker
@ -77,38 +77,38 @@ docker-compose up -d
Finally, in your web browser go to <http://127.0.0.1:3003>
## Installation
[See Wiki](https://git.poster.place/verita84/picluster/wiki/Installation)
[See Wiki](https://git.rage.lol/verita84/picluster/wiki/Installation)
## Container Load Balancer
[See Wiki](https://git.rage.lol/verita84/picluster/wiki/Container-Load-Balancer)
## Upgrading
[See Wiki](https://git.poster.place/verita84/picluster/wiki/Upgrading)
[See Wiki](https://git.rage.lol/verita84/picluster/wiki/Upgrading)
## Functions-as-a-Service (FAAS)
[See Wiki](https://git.poster.place/verita84/picluster/wiki/Serverless-%28FaaS%29)
[See Wiki](https://git.rage.lol/verita84/picluster/wiki/Serverless-%28FaaS%29)
<br>
## Configuring and using the command-line client "pictl"
[See Wiki](https://git.poster.place/verita84/picluster/picluster/wiki/Pictl)
[See Wiki](https://github.com/picluster/picluster/wiki/Pictl)
## SSL/TLS
[See Wiki](https://git.poster.place/verita84/picluster/wiki/SSL-Configuration)
[See Wiki](https://git.rage.lol/verita84/picluster/wiki/SSL-Configuration)
## Using pm2 to init PiCluster on systemd
[See Wiki](https://git.poster.place/verita84/picluster/wiki/PM2)
[See Wiki](https://git.rage.lol/verita84/picluster/wiki/PM2)
## Automatic Container failover to other hosts
[See Wiki](https://git.poster.place/verita84/picluster/wiki/Automatic-Container-failover-to-other-hosts)
[See Wiki](https://git.rage.lol/verita84/picluster/wiki/Automatic-Container-failover-to-other-hosts)
# Authors and Contributions
* Project created by [Verita84](https://git.poster.place/verita84).
* Project created by [Verita84](https://rage.lol/verita84).
* [TokinRing](https://github.com/TokinRing), core developer.

View File

@ -1,9 +1,8 @@
# Version 3.0.12
# Version 3.0.11
## New Features:
* Manage Containers: Has a new option called "Commit Image" that allows you to update a Docker image with the current running image.
* Operations: Has a new option called "Edit Hosts" which will let you modify /etc/hosts on the server and then it will be copied to each node.
* SystemD unit file generation for containers to start on Boot (Podman Only).
## Enhancements:
* Added PiCluster version to /nodes API
@ -13,7 +12,7 @@
* ElasticSearch: Support for SSL/TLS
## Removed or Deprecated:
* Auto-starting of containers at boot has been replaced with SystemD Unit files.
* None
## Bug Fixes:
* Docker Swarm fix for adding nodes to existing cluster

View File

@ -355,7 +355,6 @@ app.post('/run', (req, res) => {
node
};
const check_token = req.body.token;
if (check_token !== token) {
@ -369,90 +368,16 @@ app.post('/run', (req, res) => {
output.output = stderr;
} else {
output.output = stdout;
if (config.autostart_containers) {
if (req.body.command.indexOf('docker container run') > -1) {
systemd(req.body.command);
} else if (req.body.command.indexOf('docker container rm') > -1) {
systemd_remove(req.body.command);
}
}
}
res.json(output);
res.json(output);
}, err => {
if (err) {
console.error('error:', err);
}
Console.log('output', output);
// Console.log('output', output);
});
});
function systemd(data) {
const systemd = ["[Unit]", "Description=Container", "After=podman.service", "[Service]", "Type=oneshot", "RemainAfterExit=yes", "Environment=\"NAME=", "ExecStartPre=/bin/sh -c \"/usr/bin/podman rm -f ${NAME}; exit 0;\"", "ExecStartPre=/bin/sh -c \"/usr/bin/podman build -t ${NAME} " + config.docker + "/${NAME}; exit 0;\"", "podman run", "ExecStart=/bin/sh -c \"systemctl restart firewalld.service; exit 0;\"", "ExecStart=/bin/sh -c \"podman network reload -a; exit 0;\"", "ExecStop=/usr/bin/podman rm -f ${NAME}", "[Install]", "WantedBy=multi-user.target"];
var container_name = data.split(' ');
var name = container_name[container_name.length - 1];
for (const unit_file of systemd) {
if (unit_file.indexOf('Unit') > -1) {
console.log(unit_file);
fs.writeFile('/etc/systemd/system/picluster-' + name + '.service', unit_file + '\n', err => {
if (err) {
console.log(err);
}
});
} else if (unit_file.indexOf('NAME=') > -1) {
let analyze_unit_file = 'Environment=\"NAME=' + name + '"';
fs.appendFile('/etc/systemd/system/picluster-' + name + '.service', analyze_unit_file + '\n', err => {
if (err) {
console.log(err);
}
});
} else if (unit_file.indexOf('podman run') > -1) {
end_line = 'ExecStart=/bin/sh -c \"' + data + ';exit 0;\"';
fs.appendFile('/etc/systemd/system/picluster-' + name + '.service', end_line + '\n', err => {
if (err) {
console.log(err);
}
});
} else {
fs.appendFile('/etc/systemd/system/picluster-' + name + '.service', unit_file + '\n', err => {
if (err) {
console.log(err);
}
});
console.log(unit_file);
}
}
exec('systemctl enable picluster-' + name + '.service', (error, stdout, stderr) => {
if (error) {
console.log(error);
}
if (stdout) {
console.log(stdout);
}
});
}
function systemd_remove(data) {
var container_name = data.split(' ');
var name = container_name[container_name.length - 1];
exec('systemctl disable picluster-' + name + '.service', (error, stdout, stderr) => {
if (error) {
console.log(error);
} else {
console.log('\nRemoving picluster-' + name + '.service');
fs.unlink('/etc/systemd/system/picluster-' + name + '.service', error => {
if (error) {
console.log(error);
}
});
}
});
}
if (config.ssl && config.ssl_cert && config.ssl_key) {
console.log('SSL Agent API enabled');
const ssl_options = {
@ -516,6 +441,21 @@ bootstrapNode();
function additional_services() {
monitoring();
if (config.autostart_containers) {
console.log('Starting all the containers.....');
superagent
.get(`${scheme}${server}:${server_port}/start`)
.query({
token: token,
container: '*'
})
.end((err, res) => {
if (err) {
console.log(error);
}
});
}
if (config.vip_ip && config.vip) {
vip = config.vip_ip;
@ -552,4 +492,4 @@ function additional_services() {
});
});
}
}
}

1188
agent/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
"unsafe-perm": true
},
"dependencies": {
"async": "^3.2.4",
"async": "latest",
"body-parser": "latest",
"child-process-promise": "",
"cpu-stats": "latest",

14019
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@
}
},
"devDependencies": {
"xo": "^0.51.0"
"xo": "^0.32.1"
},
"dependencies": {
"eslint": "^7.24.0",

3057
server/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ const {
const {
exec
} = require('child_process');
const version = "3.0.12"
const version = "3.0.11"
const bootstrap = {
status: 1

1090
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
"express": "^4.17.1",
"font-logos": "",
"jquery": "^3.6.0",
"jquery.terminal": "^2.34.0",
"jquery.terminal": "^1.23.2",
"line-reader": "^0.4.0",
"moment": "^2.29.1",
"multer": "^1.3.0",

View File

@ -15,7 +15,9 @@ let config = JSON.parse(fs.readFileSync((process.env.PICLUSTER_CONFIG ? process.
process.env.NODE_TLS_REJECT_UNAUTHORIZED = config.ssl_self_signed ? '0' : '1';
const app = express();
app.use(express.urlencoded({ extended: true }));
app.use(express.urlencoded({
limit: '20mb'
}));
app.use(express.json({
limit: '20mb'
}));
@ -1370,4 +1372,4 @@ if (config.ssl && config.ssl_cert && config.ssl_key) {
webconsole.listen(web_port, () => {
console.log('Listening on port %d', web_port);
});
}
}