G3W-SUITE scripts and configuration files needed to set up a suitable local development enviroment for the g3w-client cartographic viewer.
Download and install Node.js and NPM and Docker Compose in your development enviroment.
Clone and place the g3w-suite-docker, g3w-admin and g3w-client repositories into three separated adjacent folders:
cd /path/to/your/development/workspace
git clone https://github.com/g3w-suite/g3w-suite-docker.git --single-branch --branch dev ./g3w-suite-docker
git clone https://github.com/g3w-suite/g3w-admin.git --single-branch --branch dev ./g3w-admin
git clone https://github.com/g3w-suite/g3w-client.git --single-branch --branch dev ./g3w-client
Download all javascript and docker dependencies from within your g3w-client local repository:
cd ./g3w-client
npm install # javascript dependencies (client)
npm run docker pull # docker dependencies (admin)
Create these configuration files from the available templates:
/g3w-client/config.js
← config.template.js/g3w-suite-docker/.env
← .env.example/g3w-suite-docker/config/g3w-suite/settings_docker.py
← settings_docker.py/g3w-suite-docker/shared-volume/
← add this folder if it doesn't exist
And check that the following parameters are set as follows:
# /g3w-suite-docker/.env
WEBGIS_DOCKER_SHARED_VOLUME=./shared-volume # path to docker container shared volume
G3WSUITE_LOCAL_CODE_PATH=../g3w-admin # path to local g3w-admin folder
G3WSUITE_DEBUG=True # default: False
Now your folder structure should matches this one:
.
├── g3w-admin/
│
├── g3w-client/
│ ├── node_modules/
│ ├── package.json
│ ├── package-lock.json
│ └── config.js
│
└── g3w-suite-docker/
├── config/
│ └── g3w-suite/
│ └── settings_docker.py
├── shared-volume/
├── scripts/
│ └── docker-entrypoint-dev.sh
├── .env
├── docker-compose-dev.yml
└── README_DEV.md
For more info about this project dependencies see:
From within your g3w-client local repository:
cd ./g3w-client
You can start the built-in development servers by using the following:
npm run docker:up # backend server (g3w-admin)
npm run dev # frontend server (g3w-client)
If everything went fine, you can now visit you local development server URL to see changes, the following rules are applied:
# EXAMPLE 1:
# project_group = "countries";
# project_type = "qdjango";
# project_id = "1"
http://localhost:8000/en/map/countries/qdjango/1 # g3w-admin (production)
http://localhost:3000/en/map/countries/qdjango/1 # g3w-client (development)
# EXAMPLE 2:
# project_group = "eleprofile";
# project_type = "qdjango";
# project_id = "2"
http://localhost:8000/en/map/eleprofile/qdjango/2 # g3w-admin (production)
http://localhost:3000/en/map/eleprofile/qdjango/2 # g3w-client (development)
If you want develop custom plugins you need to place them in the src/plugins
folder, below you can see some examples:
- base-template
- editing
- eleprofile
- openrouteservice
- qplotly
- qtimeseries
- queryresult-template
- sidebar-template
1. How can I start or stop docker containers?
For those unfamiliar with docker development docker-compose is a tool for defining and running multi-container applications.
Below are described the most frequent commands, that are also available here in this repository as npm scripts, you can find similar information by running npm run
from the command line.
Define and run the services that make up the g3w-client (admin) development server:
docker
docker compose --env-file ../g3w-suite-docker/.env --file ../g3w-suite-docker/docker-compose-dev.yml --project-name g3w-suite-docker --project-directory ../g3w-suite-docker
Create and start containers (run default admin server at localhost:8000):
docker:up
npm run docker up -- -d
Stop and remove containers, networks, images, and volumes:
docker:down
npm run docker down
Validate and view the Compose file (load and parse docker-compose-dev.yml and .env variables):
docker:config
npm run docker config
View output from containers:
docker:logs
npm run docker logs
For more info:
2. How can I inspect actual docker configuration?
If you are having trouble with your current project configuration you can use the docker config command to inspect the actual values of the variables passed to your docker container:
npm run docker config
If your container struggles to boot properly you can also use the docker logs command related to a specific container:
npm run docker logs g3w-suite -- -f
npm run docker logs postgis -- -f
For more info:
3. How can I translate this project?
Depending on your current project version, you can edit one of the following files and then submit a pull request:
/g3w-client/src/locales/
(> v3.4)/g3w-client/src/config/i18n/index.js
(<= v3.4)
All notable changes to this project are documented in the releases page.
License: MPL-2