CypherNetFirstInstallAttempt

From Traxel Wiki
Jump to navigation Jump to search

Nostr Relay Setup

Server Baseline

ssh admin@52.11.172.130
sudo apt update && sudo apt dist-upgrade -y
sudo apt install -y emacs-nox

Greasy Kid Stuff

mkdir -p /home/admin/.local/bin
chmod go-rwx /home/admin/.local
mkdir -p /home/admin/.local/lib

Python

sudo apt install -y python3 python3-pip python-is-python3
sudo pip install --upgrade pip
python --version
pip --version

Install Uvicorn

pip install 'uvicorn[standard]'

Warnings

Attempted to address the following by creating .local/bin and .local/lib during "Greasy Kid Stuff" above.

Installing collected packages: websockets, uvloop, typing-extensions, sniffio, python-dotenv, httptools, h11, exceptiongroup, click, uvicorn, anyio, watchfiles
  WARNING: The script dotenv is installed in '/home/admin/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script uvicorn is installed in '/home/admin/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script watchfiles is installed in '/home/admin/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Test Uvicorn

mkdir -p projects/test-uvicorn
cd projects/test-uvicorn
emacs -nw main.py
async def app(scope, receive, send):
    assert scope['type'] == 'http'

    await send({
        'type': 'http.response.start',
        'status': 200,
        'headers': [
            [b'content-type', b'text/plain'],
        ],
    })
    await send({
        'type': 'http.response.body',
        'body': b'Hello, world!',
    })

    pass # end main
uvicorn main:app

On client box

ssh -i path/to/key.pem -L 8989:127.0.0.1:8000 admin@52.11.172.130 -N

http://localhost:8989/