(2021-04-25) Move To DigitalOcean

I gave up ((2021-03-01) Massive Server Upgrade) and asked friend for help in setting up wildcard-SSL. She, who had nudged me to Linode years ago, suggesting after some initial work, that I move to Digital Ocean. So doing that.


  • Set up $20/mo droplet, generate keypair for login security.
  • set up GitLab for code (I had never pushed to GitHub)
  • update nameserver info at hover to point to DigitalOcean, set up domain there. (adding this line after the fact)
  • SSL certbot certonly --server https://acme-v02.api.letsencrypt.org/directory --agree-tos --manual --preferred-challenges dns -d 'flux.garden,*.flux.garden' → have to manually enter the TXT DNS record - I think there's no auto-renew with this approach...
Congratulations! Your certificate and chain have been saved at:
   Your key file has been saved at:
   Your cert will expire on 2021-07-25. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"


  • ugh realize my git is a mess - I had done a bunch of commits up until Jan27, then I just copied the whole folder (within py2) to a new (py3) location and started (2021-02-07) Migrating to Python3, and never committed again.... Today I just directly scp'd my current code to DigitalOcean, then later pushed by py3 to GitLab without having updated it.
  • my friend just took my fresh code and committed it
  • she says: "The best way to clear out git is to clone into a new dir, overwrite everything you want to overwrite, commit, push". I was thinking I could do a git pull, but then realized it wouldn't be happy because I have changes that are a branch off.... So rename my local folder, then do git clone to get fresh copy.
  • do flask run on server, → fail
  File "/home/bill/wikiweb/config.py", line 4, in Config
    SECRET_KEY = os.environ["SECRET_KEY"]
  File "/usr/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'SECRET_KEY'
  • there's a .envfile which contains SECRET_KEY
  • do pip3 install python-dotenv then try again
  • wait is dotenv supposed to read .envfile or .flaskenv? Ah, .env - so cp .envfile .env
  • now flask run runs, though it's the fake-server not nginx
  • do local curl localhost:5000/webseitz and get a flask error page, so that's promising...
  • kill that server, launch the uwsgi (sudo systemctl restart wikiweb), hit, get promising redirect-then-fail
  • check logs (/var/log/uwsgi/wikiweb.log etc) - need password for db (before didn't need password, psql was just accepting local connections)


  • password and other info is in .envfile - add DATABASE_URL='postgresql://username:password@host:port/database' to that
  • still not working


  • realize that still needed to install some libraries, did that. Now all the webseitz variations work (both outer and inner).
  • the 'hunter' host redirecting - ah, that account isn't set to paid, so it redirects you to log in, then tells you that.


  • fix my local /etc/hosts file to stop grabbing flux.garden and instead grab flux2.garden - now the real one goes out to the real dig-ocean server so I can test the live server right. Hitting it fine.
  • edit hunter record so it's paid/permitted, then hit that → outer shows fine, can log in, can edit inner, etc - so feels like digO server passes tests....

How have to get my local server running again, after the various git games... so I can continue the code on that side.


  • commit/push on server for the config/db-url change
  • pull to laptop
  • copy over .env and .flaskenv from previous place
  • edit .env for the local db-url, and for `SERVER_NAME = 'flux2.garden:5000'
  • flask runcommand not found: flask
  • derp I wasn't in venv; flask run → running - so this is latest on how to launch on laptop - remember to have psql running first
  • hit http://flux2.garden:5000/ get splash page!
  • hit http://webseitz.flux2.garden:5000/wiki get FrontPage!


  • notice that there are directories of code duplicated at various levels of my code tree.
  • delete all the dupes, commit


Edited:    |       |    Search Twitter for discussion