Commit 1d5bb839 authored by David Morley's avatar David Morley

small fixes found from a clean install

parent 7a668819
Pipeline #1212 failed with stage
in 1 minute and 39 seconds
......@@ -4,9 +4,13 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
## [Unreleased]
### Added
### Changed
- add.php test for pod meta like update.php
### Deprecated
### Removed
### Fixed
- init call on new setup sets up the needed items
- missing table.sql item from version 2.5.2
- link to osada repo updated
### Security
## [2.5.2] - 2019-01-29
......
......@@ -8,7 +8,7 @@ Environmental items you need (debian based system assumed):
OS Dependencies:
```
php7.2 php7.2-curl php7.2-pgsql php7.2-bcmath php-geoip php7.2-cli php7.2-common php7.2-bcmath php7.2-json php7.2-readline php7.2-mbstring php7.2-xml php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer
php7.2 php7.2-curl php7.2-pgsql php7.2-bcmath php-geoip php7.2-cli php7.2-common php7.2-fpm php7.2-bcmath php7.2-json php7.2-readline php7.2-mbstring php7.2-xml php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer
```
Yarn is a separate install: https://yarnpkg.com
......@@ -41,10 +41,14 @@ Import database schema
psql -U podupuser podupdb < db/tables.sql
```
Configure your webserver (nginx example)
```
see file http-server-config.example
```
1. Edit `config.php` to add your DB and file settings
2. Touch add.log in location you configured in config.php
3. Create your backup folder
4. Add a pod and run `php db/update.php init`
2. Create your backup folder
3. Add a pod and run `php db/update.php init`
# To Use:
......
......@@ -82,13 +82,21 @@ EOF;
}
if (!$stop) {
$link = 'https://' . $_domain . '/nodeinfo/1.0';
$nodeinfo = curl('https://' . $_domain . '/.well-known/nodeinfo');
if ($info = json_decode($nodeinfo['body'] ?: '', true)) {
$link = max($info['links'])['href'];
$nodeinfo_meta = curl("https://{$_domain}/.well-known/nodeinfo");
// Default link to fetch node info.
$nodeinfo_url = "https://{$_domain}/nodeinfo/1.0";
if ($info = json_decode($nodeinfo_meta['body'] ?: '', true)) {
if (count($info['links'], COUNT_RECURSIVE) === 2) {
$nodeinfo_url = $info['links']['href'];
} else {
$nodeinfo_url = max($info['links'])['href'];
}
}
$output = curl($link, true);
$output = curl($nodeinfo_url, true);
if ($output['body'] && stripos($output['body'], 'openRegistrations') !== false) {
echo 'Your pod has ssl and is valid<br>';
......@@ -125,6 +133,6 @@ if (!$stop) {
echo 'Data successfully inserted! Your pod will be checked and live on the list in a few hours!';
} else {
echo 'Could not validate your pod, check your setup!<br>Take a look at <a href="' . $link . '">your /nodeinfo</a>';
echo 'Could not validate your pod, check your setup!<br>Take a look at your <a href="' . $nodeinfo_url . '">nodeinfo</a>';
}
}
......@@ -110,3 +110,4 @@ INSERT INTO meta (name) VALUES('federation_updated');
INSERT INTO meta (name) VALUES('statstable_updated');
INSERT INTO meta (name) VALUES('backup');
INSERT INTO meta (name) VALUES('pods_updated');
INSERT INTO meta (name) VALUES('sitemap_updated');
\ No newline at end of file
......@@ -25,7 +25,7 @@ $softwares = [
'writefreely' => ['repo' => 'writeas/writefreely', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'ganggo' => ['repo' => 'ganggo%2fganggo', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => ''],
'funkwhale' => ['repo' => 'funkwhale%2ffunkwhale', 'gitsite' => 'code.eliotberriot.com', 'gittype' => 'gitlab', 'devbranch' => 'develop'],
'osada' => ['repo' => 'macgirvin%2fosada', 'gitsite' => 'framagit.org', 'gittype' => 'gitlab', 'devbranch' => 'dev'],
'osada' => ['repo' => 'zot%2fosada', 'gitsite' => 'framagit.org', 'gittype' => 'gitlab', 'devbranch' => 'dev'],
];
$opts = [
......@@ -59,18 +59,19 @@ foreach ($softwares as $software => $details) {
}
} elseif ($details['gittype'] === 'gitlab') {
$context = stream_context_create($opts);
$releasejson = json_decode(file_get_contents('https://' . $details['gitsite'] . '/api/v4/projects/' . $details['repo'] . '/repository/tags', false, $context));
$releasejson = file_get_contents('https://' . $details['gitsite'] . '/api/v4/projects/' . $details['repo'] . '/repository/tags', false, $context);
$release = json_decode($releasejson ?: '', true);
if ($details['devbranch']) {
$commitjson = json_decode(file_get_contents('https://' . $details['gitsite'] . '/api/v4/projects/' . $details['repo'] . '/repository/commits/' . $details['devbranch'], false, $context));
} else {
$commitjson = '';
}
if ($masterversion = $releasejson[0]->name ? str_replace('v', '', $releasejson[0]->name) : '') {
if ($masterversion = $release[0]->name ? str_replace('v', '', $release[0]->name) : '') {
try {
$m = R::dispense('masterversions');
$m['software'] = $software;
$m['version'] = $masterversion;
if ($releasedate = $releasejson[0] ? $releasejson[0]->commit->created_at : '') {
if ($releasedate = $release[0] ? $release[0]->commit->created_at : '') {
$m['releasedate'] = $releasedate;
}
if ($devlastcommit = $commitjson ? $commitjson->created_at : '') {
......
......@@ -33,7 +33,6 @@ $foundpods = [];
//pulling all nodes for now
$federationpods = curl('https://the-federation.info/graphql?query=%7Bnodes%7Bhost%20platform%7Bname%7Dprotocols%7Bname%7D%7D%7D&raw');
if ($pods = json_decode($federationpods['body'] ?: '', true)) {
;
foreach ($pods['data']['nodes'] ?? [] as $poddata) {
$protocols = array_column($poddata['protocols'] ?? [], 'name');
......
......@@ -29,6 +29,7 @@ if (!is_connected()) {
$time_start = microtime(true);
$debug = isset($_GET['debug']) || (isset($argv) && in_array('debug', $argv, true));
$init = isset($_GET['init']) || (isset($argv) && in_array('init', $argv, true));
$sqldebug = isset($_GET['sqldebug']) || (isset($argv) && in_array('sqldebug', $argv, true));
$develop = isset($_GET['develop']) || (isset($argv) && in_array('develop', $argv, true));
$write = !(isset($_GET['nowrite']) || (isset($argv) && in_array('nowrite', $argv, true)));
......@@ -449,33 +450,33 @@ if (!$_domain) {
$time_end = microtime(true);
$execution_time = ($time_end - $time_start) / 60;
updateMeta('pods_update_runtime', round($execution_time));
if ($languagesupdated) {
if ($languagesupdated || $init) {
updateMeta('languages_updated');
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('masterversions_updated', 'date_created'))->diffInHours() > 12) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('masterversions_updated', 'date_created'))->diffInHours() > 12 || $init) {
require __DIR__ . '/update-masterversions.php';
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('statstable_updated', 'date_created'))->diffInHours() > 23) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('statstable_updated', 'date_created'))->diffInHours() > 23 || $init) {
require __DIR__ . '/update-monthly-stats.php';
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('cacert_updated', 'date_created'))->diffInHours() > 40) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('cacert_updated', 'date_created'))->diffInHours() > 40 || $init) {
copy('https://curl.haxx.se/ca/cacert.pem', c('cafullpath'));
updateMeta('cacert_updated');
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('sitemap_updated', 'date_created'))->diffInHours() > 2) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('sitemap_updated', 'date_created'))->diffInHours() > 2 || $init) {
require __DIR__ . '/update-sitemap.php';
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('geoip_updated', 'date_created'))->diffInHours() > 45) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('geoip_updated', 'date_created'))->diffInHours() > 45 || $init) {
copy('compress.zlib://http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz', c('geoip2db'));
updateMeta('geoip_updated');
}
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('federation_updated', 'date_created'))->diffInHours() > 9) {
if (Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('federation_updated', 'date_created'))->diffInHours() > 9 || $init) {
require __DIR__ . '/update-remote-data.php';
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment