We need to setup Geonode with it's newest version to develop on. Oracle's VirtualBox is needed.This is not 100% complete and could miss some steps.
In the VM window:
- Follow installation wizard in VM with an ubuntu 22.04 image
- Setup name (e.g. gn)
- Setup password (e.g. gn)
- Choose your keyboard layout
- Restart
In the terminal: update os with
sudo apt update && sudo apt upgrade
sudo apt install openssh-server -y
To be able to access the webpage outside the VM we need to open port 8080. To work headless on the VM we need to open port 3022.
VirtualBox > YOurVirtualMqachine > Settings > Network > Advanced > Port Forward > add new port forwarding rule
Name | Protocol | Host IP | Guest IP | Guest Port |
---|---|---|---|---|
ssh | TCP | 3022 | 22 | |
8080 | TCP | 8080 | 80 |
In Powershell on host machine: ssh config
cd ~/.ssh
"
Host gn
HostName 127.0.0.1
Port 3022
user gn
IdentityFile ~/.ssh/vm_rsa
" | Out-File config -Append -Encoding utf8
setup rsa key
ssh-keygen
# Enter file in which to save the key (C:\Users\<user>/.ssh/id_rsa):
vm_rsa
scp vm_rsa.pub gn:~/.ssh/authorized_keys
# Are you sure you want to continue connecting (yes/no/[fingerprint])?
yes
# geonode-vm-321@127.0.0.1's password:
geonode
connect via ssh
ssh gn
Now we can work on the VM via ssh. Start VM in headless mode and connect in VSC-Remote_Explorer or in a terminal use
ssh gn
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
~/miniconda3/bin/conda init bash
~/miniconda3/bin/conda init zsh
conda create -n nfdi4bio
echo "conda activate nfdi4bio" >>~/.bashrc
conda activate nfdi4bio
sudo apt-get install git
sudo snap install docker
git clone https://github.com/Geonode-SEP-NFDI4Biodiversity/geonode ~/repositories/geonode
git clone git+https://github.com/Geonode-SEP-NFDI4Biodiversity/docker-compose-setup.git ~/repositories/docker-compose-setup
cd ~/repositories/geonode
cp ../docker-compose-setup/.env_nfdi4bio .
cp ../docker-compose-setup/docker-compose-nfdi4bio.yml .
cp ../docker-compose-setup/docker-compose-nfdi4bio.sh .
sudo chmod +x docker-compose-nfdi4bio.sh
printf "\n.env_nfdi4bio" >> .git/info/exclude
printf "\ndocker-compose-nfdi4bio.yml" >> .git/info/exclude
printf "\ndocker-compose-nfdi4bio.sh" >> .git/info/exclude
git switch nfdi4bio_development
sudo groupadd docker
sudo usermod -aG docker $USER
su $USER
dotenv --dotenv .env_nfdi4bio docker build -t geonode_dev .
When making changes to python files, you have to reload WSGI server:
./docker-compose-nfdi4bio.sh exec django touch /usr/src/geonode/geonode/wsgi.py
sudo service apache2 stop
dotenv --dotenv .env_nfdi4bio docker compose -f docker-compose-nfdi4bio.yml "$@"
attach geonode/postgis to shell (I used vsc)
psql -U postgres
\du
ALTER USER geonode Superuser;
ALTER USER geonode_data Superuser;
./docker-compose-nfdi4bio.sh exec django manage.py test --failfast
- Attach the container to VSC
- Install the python debugger extension on new VSC window, then reload window
- Create a launch json with e.g.:
{
"name": "Test",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"console": "integratedTerminal",
"justMyCode": false,
"args": [
"test", "geonode.catalogue", "--failfast"
]
}
- Set Breakpoints
- Run & Debug Test