Ran through the 'Ubuntu from Scratch' procedure using a fresh Ubuntu 22.04.3 LTS VM and took notes on what worked and what didn't.

Here's a summary of the changes and why

* added 'apt update' before the install -- only _needed_ on a completely fresh VM, but never hurts

* added an install of the virtualenv package, because it is used later but: do you still need it AND python3-venv? I'm assuming it was done that way for a reason.

* changed indentation on the mkdir so it will format correctly

* added `-D ~postgres` to the commands executed as postgres user because the postgres user does not, by default, have permission to read into real user's home directories (at least in 22.04) and so the commands would error out

* change `source <activate>` to `. activate` because the line `sudo -u umap -i` launches `sh`, not `bash`, and `sh` does not recognize the source command. `.` works in either.

* remove the instructions to change STATIC_ROOT and MEDIA_ROOT because they are already defaulted to those values in the current version sample of local.py

* added a notice to change the SECREY_KEY and ADMINS list just because it seemed like a good idea.

Side note: I have not seen any docs anywhere that explains exactly what the secret Key does, or where it is used. It's used a magic variable in the config file.. ?

I am not currently messing with nginx or wsgi, so I can't comment on those parts.
This commit is contained in:
John Martinez 2023-09-19 18:32:13 +00:00
parent 038a1a3c4d
commit 89cfa7d93d

View file

@ -6,13 +6,14 @@ You need sudo grants on this server, and it must be connected to Internet.
## Install system dependencies ## Install system dependencies
sudo apt install python3 python3-dev python3-venv wget nginx uwsgi uwsgi-plugin-python3 postgresql gcc postgis libpq-dev sudo apt update
sudo apt install python3 python3-dev python3-venv virtualenv wget nginx uwsgi uwsgi-plugin-python3 postgresql gcc postgis libpq-dev
*Note: nginx and uwsgi are not required for local development environment* *Note: nginx and uwsgi are not required for local development environment*
## Create deployment directories: ## Create deployment directories:
sudo mkdir -p /etc/umap sudo mkdir -p /etc/umap
*You can change this path, but then remember to adapt the other steps accordingly.* *You can change this path, but then remember to adapt the other steps accordingly.*
@ -33,17 +34,17 @@ on the various commands and configuration files if you go with your own.*
## Create a postgresql user ## Create a postgresql user
sudo -u postgres createuser umap sudo -u postgres -D ~postgres createuser umap
## Create a postgresql database ## Create a postgresql database
sudo -u postgres createdb umap -O umap sudo -u postgres -D ~postgres createdb umap -O umap
## Activate PostGIS extension ## Activate PostGIS extension
sudo -u postgres psql umap -c "CREATE EXTENSION postgis" sudo -u postgres -D ~postgres psql umap -c "CREATE EXTENSION postgis"
## Login as umap Unix user ## Login as umap Unix user
@ -55,8 +56,8 @@ From now on, unless we say differently, the commands are run as `umap` user.
## Create a virtualenv and activate it ## Create a virtualenv and activate it
virtualenv /srv/umap/venv --python=/usr/bin/python3.6 virtualenv /srv/umap/venv --python=/usr/bin/python3.10
source /srv/umap/venv/bin/activate . /srv/umap/venv/bin/activate
*Note: this activation is not persistent, so if you open a new terminal window, *Note: this activation is not persistent, so if you open a new terminal window,
you will need to run again this last line.* you will need to run again this last line.*
@ -75,12 +76,8 @@ you will need to run again this last line.*
nano /etc/umap/umap.conf nano /etc/umap/umap.conf
Change the following properties: * update the SECRET_KEY
* update the ADMINS list
```
STATIC_ROOT = '/srv/umap/var/static'
MEDIA_ROOT = '/srv/umap/var/data'
```
## Create the tables ## Create the tables