From 38b7fb1f4757ce4c208cfe8b120e41545231c928 Mon Sep 17 00:00:00 2001 From: Ludovic <54670129+lbr38@users.noreply.github.com> Date: Sat, 18 Nov 2023 17:11:56 +0100 Subject: [PATCH] 3.7.7 --- README.md | 9 +++-- docker/docker-compose-dev.yml | 2 +- www/controllers/Gpg.php | 7 ++-- .../Container/vars/stats/list.vars.inc.php | 6 ++-- www/controllers/Process.php | 7 +--- www/controllers/Repo/Mirror/Deb.php | 7 +--- .../Repo/Operation/Metadata/Create.php | 4 +-- www/controllers/Stat.php | 8 ----- www/models/Stat.php | 29 ---------------- www/public/resources/styles/main.css | 34 ------------------- www/version | 2 +- .../includes/containers/stats/list.inc.php | 6 ++-- 12 files changed, 19 insertions(+), 102 deletions(-) diff --git a/README.md b/README.md index c47c552b..1f7b23fa 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@

REPOMANAGER

-**Repomanager** is a web mirroring tool for RPM or DEB packages repositories. +**Repomanager** is a web mirroring tool for ``rpm`` or ``deb`` packages repositories. Designed for an enterprise usage and to help deployment of packages updates on large Linux servers farms, it can create mirrors of public repositories (eg. Debian or CentOS official repos or third-party editors) and manage several snapshots versions and environments.

Main features

-- Create deb or rpm mirror repositories -- Sign repo with GPG +- Create ``deb`` or ``rpm`` mirror repositories +- Sign packages/repositories with GPG - Upload packages into repositories -- Create environments (eg. preprod, prod...) and make mirrors available only for specific envs. +- Create environments (eg. ``preprod``, ``prod``...) and make mirrors available only for specific envs. - Manage hosts packages updates - Plan tasks - ... @@ -30,7 +30,6 @@ Designed for an enterprise usage and to help deployment of packages updates on l

Software and configuration

- **docker** (service must be up and running) -- **docker-compose** - **A fully qualified domain name** (FQDN) and a valid SSL certificate for this FQDN if you want to access the web interface through a secure connection (https) - A least a **SPF record** configured for your FQDN, to be able to send emails from Repomanager diff --git a/docker/docker-compose-dev.yml b/docker/docker-compose-dev.yml index 3faeaf59..abe120bc 100644 --- a/docker/docker-compose-dev.yml +++ b/docker/docker-compose-dev.yml @@ -11,7 +11,7 @@ services: args: env: devel fqdn: repomanager-dev.localhost - max_upload_size: 32M + max_upload_size: 64M restart: always ports: - "8080:8080" diff --git a/www/controllers/Gpg.php b/www/controllers/Gpg.php index 224f37c4..ccbe5049 100644 --- a/www/controllers/Gpg.php +++ b/www/controllers/Gpg.php @@ -9,7 +9,6 @@ class Gpg private $length = 4096; private $name = 'Repomanager'; private $description = 'Repomanager GPG signing key'; - private $keyId = GPG_SIGNING_KEYID; private $passphrase = ''; /** @@ -175,7 +174,7 @@ private function generateSigningKey() $template .= 'Key-Usage: sign' . PHP_EOL; $template .= 'Name-Real: ' . $this->name . PHP_EOL; $template .= 'Name-Comment: ' . $this->description . PHP_EOL; - $template .= 'Name-Email: ' . $this->keyId . PHP_EOL; + $template .= 'Name-Email: ' . GPG_SIGNING_KEYID . PHP_EOL; $template .= 'Expire-Date: 0' . PHP_EOL; $template .= 'Passphrase: ' . $this->passphrase . PHP_EOL; @@ -209,7 +208,7 @@ private function generateSigningKey() * Write passphrase to file */ if (!file_put_contents(PASSPHRASE_FILE, $this->passphrase)) { - throw new Exception('Cannot write to: ' . PASSPHRASE_FILE); + throw new Exception('Cannot write passphrase to: ' . PASSPHRASE_FILE); } unset($template, $myprocess); @@ -263,7 +262,7 @@ private function generateRpmMacros() if (!file_exists(MACROS_FILE)) { $configuration = '%__gpg /usr/bin/gpg2' . PHP_EOL; $configuration .= '%_gpg_path ' . GPGHOME . PHP_EOL; - $configuration .= '%_gpg_name ' . $this->keyId . PHP_EOL; + $configuration .= '%_gpg_name ' . GPG_SIGNING_KEYID . PHP_EOL; $configuration .= '%_gpg_passphrase_file ' . PASSPHRASE_FILE . PHP_EOL; $configuration .= '%__gpg_sign_cmd %{__gpg} gpg --no-verbose --no-armor --batch --pinentry-mode loopback --passphrase-file %{_gpg_passphrase_file} %{?_gpg_digest_algo:--digest-algo %{_gpg_digest_algo}} --no-secmem-warning -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}'; diff --git a/www/controllers/Layout/Container/vars/stats/list.vars.inc.php b/www/controllers/Layout/Container/vars/stats/list.vars.inc.php index ba5f45a8..056f01d9 100644 --- a/www/controllers/Layout/Container/vars/stats/list.vars.inc.php +++ b/www/controllers/Layout/Container/vars/stats/list.vars.inc.php @@ -107,7 +107,7 @@ $dateCounter = date('Y-m-d', strtotime('-1 year', strtotime(DATE_YMD))); } -$repoAccessChartLabels = ''; +$repoAccessChartDates = ''; $repoAccessChartData = ''; /** @@ -130,7 +130,7 @@ /** * Add the current date to the labels */ - $repoAccessChartLabels .= "'$dateCounter', "; + $repoAccessChartDates .= "'$dateCounter', "; /** * Increment by 1 day to be able to process the next date @@ -141,7 +141,7 @@ /** * Remove the last comma */ -$repoAccessChartLabels = rtrim($repoAccessChartLabels, ', '); +$repoAccessChartDates = rtrim($repoAccessChartDates, ', '); $repoAccessChartData = rtrim($repoAccessChartData, ', '); /** diff --git a/www/controllers/Process.php b/www/controllers/Process.php index 9b983b90..d0c97428 100644 --- a/www/controllers/Process.php +++ b/www/controllers/Process.php @@ -9,7 +9,7 @@ class Process { private $workingDir = ROOT . '/.temp'; // Répertoire de travail pour php private $command; - private $env; + private $env = array('HOME' => ROOT, 'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'); private $process; private $pipes; private $pid; @@ -21,11 +21,6 @@ public function __construct(string $command, array $env = null) { $this->command = $command; - /** - * Define minimal environment variables for this process - */ - $this->env = array('HOME' => ROOT); - /** * If others env vars have been specified then add them */ diff --git a/www/controllers/Repo/Mirror/Deb.php b/www/controllers/Repo/Mirror/Deb.php index f21dfa0f..b6e3cb60 100644 --- a/www/controllers/Repo/Mirror/Deb.php +++ b/www/controllers/Repo/Mirror/Deb.php @@ -411,12 +411,7 @@ private function parseSourcesIndiceFile() if (!empty($packageLocation) and !empty($packageMd5)) { $packages[] = array('location' => $packageLocation, 'md5sum' => $packageMd5); } - /** - * Add founded packages to the global array - */ - // if (!empty($directory) and !empty($packageLocation) and !empty($packageMd5)) { - // $this->sourcesPackagesLocation[] = array('location' => $directory . '/' . $packageLocation, 'md5sum' => $packageMd5); - // } + unset($packageLocation, $packageMd5); } diff --git a/www/controllers/Repo/Operation/Metadata/Create.php b/www/controllers/Repo/Operation/Metadata/Create.php index 6e107305..6afa7430 100644 --- a/www/controllers/Repo/Operation/Metadata/Create.php +++ b/www/controllers/Repo/Operation/Metadata/Create.php @@ -244,7 +244,7 @@ private function createMetadata() } } - $distributionsFileContent = 'Origin: ' . $this->repo->getName() . ' repo on ' . WWW_HOSTNAME . PHP_EOL; + $distributionsFileContent = 'Origin: ' . $this->repo->getName() . ' repo on ' . WWW_HOSTNAME . PHP_EOL; $distributionsFileContent .= 'Label: apt repository' . PHP_EOL; $distributionsFileContent .= 'Codename: ' . $this->repo->getDist() . PHP_EOL; $distributionsFileContent .= 'Suite: stable' . PHP_EOL; @@ -391,7 +391,7 @@ private function createMetadata() /** * Then build the includeb command from the string generated */ - $repreproIncludeParams = 'includedeb ' . $this->repo->getDist() . ' ' . $debFilesConcatenatePaths; + $repreproIncludeParams = '-S ' . $this->repo->getSection() . ' includedeb ' . $this->repo->getDist() . ' ' . $debFilesConcatenatePaths; /** * Proceed to import those 100 deb packages into the repo diff --git a/www/controllers/Stat.php b/www/controllers/Stat.php index 738a543f..2f84c03f 100644 --- a/www/controllers/Stat.php +++ b/www/controllers/Stat.php @@ -45,14 +45,6 @@ public function getLastAccess(string $name, string $dist = null, string $section return $this->model->getLastAccess($name, $dist, $section, $env); } - /** - * Retourne le détail des requêtes sur le repo/section spécifié, des 5 dernières minutes - */ - public function getLastMinutesAccess(string $name, string $dist = null, string $section = null, string $env) - { - return $this->model->getLastMinutesAccess($name, $dist, $section, $env); - } - /** * Compte le nombre de requêtes d'accès au repo/section spécifié, sur une date donnée */ diff --git a/www/models/Stat.php b/www/models/Stat.php index a15ffa17..802fd6e0 100644 --- a/www/models/Stat.php +++ b/www/models/Stat.php @@ -146,35 +146,6 @@ public function getLastAccess(string $name, string $dist = null, string $section return $datas; } - /** - * Retourne le détail des requêtes sur le repo/section spécifié, des 5 dernières minutes - */ - public function getLastMinutesAccess(string $name, string $dist = null, string $section = null, string $env) - { - $timeEnd = date("H:i:s"); - $timeStart = date('H:i:s', strtotime('-5 minutes', strtotime($timeEnd))); - - try { - $stmt = $this->db->prepare("SELECT * FROM access WHERE Date = '" . DATE_YMD . "' AND Time BETWEEN '$timeStart' AND '$timeEnd' AND Request LIKE :request ORDER BY Date DESC LIMIT 30"); - if (!empty($dist) and !empty($section)) { - $stmt->bindValue(':request', "%/${name}/${dist}/${section}_${env}/%"); - } else { - $stmt->bindValue(':request', "%/${name}_${env}/%"); - } - $result = $stmt->execute(); - } catch (\Exception $e) { - \Controllers\Common::dbError($e); - } - - $datas = array(); - - while ($row = $result->fetchArray(SQLITE3_ASSOC)) { - $datas[] = $row; - } - - return $datas; - } - /** * Compte le nombre de requêtes d'accès au repo/section spécifié, sur une date donnée */ diff --git a/www/public/resources/styles/main.css b/www/public/resources/styles/main.css index b1fe2b74..333e2b0c 100644 --- a/www/public/resources/styles/main.css +++ b/www/public/resources/styles/main.css @@ -798,40 +798,6 @@ footer #github img { width: 25px; } flex: 0 0 100%; } -#maintenance-container, #update-log-container { - position: fixed; - top: 0; - left: 0; - bottom: 0; - right: 0; - overflow: auto; - background: #333333d3; - z-index: 1; -} - -#maintenance, #update-log { - position: absolute; - top: 40%; - left: 50%; - transform: translateX(-50%) translateY(-50%); - padding: 30px; - border-radius: 8px; - background-color: #112334; - -webkit-box-shadow: 0px 10px 13px -12px #000000, 0px 0px 10px 2px rgba(0,0,0,0.15); - box-shadow: 0px 10px 13px -12px #000000, 0px 0px 10px 2px rgb(0 0 0 / 15%); -} - -#update-log-info { - max-width: 1000px; - max-height: 400px; - overflow: auto; -} - -#maintenance p { - font-size: 14px; - text-align: center; -} - #loginDiv-container { height: 90vh; position: relative; diff --git a/www/version b/www/version index ae94c935..cbbb5eea 100644 --- a/www/version +++ b/www/version @@ -1 +1 @@ -3.7.6 \ No newline at end of file +3.7.7 \ No newline at end of file diff --git a/www/views/includes/containers/stats/list.inc.php b/www/views/includes/containers/stats/list.inc.php index 38a1de82..50245935 100644 --- a/www/views/includes/containers/stats/list.inc.php +++ b/www/views/includes/containers/stats/list.inc.php @@ -41,7 +41,7 @@
+ if (!empty($repoAccessChartDates) and !empty($repoAccessChartData)) : ?> 1 week 1 month 3 months @@ -55,7 +55,7 @@ * Utilisés par jqeury pour récupérer de nouvelles valeurs en fonction du filtre choisi par l'utilisateur (1week...) */ ?> - + @@ -64,7 +64,7 @@ var myRepoAccessChart = new Chart(ctx, { type: 'line', data: { - labels: [], + labels: [], datasets: [{ data: [], label: "Total access",