Commit ac306aa0 authored by noplanman's avatar noplanman

Merge branch 'fresh-install-fixes' into 'develop'

small fixes found from a clean install

See merge request !231
parents 7a668819 60082df5
Pipeline #1215 passed with stage
in 2 minutes and 15 seconds
...@@ -4,9 +4,14 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic ...@@ -4,9 +4,14 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
## [Unreleased] ## [Unreleased]
### Added ### Added
### Changed ### Changed
- add.php test for pod meta like update.php
### Deprecated ### Deprecated
### Removed ### Removed
### Fixed ### Fixed
- init call on new setup sets up the needed items
- missing tables.sql item from version 2.5.2
- missing table on tables.sql
- link to osada repo updated
### Security ### Security
## [2.5.2] - 2019-01-29 ## [2.5.2] - 2019-01-29
......
...@@ -8,7 +8,7 @@ Environmental items you need (debian based system assumed): ...@@ -8,7 +8,7 @@ Environmental items you need (debian based system assumed):
OS Dependencies: 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 Yarn is a separate install: https://yarnpkg.com
...@@ -41,10 +41,14 @@ Import database schema ...@@ -41,10 +41,14 @@ Import database schema
psql -U podupuser podupdb < db/tables.sql 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 1. Edit `config.php` to add your DB and file settings
2. Touch add.log in location you configured in config.php 2. Create your backup folder
3. Create your backup folder 3. Add a pod and run `php db/update.php init`
4. Add a pod and run `php db/update.php init`
# To Use: # To Use:
......
...@@ -82,13 +82,20 @@ EOF; ...@@ -82,13 +82,20 @@ EOF;
} }
if (!$stop) { if (!$stop) {
$link = 'https://' . $_domain . '/nodeinfo/1.0'; $nodeinfo_meta = curl("https://{$_domain}/.well-known/nodeinfo");
$nodeinfo = curl('https://' . $_domain . '/.well-known/nodeinfo');
if ($info = json_decode($nodeinfo['body'] ?: '', true)) { // Default link to fetch node info.
$link = max($info['links'])['href']; $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) { if ($output['body'] && stripos($output['body'], 'openRegistrations') !== false) {
echo 'Your pod has ssl and is valid<br>'; echo 'Your pod has ssl and is valid<br>';
...@@ -125,6 +132,6 @@ if (!$stop) { ...@@ -125,6 +132,6 @@ if (!$stop) {
echo 'Data successfully inserted! Your pod will be checked and live on the list in a few hours!'; echo 'Data successfully inserted! Your pod will be checked and live on the list in a few hours!';
} else { } 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>';
} }
} }
...@@ -96,6 +96,16 @@ CREATE TABLE masterversions ( ...@@ -96,6 +96,16 @@ CREATE TABLE masterversions (
date_checked timestamp DEFAULT current_timestamp date_checked timestamp DEFAULT current_timestamp
); );
CREATE TABLE monthlystats (
id serial8 UNIQUE PRIMARY KEY,
total_users int,
total_posts int,
total_comments int,
total_pods int,
total_uptime int,
date_checked timestamp DEFAULT current_timestamp
);
CREATE TABLE meta ( CREATE TABLE meta (
id serial8 UNIQUE PRIMARY KEY, id serial8 UNIQUE PRIMARY KEY,
name text, name text,
...@@ -110,3 +120,4 @@ INSERT INTO meta (name) VALUES('federation_updated'); ...@@ -110,3 +120,4 @@ INSERT INTO meta (name) VALUES('federation_updated');
INSERT INTO meta (name) VALUES('statstable_updated'); INSERT INTO meta (name) VALUES('statstable_updated');
INSERT INTO meta (name) VALUES('backup'); INSERT INTO meta (name) VALUES('backup');
INSERT INTO meta (name) VALUES('pods_updated'); 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 = [ ...@@ -25,7 +25,7 @@ $softwares = [
'writefreely' => ['repo' => 'writeas/writefreely', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'], 'writefreely' => ['repo' => 'writeas/writefreely', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'ganggo' => ['repo' => 'ganggo%2fganggo', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => ''], 'ganggo' => ['repo' => 'ganggo%2fganggo', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => ''],
'funkwhale' => ['repo' => 'funkwhale%2ffunkwhale', 'gitsite' => 'code.eliotberriot.com', 'gittype' => 'gitlab', 'devbranch' => 'develop'], '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 = [ $opts = [
......
...@@ -33,7 +33,6 @@ $foundpods = []; ...@@ -33,7 +33,6 @@ $foundpods = [];
//pulling all nodes for now //pulling all nodes for now
$federationpods = curl('https://the-federation.info/graphql?query=%7Bnodes%7Bhost%20platform%7Bname%7Dprotocols%7Bname%7D%7D%7D&raw'); $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)) { if ($pods = json_decode($federationpods['body'] ?: '', true)) {
;
foreach ($pods['data']['nodes'] ?? [] as $poddata) { foreach ($pods['data']['nodes'] ?? [] as $poddata) {
$protocols = array_column($poddata['protocols'] ?? [], 'name'); $protocols = array_column($poddata['protocols'] ?? [], 'name');
......
...@@ -29,6 +29,7 @@ if (!is_connected()) { ...@@ -29,6 +29,7 @@ if (!is_connected()) {
$time_start = microtime(true); $time_start = microtime(true);
$debug = isset($_GET['debug']) || (isset($argv) && in_array('debug', $argv, 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)); $sqldebug = isset($_GET['sqldebug']) || (isset($argv) && in_array('sqldebug', $argv, true));
$develop = isset($_GET['develop']) || (isset($argv) && in_array('develop', $argv, true)); $develop = isset($_GET['develop']) || (isset($argv) && in_array('develop', $argv, true));
$write = !(isset($_GET['nowrite']) || (isset($argv) && in_array('nowrite', $argv, true))); $write = !(isset($_GET['nowrite']) || (isset($argv) && in_array('nowrite', $argv, true)));
...@@ -449,33 +450,33 @@ if (!$_domain) { ...@@ -449,33 +450,33 @@ if (!$_domain) {
$time_end = microtime(true); $time_end = microtime(true);
$execution_time = ($time_end - $time_start) / 60; $execution_time = ($time_end - $time_start) / 60;
updateMeta('pods_update_runtime', round($execution_time)); updateMeta('pods_update_runtime', round($execution_time));
if ($languagesupdated) { if ($languagesupdated || $init) {
updateMeta('languages_updated'); 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'; 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'; 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')); copy('https://curl.haxx.se/ca/cacert.pem', c('cafullpath'));
updateMeta('cacert_updated'); 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'; 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')); copy('compress.zlib://http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz', c('geoip2db'));
updateMeta('geoip_updated'); 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'; 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