CypherSetup: Difference between revisions
Jump to navigation
Jump to search
(9 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
Host wiki.deadmandao.com | Host wiki.deadmandao.com | ||
HostName wiki.deadmandao.com | HostName wiki.deadmandao.com | ||
User | User username | ||
IdentityFile /path/to/deadman/pem | IdentityFile /path/to/deadman/pem | ||
Host www.iterativechaos.com | Host www.iterativechaos.com | ||
HostName www.iterativechaos.com | HostName www.iterativechaos.com | ||
User | User username | ||
IdentityFile /path/to/deadman/pem | IdentityFile /path/to/deadman/pem | ||
Host nostr | Host nostr | ||
HostName 52.11.172.130 | HostName 52.11.172.130 | ||
User | User username | ||
IdentityFile /path/to/deadman/pem | IdentityFile /path/to/deadman/pem | ||
</pre> | </pre> | ||
Line 38: | Line 38: | ||
# cd /opt/cypherpunk/cypherpunk_reddit | # cd /opt/cypherpunk/cypherpunk_reddit | ||
python -m venv .venv | python -m venv .venv | ||
./.venv/bin/activate | . ./.venv/bin/activate | ||
pip install mysql-connector-python | pip install mysql-connector-python | ||
pip install jinja2 flask | pip install jinja2 flask | ||
pip install secp256k1 | pip install secp256k1 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Web Server == | == Web Server == | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cd /opt/cypherpunk/flask/cypunk | cd /opt/cypherpunk/flask/cypunk | ||
python -m venv flask-venv | python -m venv flask-venv | ||
./flask-venv/bin/activate | . ./flask-venv/bin/activate | ||
pip install --upgrade pip | pip install --upgrade pip | ||
pip install flask python-dateutil pyjwt mysql.connector pathlib passlib secp256k1 websockets | pip install flask python-dateutil pyjwt mysql.connector pathlib passlib secp256k1 websockets | ||
cd ~/projects/ | cd ~/projects/ | ||
git clone wiki.deadmandao.com:/opt/cryptopunk/git/cryptopunk_reddit | git clone wiki.deadmandao.com:/opt/cryptopunk/git/cryptopunk_reddit | ||
rsync -avz --exclude=__pycache__ app/ /opt/cypherpunk/flask/cypunk/ | cd ~/projects/cypherpunk_reddit/flask/test_cypherpunk/ | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash"> | |||
rsync -avz --exclude=__pycache__ /home/admin/projects/cypherpunk/cypherpunk_reddit/flask/test_cypherpunk/app/ /opt/cypherpunk/flask/cypunk/ | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 78: | Line 82: | ||
id int not null primary key auto_increment, | id int not null primary key auto_increment, | ||
user_id int not null, | user_id int not null, | ||
privhex varchar(256) not null | privhex varchar(256) not null unique key, | ||
pubhex varchar(256) not null unique key | |||
); | ); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 87: | Line 92: | ||
; | ; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
= Apache Conf = | |||
<pre> | |||
WSGIDaemonProcess app user=www-data group=www-data threads=5 python-home=/opt/cypherpunk/flask/cypunk/flask-venv | |||
WSGIScriptAlias / /opt/cypherpunk/flask/cypunk/flask-app.wsgi | |||
<Directory /opt/cypherpunk/flask/cypunk> | |||
WSGIProcessGroup app | |||
WSGIApplicationGroup %{GLOBAL} | |||
Order deny,allow | |||
Require all granted | |||
</Directory> | |||
</pre> | |||
= Old Version = | = Old Version = | ||
== Host Setup == | == Host Setup == |
Latest revision as of 18:49, 18 December 2023
SSH Config
Host wiki.deadmandao.com HostName wiki.deadmandao.com User username IdentityFile /path/to/deadman/pem Host www.iterativechaos.com HostName www.iterativechaos.com User username IdentityFile /path/to/deadman/pem Host nostr HostName 52.11.172.130 User username IdentityFile /path/to/deadman/pem
Host Setup
Data Pipeline
mkdir -p /opt/cypherpunk/cypherpunk_reddit
cd /opt/cypherpunk/cypherpunk_reddit
ln -s /home/bob/projects/cypherpunk/cypherpunk_reddit/html ./
ln -s /home/bob/projects/cypherpunk/cypherpunk_reddit/archive ./
ln -s /home/bob/projects/cypherpunk/cypherpunk_reddit/config ./
Web Server
mkdir -p /opt/cypherpunk/flask/cypunk
Python Venv
Data Pipeline
# cd /opt/cypherpunk/cypherpunk_reddit
python -m venv .venv
. ./.venv/bin/activate
pip install mysql-connector-python
pip install jinja2 flask
pip install secp256k1
Web Server
cd /opt/cypherpunk/flask/cypunk
python -m venv flask-venv
. ./flask-venv/bin/activate
pip install --upgrade pip
pip install flask python-dateutil pyjwt mysql.connector pathlib passlib secp256k1 websockets
cd ~/projects/
git clone wiki.deadmandao.com:/opt/cryptopunk/git/cryptopunk_reddit
cd ~/projects/cypherpunk_reddit/flask/test_cypherpunk/
rsync -avz --exclude=__pycache__ /home/admin/projects/cypherpunk/cypherpunk_reddit/flask/test_cypherpunk/app/ /opt/cypherpunk/flask/cypunk/
MariaDB
apt install mariadb-server mariadb-client
sudo mariadb
create user 'cypunk'@'localhost' identified by 'password';
grant all on cypunk.* to 'cypunk'@'localhost';
flush privileges;
exit;
create database if not exists cypunk;
-- drop table if exists cypunk.user;
create table if not exists cypunk.user (
id int not null primary key auto_increment,
username varchar(128) not null unique key,
salty_hash varchar(256) not null
);
-- drop table if exists cypunk.nostr_user;
create table if not exists cypunk.nostr_user (
id int not null primary key auto_increment,
user_id int not null,
privhex varchar(256) not null unique key,
pubhex varchar(256) not null unique key
);
insert into cypunk.user ( username, salty_hash )
values ('test1', 'saltyhash'),
('test2', 'anotherhash')
;
Apache Conf
WSGIDaemonProcess app user=www-data group=www-data threads=5 python-home=/opt/cypherpunk/flask/cypunk/flask-venv WSGIScriptAlias / /opt/cypherpunk/flask/cypunk/flask-app.wsgi <Directory /opt/cypherpunk/flask/cypunk> WSGIProcessGroup app WSGIApplicationGroup %{GLOBAL} Order deny,allow Require all granted </Directory>
Old Version
Host Setup
mkdir -p /opt/cypherpunk/cypherpunk_reddit
cd /opt/cypherpunk/cypherpunk_reddit
ln -s /home/bob/projects/cypherpunk/cypherpunk_reddit/html ./
ln -s /home/bob/projects/cypherpunk/cypherpunk_reddit/archive ./
ln -s /home/bob/projects/cypherpunk/cypherpunk_reddit/config ./
Python Venv
python -m venv .venv
./.venv/bin/activate
pip install mysql-connector-python
pip install jinja2 flask
pip install secp256k1
MariaDB
apt install mariadb-server mariadb-client
sudo mariadb
create user 'cypunk'@'localhost' identified by 'password';
grant all on cypunk.* to 'cypunk'@'localhost';
flush privileges;
exit;
create database if not exists cypunk;
-- drop table if exists cypunk.user;
create table if not exists cypunk.user (
id int not null primary key auto_increment,
username varchar(128) not null unique key,
salty_hash varchar(256) not null
);
-- drop table if exists cypunk.nostr_user;
create table if not exists cypunk.nostr_user (
id int not null primary key auto_increment,
user_id int not null,
privhex varchar(256) not null
);
insert into cypunk.user ( username, salty_hash )
values ('test1', 'saltyhash'),
('test2', 'anotherhash')
;