(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)
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: /etc/letsencrypt/live/flux.garden/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/flux.garden/privkey.pem 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 cloneto get fresh copy.
flask runon 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
.envfilewhich contains SECRET_KEY
pip3 install python-dotenvthen try again
- wait is dotenv supposed to read
cp .envfile .env
flask runruns, though it's the fake-server not nginx
- do local
curl localhost:5000/webseitzand 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.logetc) - need password for db (before didn't need password, psql was just accepting local connections)
- password and other info is in
- still not working
- realize that still needed to install some libraries, did that. Now all the
webseitzvariations 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/hostsfile to stop grabbing
flux.gardenand 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.
hunterrecord 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
.flaskenvfrom previous place
.envfor the local db-url, and for `SERVER_NAME = 'flux2.garden:5000'
command not found: flask
- derp I wasn't in
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