NAME
phoebe-ctl - admin control for a Phoebe wiki
DESCRIPTION
This script helps you maintain your Phoebe installation.
- --wiki_dir=DIR
-
This the wiki data directory to use; the default is either the value of the
GEMINI_WIKI_DATA_DIR
environment variable, or the./wiki
subdirectory. Use it to specify a space, too. - --log=NUMBER
-
This is the log level to use. 1 only prints errors; 2 also prints warnings (this is the default); 3 prints any kind of information; 4 prints all sorts of info the developer wanted to see as they were fixing bugs.
Commands
phoebe-ctl help
This is what you're reading right now.
phoebe-ctl update-changes
This command looks at all the pages in the page directory and generates new entries for your changes log into changes.log.
phoebe-ctl erase-page
This command removes pages from the page directory, removes all the kept revisions in the keep directory, and all the mentions in the change.log. Use this if spammers and vandals created page names you want to eliminate.
phoebe-ctl html-export [--source=subdirectory ...] [--target=directory] [--no-extension]
This command converts all the pages in the subdirectories provided to HTML and writes the HTML files into the target directory. The subdirectories must exist inside your wiki data directory. The default wiki data directory is wiki and the default source subdirectory is undefined, so the actual files to be processed are wiki/page/*.gmi; if you're using virtual hosting, the subdirectory might be your host name; if you're using spaces, those need to be appended as well.
Example:
phoebe-ctl html-export --wiki_dir=/home/alex/phoebe \
--source=transjovian.org \
--source=transjovian.org/phoebe \
--source=transjovian.org/gemini \
--source=transjovian.org/titan \
--target=/home/alex/transjovian.org
This will create HTML files in /home/alex/transjovian.org, /home/alex/transjovian.org/phoebe, /home/alex/transjovian.org/gemini, and /home/alex/transjovian.org/titan.
Note that the links in these HTML files do not include the .html extension (e.g. /test
), so this relies on your web server doing the right thing: if a visitor requests /test
the web server must serve /test.html. If that doesn't work, perhaps using --no-extension
is your best bet: the HTML files will be written without the .html extension. This should also work for local browsing, although it does look strange, all those pages with the .html extension.
phoebe-ctl log hits
If you are using App::Phoebe::SpeedBump, you can find the number of blocked requests. First, make you you are using the module in your config file:
use App::Phoebe::DebugIpNumbers;
Make sure you start or start phoebe
with --log_level=info
or --log_level=debug
. First generate a log file. Better to zip it up and analyse it elsewhere. This can be pretty big!
journalctl --unit=phoebe | gzip > phoebe.log.gz
Here's how to see how many requests are blocked:
zcat phoebe.log.gz | script/phoebe-ctl log hits | head
phoebe-ctl log requests [IP number]
If you are logging IP numbers, this command will offer a little summary. In your config file, you need the following (or start phoebe
with --log_level=debug
):
package App::Phoebe;
use Modern::Perl;
our ($log);
$log->level('debug');
And you need App::Phoebe::DebugIpNumbers, of course:
use App::Phoebe::DebugIpNumbers;
Example basic usage, feeding it the journal kept by systemd
, giving you the most active IP numbers:
journalctl --unit phoebe | phoebe-ctl log hits | head
Giving you a summary of the 20 most popular requests (Gopher selectors, Gemini URLs, or web requests):
journalctl --unit phoebe | phoebe-ctl log requests
The same, but limited to a particular IP number:
journalctl --unit phoebe | phoebe-ctl log requests 201.159.58.193