2021-01-07 23:04:00 +01:00
|
|
|
# Oxen Observer OMG block explorer
|
2020-08-18 03:39:32 +02:00
|
|
|
|
2021-01-07 23:04:00 +01:00
|
|
|
Block explorer using Oxen 8+ LMQ RPC interface that does everything through RPC requests. Sexy,
|
2020-08-18 03:39:32 +02:00
|
|
|
awesome, safe.
|
|
|
|
|
2021-01-05 14:25:28 +01:00
|
|
|
## Prerequisite packages
|
|
|
|
|
2023-12-07 00:35:06 +01:00
|
|
|
sudo apt install build-essential pkg-config libsodium-dev libzmq3-dev python3-dev python3-flask python3-babel python3-pygments python3-oxenmq python3-pycryptodome python3-nacl python3-pysodium python3-qrcode
|
2021-01-05 14:25:28 +01:00
|
|
|
|
2021-10-30 05:11:09 +02:00
|
|
|
Note that the last requirement (python3-oxenmq) comes from the Oxen repository (https://deb.oxen.io).
|
2020-08-18 03:39:32 +02:00
|
|
|
|
2020-10-07 04:11:43 +02:00
|
|
|
## Running in debug mode
|
|
|
|
|
|
|
|
To run it in debug mode (production requires setting up a WSGI server, see below):
|
2020-08-18 03:39:32 +02:00
|
|
|
|
2020-08-19 17:41:34 +02:00
|
|
|
FLASK_APP=observer flask run --reload --debugger
|
2020-08-18 03:39:32 +02:00
|
|
|
|
2020-10-07 04:11:43 +02:00
|
|
|
This mode seems to be a bit flakey, though -- reloading, in particular, seems to break things and
|
2021-10-30 05:11:09 +02:00
|
|
|
make it just silently exit after a while, so only do this for quick and dirty testing.
|
2020-10-07 04:11:43 +02:00
|
|
|
|
|
|
|
## Setting up for production with uwsgi-emperor:
|
|
|
|
|
2021-10-30 05:11:09 +02:00
|
|
|
Do the above, but instead of running it with flask directly, set up uwsgi-emperor as follows:
|
2020-10-07 04:11:43 +02:00
|
|
|
|
|
|
|
apt install uwsgi-emperor uwsgi-plugin-python3
|
|
|
|
|
|
|
|
in `/etc/uwsgi-emperor/emperor.ini` add configuration of:
|
|
|
|
|
|
|
|
# vassals directory
|
|
|
|
emperor = /etc/uwsgi-emperor/vassals
|
|
|
|
cap = setgid,setuid
|
|
|
|
emperor-tyrant = true
|
|
|
|
|
2021-10-30 05:11:09 +02:00
|
|
|
Create a "vassal" config for oxen-observer, `/etc/uwsgi-emperor/vassals/oxen-observer.ini`, containing:
|
2020-10-07 04:11:43 +02:00
|
|
|
|
|
|
|
[uwsgi]
|
2021-10-30 05:11:09 +02:00
|
|
|
chdir = /path/to/oxen-observer
|
2020-10-07 04:11:43 +02:00
|
|
|
socket = mainnet.wsgi
|
|
|
|
plugins = python3,logfile
|
|
|
|
processes = 4
|
|
|
|
manage-script-name = true
|
|
|
|
mount = /=mainnet:app
|
|
|
|
|
2021-10-30 05:11:09 +02:00
|
|
|
logger = file:logfile=/path/to/oxen-observer/mainnet.log
|
2020-10-07 04:11:43 +02:00
|
|
|
|
2021-10-30 05:11:09 +02:00
|
|
|
Set ownership of this user to whatever user you want it to run as, and set the group to `_loki` (so
|
2021-01-07 23:04:00 +01:00
|
|
|
that it can open the oxend unix socket):
|
2020-10-07 04:11:43 +02:00
|
|
|
|
2022-07-14 17:31:32 +02:00
|
|
|
chown MYUSERNAME:_loki /etc/uwsgi-emperor/vassals/oxen-observer.ini
|
2020-10-07 04:11:43 +02:00
|
|
|
|
2021-10-30 05:11:09 +02:00
|
|
|
In the oxen-observer/mainnet.py, set:
|
2020-10-07 04:11:43 +02:00
|
|
|
|
2022-07-14 17:31:32 +02:00
|
|
|
config.oxend_rpc = 'ipc:///var/lib/oxen/oxend.sock'
|
2020-10-07 04:11:43 +02:00
|
|
|
|
|
|
|
and finally, proxy requests from the webserver to the wsgi socket. For Apache I do this with:
|
|
|
|
|
|
|
|
# Allow access to static files (e.g. .css and .js):
|
2022-07-14 17:31:32 +02:00
|
|
|
<Directory /path/to/oxen-observer/static>
|
2020-10-07 04:11:43 +02:00
|
|
|
Require all granted
|
|
|
|
</Directory>
|
2022-07-14 17:31:32 +02:00
|
|
|
DocumentRoot /home/jagerman/src/oxen-observer/static
|
2020-10-07 04:11:43 +02:00
|
|
|
|
|
|
|
# Proxy everything else via the uwsgi socket:
|
|
|
|
ProxyPassMatch "^/[^/]*\.(?:css|js)(?:$|\?)" !
|
2022-07-14 17:31:32 +02:00
|
|
|
ProxyPass / unix:/path/to/oxen-observer/mainnet.wsgi|uwsgi://uwsgi-mainnet-observer/
|
2020-10-07 04:11:43 +02:00
|
|
|
|
|
|
|
(you will probably need to `a2enmod proxy_uwsgi` to enable the Apache modules that make that work).
|
|
|
|
|
|
|
|
That should be it: restart apache2 and uwsgi-emperor and you should be good to go. If you want to
|
|
|
|
make uwsgi restart (for example because you are changing things) then it is sufficient to `touch
|
2022-07-14 17:31:32 +02:00
|
|
|
/etc/uwsgi-emperor/vassals/oxen-observer.ini` to trigger a reload (you do not have to restart the
|
2020-10-07 04:11:43 +02:00
|
|
|
apache2/uwsgi-emperor layers).
|
|
|
|
|
|
|
|
If you want to set up a testnet or devnet observer the procedure is essentially the same, but
|
2021-10-30 05:11:09 +02:00
|
|
|
using testnet.py or devnet.py pointing to the oxend.sock from a testnet or devnet oxend.
|