A minimal GeoNode 5 Project, for educational purposes and local testing.
Install Docker for your OS, then just run:
git clone https://github.com/geosolutions-it/geonode-workshop.git
cd geonode-workshop
python3 create-envfile.py
docker compose build
docker compose up -d🍵 Take a cup of tea, and relax. The build and startup will take some time.
🕐 In a few minutes your local GeoNode will be visible at http://localhost
👍 The login access will be printed inside the .env file under ADMIN_USERNAME and ADMIN_PASSWORD
-
You can adapt the
.envfile if you want to change the default secrets and configuration. -
You can also re-generate the
.envfile thrugh thecreate-envfile.pyscriptcreate-envfile.pyaccepts the following arguments:--https: Enable SSL. It's disabled by default--env_type:- When set to
prodDEBUGis disabled and the creation of a validSSLis requested to Letsencrypt's ACME server - When set to
testDEBUGis disabled and a testSSLcertificate is generated for local testing - When set to
devDEBUGis enabled and noSSLcertificate is generated --hostname: The URL that whill serve GeoNode (localhostby default)--email: The administrator's email. Notice that a real email and a valid SMPT configurations are required if--env_typeis seto toprod. Letsencrypt uses to email for issuing the SSL certificate--geonodepwd: GeoNode's administrator password. A random value is set if left empty--geoserverpwd: GeoNode's administrator password. A random value is set if left empty--pgpwd: PostgreSQL's administrator password. A random value is set if left empty--dbpwd: GeoNode DB user role's password. A random value is set if left empty--geodbpwd: GeoNode data DB user role's password. A random value is set if left empty--clientid: Client id of Geoserver's GeoNode Oauth2 client. A random value is set if left empty--clientsecret: Client secret of Geoserver's GeoNode Oauth2 client. A random value is set if left empty
Example USAGE
python create-envfile.py -f /opt/core/geonode-project/file.json \
--hostname localhost \
--https \
--email random@email.com \
--geonodepwd gn_password \
--geoserverpwd gs_password \
--pgpwd pg_password \
--dbpwd db_password \
--geodbpwd _db_password \
--clientid 12345 \
--clientsecret abc123 Example JSON expected:
{
"hostname": "value",
"https": "value",
"email": "value",
"geonodepwd": "value",
"geoserverpwd": "value",
"pgpwd": "value",
"dbpwd": "value",
"geodbpwd": "value",
"clientid": "value",
"clientsecret": "value"
} Is also possible to start the project in development mode using the devcontainer.
In the project inside the .devcontainer folder there is a generate.py file. This file allow the developer to create all the files required to run the project in development mode.
Steps to generate the project for development:
- Generate the .env file as described in the Custom Setup
- Enter in the
.devcontainerfolder - Run the
generate.pyfile by specifying the project name. In this example the project name should begeonode_project
cd .devcontainer
python3 generate.py geonode_project
- The script will generate a different files and it should look like the following tree
(geonode) ➜ geonode-workshop git:(main) ✗ tree .devcontainer
.devcontainer
├── .env
├── .vscode/
├────── launch.json
├── devcontainer.json
├── docker-compose.yml
├── docker.sh
└── generate.py
- Use the docker.sh to run the containers
./docker.sh up -d --build - After the build, use the devcontainers utils to enter in the django container
SHIFT + CTRL + Pand click onReopen in container - Automatically the system will recognize the
launch.jsonfile to run the django application and therefore GeoNode