Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wis2box-create-config.py to generate configuration files #473

Closed
maaikelimper opened this issue Jun 21, 2023 · 4 comments
Closed

Add wis2box-create-config.py to generate configuration files #473

maaikelimper opened this issue Jun 21, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@maaikelimper
Copy link
Collaborator

In order to simplify the wis2box-configuration, we could have a script that is run from the command-line and asks the users for a series of questions and then generates the configuration-files.

So in addition to 'wis2box-ctl.py' we would have 'wis2box-create-config.py'

'wis2box-ctl.py' could run a test to check if the configuration-files are missing and suggest the user to run 'wis2box-create-config.py' first.

@maaikelimper maaikelimper added the enhancement New feature or request label Jun 21, 2023
@maaikelimper maaikelimper self-assigned this Jun 21, 2023
@maaikelimper
Copy link
Collaborator Author

maaikelimper commented Jun 21, 2023

  • Script asks for country/center-id and create data-mappings.yml for all 3 plugins for synop and for bufr for temp
  • Script to ask for wis2box-directory and create directory structure and create empty station_list.csv
  • Script to create basic discovery-metadata.yml in metadata/discovery/
  • Script to auto-generate unique default passwords

@maaikelimper
Copy link
Collaborator Author

@tomkralidis Can we provide default keywords for synop and temp discovery metadata ?

@maaikelimper
Copy link
Collaborator Author

maaikelimper commented Jun 30, 2023

I've created PR #476 for this.

Here is how it works:

The user executes the new script 'wis2box-create-config.py' and answers a series of question on the command-line:

PS C:\Users\maaik\Documents\GitHub\wis2box> python wis2box-create-config.py
The file dev.env already exists in the current directory.
Do you want to recreate dev.env? (y/n/exit)
y
Please enter the directory on the host where wis2box-configuration-files are to be stored:
C:\wis2box-data
Configuration-files will be stored in the following directory:
    C:\wis2box-data
Is this correct? (y/n/exit)
y
The directory C:\wis2box-data has been created.
Please enter the URL of the wis2box:
 When running the wis2box locally, the default is http://localhost
 To enable remote access, please enter the public IP address or domain name of the server hosting the wis2box.
http://127.0.0.1
The URL of the wis2box will be set to:
  http://127.0.0.1
Is this correct? (y/n/exit)
y
Do you want to use a randomly generated password for WIS2BOX_STORAGE_PASSWORD (y/n/exit)
y
WIS2BOX_STORAGE_PASSWORD=46G0urkH
Do you want to use a randomly generated password for WIS2BOX_BROKER_PASSWORD (y/n/exit)
y
WIS2BOX_BROKER_PASSWORD=Sde9QuCa
********************************************************************************
The file dev.env has been created in the current directory.
********************************************************************************
Please enter your 3-letter ISO country-code:
ITA
Please enter the centre-id for your wis2box:
maaike_test
The country-code will be set to:
  ita
The centre-id will be set to:
  maaike_test
Is this correct? (y/n/exit)
y
********************************************************************************
Creating initial configuration for surface and upper-air data.
********************************************************************************
Please enter the email address of the wis2box administrator:
me@gmail.com
The email address of the wis2box administrator will be set to:
    me@gmail.com
Is this correct? (y/n/exit)
y
Please enter the name of your organization:
Maaike TEST
Your organization name will be set to:
    Maaike TEST
Is this correct? (y/n/exit)
y
Getting bounding box for 'ita'.
bounding box: 6.6272658,35.2889616,18.7844746,47.0921462.
Do you want to use this bounding box? (y/n/exit)
y
Created new metadata-file:
    C:\wis2box-data/metadata/discovery/metadata-synop.yml
Created new metadata-file:
    C:\wis2box-data/metadata/discovery/metadata-temp.yml
********************************************************************************
Initial metadata files have been created in the directory C:\wis2box-data.
Please review the files and edit where necessary.
********************************************************************************
********************************************************************************
Initial data_mappings.yml and csv2bufr_mappings.json have been created
Please review the files and update them as needed.
********************************************************************************
********************************************************************************
Created the file C:\wis2box-data/metadata/station/station_list.csv.
Please add your stations to this file.
********************************************************************************
The configuration is complete.

Then start the wis2box:
PS C:\Users\maaik\Documents\GitHub\wis2box> python wis2box-ctl.py start

Login to the wis2box:
PS C:\Users\maaik\Documents\GitHub\wis2box> python wis2box-ctl.py login

Run the publish and add-collection commands:

root@05b5a305fd63:/home/wis2box# wis2box data add-collection /data/wis2box/metadata/discovery/metadata-synop.yml
Done
root@05b5a305fd63:/home/wis2box# wis2box data add-collection /data/wis2box/metadata/discovery/metadata-temp.yml
Done
root@05b5a305fd63:/home/wis2box# wis2box metadata discovery publish /data/wis2box/metadata/discovery/metadata-synop.yml
Publishing discovery metadata from /data/wis2box/metadata/discovery/metadata-synop.yml
Done
root@05b5a305fd63:/home/wis2box# wis2box metadata discovery publish /data/wis2box/metadata/discovery/metadata-temp.yml 
Publishing discovery metadata from /data/wis2box/metadata/discovery/metadata-temp.yml
Done

And visit the URL specified by the user to see:

image

@tomkralidis tomkralidis added this to the sprint-012 milestone Aug 21, 2023
@tomkralidis
Copy link
Collaborator

@tomkralidis to review by end of 30 August.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants