Commit 85800d8b authored by Jason Rhinelander's avatar Jason Rhinelander
Browse files

Added readme, SQL updates; replaced contact info

- Add draft readme describing how to set up.

- SQL: removed ownership and added missing `payment_system` column

- Replaced my contact info with dummy versions on the main page
parent e2f01f6f
Cryptonote pool list
====================
This is the pool list software that runs https://pools.graft.observer.
License
-------
This code is distributed under the GPL v3; see the `LICENSE` file for full details.
Requirements
------------
- postgresql 9.3 or above
- Python 3.x with a working uswgi configuration (for example via uwsgi-emperor -- details on setting
this up are below).
- Python 3.x packages: requests, psycopg2, scipy (on Debian/Ubuntu systems install the
python3-scipy, python3-psycopg2, and python3-scipy packages).
- systemd (for running updates; you could, in theory, also set up a cron job to do this)
- libjs-jquery, libjs-jquery-cookie, libjs-jquery-ui (you can, if you wish, load these via a public
CDN by changing the `<script src="...">` locations in the html pages).
Database
--------
The necessary database structure is in the database.pgsql file. Create a new database and user for
postgresql, then import as the user that will be running the pool and API via:
psql mydbname <database.pgsql
You'll also need to set at least one admin password to be able to add/edit pools; to do this:
psql mydbname
mydbname=> INSERT INTO pool_admin_pass VALUES ('MyAwesomePassword');
Configuration
-------------
See the settings at the beginning of `pools-api.py` and `update-pools.py`: the crucial one is the
`PG_CONNECT` (in both files). If the system user running the pool list and the postgresql user
owning the database are the same (and on the same system) then it is typically enough to just
specify `dbname`. For more complicated setups you can pass other parameters (see
http://initd.org/psycopg/docs/module.html#psycopg2.connect).
Apache and UWSGI
----------------
The API gets served from a Python script running via uwsgi. There are various ways to set this up;
the following is the one I use with Apache and the uwsgi-emperor daemon.
- in Apache, enable the proxy_uwsgi module (`sudo a2enmod proxy_uwsgi`) then on the site that will
host the pool list add:
ProxyPass /api/ unix:/home/someuser/pool-list/pools.wsgi|uwsgi://uwsgi-uds-pools-api/
You don't have to put the `pools.wsgi` socket inside the /home/someuser/pool-list, of course. The
last bit (after the `uwsgi://`) isn't terribly important but needs to be unique if you have other
uwsgi scripts.
- Enable serving of the global javascript packages by running `a2enconf javascript-common` (this
will make /javascript serve the installed system javascript packages from /usr/share/javascript).
If you want to use a public CDN instead you can skip this step and edit the `<script>` tags in the
HTML files.
- Install uwsgi-emperor and uwsgi-plugin-python3
- In /etc/uwsgi-emperor/emperor.ini, add at the bottom:
cap = setgid,setuid
emperor-tyrant = true
(This will allow individual scripts to run as a particular user).
- Add a new uwsgi "vassal" for the pool list in `/etc/uwsgi-emperor/vassals`; with an appropriate
name ending in `.ini`: for example, I use 'graftpools.ini' for the graft pool list. Inside the
file add:
[uwsgi]
socket = /home/someuser/pool-list/pools.wsgi
plugins = python3
wsgi-file = /home/someuser/pool-list/pools-api.py
threads = 4
The socket location needs to match what you configured in Apache, above.
- Change the ownership of the vassal file you just created to the same user as the one the pool
list should run as (with the emperor.ini settings above this tells uwsgi-emperor the user to run
as):
sudo chown someuser:someuser /etc/uwsgi-emperor/vassals/graftpools.ini
- Restart uwsgi-emperor and apache2. You should not be able to access
https://pools.example.com/api/stats and see something other than an error message.
HTML files
----------
Copy the contents of the www/ directory to the web server location where you want the pool list to
live. You'll want to edit the `index.html` and `admin.html` pages to refer to your coin as
something other than Graft, as well as updating your contact information.
Update script
-------------
The systemd/ directory contains two systemd scripts: a service file and a timer. Update the
User/Group/ExecStart settings for your local configuration in pool-list.service, and (optionally)
change the OnCalendar setting in pool-list.timer if you don't like the every-30-seconds default for
updating.
Copy these to /etc/systemd/system and then run `sudo systemctl daemon-reload` to get systemd to read
the new files.
Activate and start the timer (not the service file!) using:
sudo systemctl enable pool-list.timer
sudo systemctl start pool-list.timer
Donations
---------
This is open source, free software that you may use for any purpose (so long as you comply with the
terms of the GPLv3 license). Should you feel inclined to donate, however, you may donate via any of
the following:
BTC - 1HhkwnT7JtnRiyFXyxqbqYovkp3GUAAJXj
BCH - qpnup4w24s3l5x3n44l3fz2fx6ukpqmgggk7uh5nrh
GRFT - GAJasonD6JjcKqjFcGFdhgTYd5enZs31xh9dbdfQo8QmQE1NtPB1TxYEHLQDP8KQsQ9AxAYUJkEARizPjLA2StXLGfLhmx9
......@@ -2,8 +2,8 @@
-- PostgreSQL database dump
--
-- Dumped from database version 10.3 (Debian 10.3-2)
-- Dumped by pg_dump version 10.3 (Debian 10.3-2)
-- Dumped from database version 10.4 (Debian 10.4-2)
-- Dumped by pg_dump version 10.4 (Debian 10.4-2)
SET statement_timeout = 0;
SET lock_timeout = 0;
......@@ -16,21 +16,21 @@ SET client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- Name: pool_agg_stats(interval); Type: FUNCTION; Schema: public; Owner: graft
-- Name: pool_agg_stats(interval); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.pool_agg_stats(ago interval) RETURNS TABLE(pool integer, hashrate double precision, hashrate_sd double precision, miners double precision)
......@@ -42,14 +42,12 @@ end;
$$;
ALTER FUNCTION public.pool_agg_stats(ago interval) OWNER TO graft;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: pool_admin_pass; Type: TABLE; Schema: public; Owner: graft
-- Name: pool_admin_pass; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.pool_admin_pass (
......@@ -57,10 +55,8 @@ CREATE TABLE public.pool_admin_pass (
);
ALTER TABLE public.pool_admin_pass OWNER TO graft;
--
-- Name: pool_agg_stats; Type: MATERIALIZED VIEW; Schema: public; Owner: graft
-- Name: pool_agg_stats; Type: MATERIALIZED VIEW; Schema: public; Owner: -
--
CREATE MATERIALIZED VIEW public.pool_agg_stats AS
......@@ -80,10 +76,8 @@ CREATE MATERIALIZED VIEW public.pool_agg_stats AS
WITH NO DATA;
ALTER TABLE public.pool_agg_stats OWNER TO graft;
--
-- Name: pool_blocks; Type: TABLE; Schema: public; Owner: graft
-- Name: pool_blocks; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.pool_blocks (
......@@ -94,10 +88,8 @@ CREATE TABLE public.pool_blocks (
);
ALTER TABLE public.pool_blocks OWNER TO graft;
--
-- Name: pool_fetches; Type: TABLE; Schema: public; Owner: graft
-- Name: pool_fetches; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.pool_fetches (
......@@ -108,10 +100,8 @@ CREATE TABLE public.pool_fetches (
);
ALTER TABLE public.pool_fetches OWNER TO graft;
--
-- Name: pool_fetches_id_seq; Type: SEQUENCE; Schema: public; Owner: graft
-- Name: pool_fetches_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.pool_fetches_id_seq
......@@ -122,17 +112,15 @@ CREATE SEQUENCE public.pool_fetches_id_seq
CACHE 1;
ALTER TABLE public.pool_fetches_id_seq OWNER TO graft;
--
-- Name: pool_fetches_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: graft
-- Name: pool_fetches_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.pool_fetches_id_seq OWNED BY public.pool_fetches.id;
--
-- Name: pool_stats; Type: TABLE; Schema: public; Owner: graft
-- Name: pool_stats; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.pool_stats (
......@@ -151,10 +139,8 @@ CREATE TABLE public.pool_stats (
);
ALTER TABLE public.pool_stats OWNER TO graft;
--
-- Name: pool_hashrate_chart; Type: MATERIALIZED VIEW; Schema: public; Owner: graft
-- Name: pool_hashrate_chart; Type: MATERIALIZED VIEW; Schema: public; Owner: -
--
CREATE MATERIALIZED VIEW public.pool_hashrate_chart AS
......@@ -167,10 +153,8 @@ CREATE MATERIALIZED VIEW public.pool_hashrate_chart AS
WITH NO DATA;
ALTER TABLE public.pool_hashrate_chart OWNER TO graft;
--
-- Name: pools; Type: TABLE; Schema: public; Owner: graft
-- Name: pools; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.pools (
......@@ -181,14 +165,13 @@ CREATE TABLE public.pools (
api_url text NOT NULL,
api text NOT NULL,
enabled boolean DEFAULT true NOT NULL,
location text
location text,
payment_system text
);
ALTER TABLE public.pools OWNER TO graft;
--
-- Name: pools_id_seq; Type: SEQUENCE; Schema: public; Owner: graft
-- Name: pools_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.pools_id_seq
......@@ -200,31 +183,29 @@ CREATE SEQUENCE public.pools_id_seq
CACHE 1;
ALTER TABLE public.pools_id_seq OWNER TO graft;
--
-- Name: pools_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: graft
-- Name: pools_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.pools_id_seq OWNED BY public.pools.id;
--
-- Name: pool_fetches id; Type: DEFAULT; Schema: public; Owner: graft
-- Name: pool_fetches id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pool_fetches ALTER COLUMN id SET DEFAULT nextval('public.pool_fetches_id_seq'::regclass);
--
-- Name: pools id; Type: DEFAULT; Schema: public; Owner: graft
-- Name: pools id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pools ALTER COLUMN id SET DEFAULT nextval('public.pools_id_seq'::regclass);
--
-- Name: pool_admin_pass pool_admin_pass_pkey; Type: CONSTRAINT; Schema: public; Owner: graft
-- Name: pool_admin_pass pool_admin_pass_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pool_admin_pass
......@@ -232,7 +213,7 @@ ALTER TABLE ONLY public.pool_admin_pass
--
-- Name: pool_blocks pool_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: graft
-- Name: pool_blocks pool_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pool_blocks
......@@ -240,7 +221,7 @@ ALTER TABLE ONLY public.pool_blocks
--
-- Name: pool_fetches pool_fetches_pkey; Type: CONSTRAINT; Schema: public; Owner: graft
-- Name: pool_fetches pool_fetches_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pool_fetches
......@@ -248,7 +229,7 @@ ALTER TABLE ONLY public.pool_fetches
--
-- Name: pool_stats pool_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: graft
-- Name: pool_stats pool_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pool_stats
......@@ -256,7 +237,7 @@ ALTER TABLE ONLY public.pool_stats
--
-- Name: pools pools_name_key; Type: CONSTRAINT; Schema: public; Owner: graft
-- Name: pools pools_name_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pools
......@@ -264,7 +245,7 @@ ALTER TABLE ONLY public.pools
--
-- Name: pools pools_pkey; Type: CONSTRAINT; Schema: public; Owner: graft
-- Name: pools pools_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pools
......@@ -272,28 +253,28 @@ ALTER TABLE ONLY public.pools
--
-- Name: pool_agg_stats_pool_idx; Type: INDEX; Schema: public; Owner: graft
-- Name: pool_agg_stats_pool_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX pool_agg_stats_pool_idx ON public.pool_agg_stats USING btree (pool);
--
-- Name: pool_blocks_hash_idx; Type: INDEX; Schema: public; Owner: graft
-- Name: pool_blocks_hash_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX pool_blocks_hash_idx ON public.pool_blocks USING btree (hash);
--
-- Name: pool_fetches_time_idx; Type: INDEX; Schema: public; Owner: graft
-- Name: pool_fetches_time_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX pool_fetches_time_idx ON public.pool_fetches USING btree ("time" DESC);
--
-- Name: pool_blocks pool_blocks_pool_fkey; Type: FK CONSTRAINT; Schema: public; Owner: graft
-- Name: pool_blocks pool_blocks_pool_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pool_blocks
......@@ -301,7 +282,7 @@ ALTER TABLE ONLY public.pool_blocks
--
-- Name: pool_stats pool_stats_pool_fetch_fkey; Type: FK CONSTRAINT; Schema: public; Owner: graft
-- Name: pool_stats pool_stats_pool_fetch_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pool_stats
......@@ -309,7 +290,7 @@ ALTER TABLE ONLY public.pool_stats
--
-- Name: pool_stats pool_stats_pool_fkey; Type: FK CONSTRAINT; Schema: public; Owner: graft
-- Name: pool_stats pool_stats_pool_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pool_stats
......
......@@ -27,7 +27,6 @@
<div class="height" title="The current block height that the network is trying to solve, i.e. the largest height found plus one"><label>Height:</label> <div id="height">Loading...</div></div>
<div class="pools_speed" title="This is the sum of hash rates of all pools on this list, excluding desynchronized pools"><label class="long">Pools Speed:</label><label class="short">Pools Sp.:</label> <div id="pools-speed">Loading...</div></div>
<div class="block_exp"><label>Block Explorer:</label> <div>
<a href="https://graft.observer">Graft.observer</a><br/>
<a href="https://blockexplorer.graft.network">Official</a>
</div></div>
</div>
......@@ -84,8 +83,8 @@
<div class="stats">
<div><label class="long">Last update:</label><label class="short">Updated:</label> <div id="updated">Never</div></div>
<div><label class="long">Additions /<br/>Changes:</label><label class="short">Contact:</label> <div>
<a href="https://t.me/jagerman42">Telegram</a><br/>
<a href="mailto:graft@imaginary.stream">E-mail</a>
<a href="https://t.me/FIXME">Telegram</a><br/>
<a href="mailto:FIXME@example.com">E-mail</a>
</div></div>
</div>
<div class="clear"></div>
......
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