-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Salt State scripts for runtime initialization.
- Loading branch information
Showing
5 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% set CONDA_HOME = salt['environ.get']('CONDA_HOME') %} | ||
{% set TETHYS_HOME = salt['environ.get']('TETHYS_HOME') %} | ||
{% set TETHYS_PERSIST = salt['environ.get']('TETHYS_PERSIST') %} | ||
{% set DAM_INVENTORY_MAX_DAMS = salt['environ.get']('DAM_INVENTORY_MAX_DAMS') %} | ||
{% set EARTH_ENGINE_PRIVATE_KEY_FILE = salt['environ.get']('EARTH_ENGINE_PRIVATE_KEY_FILE') %} | ||
{% set EARTH_ENGINE_SERVICE_ACCOUNT_EMAIL = salt['environ.get']('EARTH_ENGINE_SERVICE_ACCOUNT_EMAIL') %} | ||
{% set THREDDS_SERVICE_NAME = 'tethys_thredds' %} | ||
{% set POSTGIS_SERVICE_NAME = 'tethys_postgis' %} | ||
|
||
Sync_Apps: | ||
cmd.run: | ||
- name: > | ||
. {{ CONDA_HOME }}/bin/activate tethys && | ||
tethys db sync | ||
- shell: /bin/bash | ||
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/init_apps_setup_complete" ];" | ||
|
||
Set_Custom_Settings: | ||
cmd.run: | ||
- name: > | ||
. {{ CONDA_HOME }}/bin/activate tethys && | ||
tethys app_settings set dam_inventory max_dams {{ DAM_INVENTORY_MAX_DAMS }} && | ||
tethys app_settings set earth_engine service_account_email {{ EARTH_ENGINE_SERVICE_ACCOUNT_EMAIL }} && | ||
tethys app_settings set earth_engine private_key_file {{ EARTH_ENGINE_PRIVATE_KEY_FILE }} | ||
- shell: /bin/bash | ||
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/init_apps_setup_complete" ];" | ||
|
||
Link_Tethys_Services_to_Apps: | ||
cmd.run: | ||
- name: > | ||
. {{ CONDA_HOME }}/bin/activate tethys && | ||
tethys link persistent:{{ POSTGIS_SERVICE_NAME }} dam_inventory:ps_database:primary_db && | ||
tethys link persistent:{{ POSTGIS_SERVICE_NAME }} postgis_app:ps_database:flooded_addresses && | ||
tethys link spatial:{{ THREDDS_SERVICE_NAME }} thredds_tutorial:ds_spatial:thredds_service | ||
- shell: /bin/bash | ||
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/init_apps_setup_complete" ];" | ||
|
||
Sync_App_Persistent_Stores: | ||
cmd.run: | ||
- name: > | ||
. {{ CONDA_HOME }}/bin/activate tethys && | ||
tethys syncstores all | ||
- shell: /bin/bash | ||
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/init_apps_setup_complete" ];" | ||
|
||
Flag_Init_Apps_Setup_Complete: | ||
cmd.run: | ||
- name: touch {{ TETHYS_PERSIST }}/init_apps_setup_complete | ||
- shell: /bin/bash | ||
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/init_apps_setup_complete" ];" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{% set CONDA_HOME = salt['environ.get']('CONDA_HOME') %} | ||
{% set TETHYS_PERSIST = salt['environ.get']('TETHYS_PERSIST') %} | ||
{% set STATIC_ROOT = salt['environ.get']('STATIC_ROOT') %} | ||
|
||
Move_Custom_Theme_Files_to_Static_Root: | ||
cmd.run: | ||
- name: mv /tmp/custom_theme {{ STATIC_ROOT }} | ||
- shell: /bin/bash | ||
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/custom_theme_setup_complete" ];" | ||
|
||
Apply_Custom_Theme: | ||
cmd.run: | ||
- name: > | ||
. {{ CONDA_HOME }}/bin/activate tethys && | ||
tethys site | ||
--title "My Custom Portal" | ||
--tab-title "My Custom Portal" | ||
--library-title "Tools" | ||
--primary-color "#01200F" | ||
--secondary-color "#358600" | ||
--background-color "#ffffff" | ||
--logo "/custom_theme/images/leaf-logo.png" | ||
--favicon "/custom_theme/images/favicon.ico" | ||
--copyright "Copyright © 2021 My Organization" | ||
- shell: /bin/bash | ||
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/custom_theme_setup_complete" ];" | ||
|
||
Flag_Custom_Theme_Setup_Complete: | ||
cmd.run: | ||
- name: touch {{ TETHYS_PERSIST }}/custom_theme_setup_complete | ||
- shell: /bin/bash | ||
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/custom_theme_setup_complete" ];" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% set CONDA_HOME = salt['environ.get']('CONDA_HOME') %} | ||
{% set TETHYS_PERSIST = salt['environ.get']('TETHYS_PERSIST') %} | ||
{% set TETHYS_DB_HOST = salt['environ.get']('TETHYS_DB_HOST') %} | ||
{% set TETHYS_DB_PORT = salt['environ.get']('TETHYS_DB_PORT') %} | ||
{% set TETHYS_DB_SUPERUSER = salt['environ.get']('TETHYS_DB_SUPERUSER') %} | ||
{% set TETHYS_DB_SUPERUSER_PASS = salt['environ.get']('TETHYS_DB_SUPERUSER_PASS') %} | ||
{% set THREDDS_TUTORIAL_TDS_USERNAME = salt['environ.get']('THREDDS_TUTORIAL_TDS_USERNAME') %} | ||
{% set THREDDS_TUTORIAL_TDS_PASSWORD = salt['environ.get']('THREDDS_TUTORIAL_TDS_PASSWORD') %} | ||
{% set THREDDS_TUTORIAL_TDS_PROTOCOL = salt['environ.get']('THREDDS_TUTORIAL_TDS_PROTOCOL') %} | ||
{% set THREDDS_TUTORIAL_TDS_HOST = salt['environ.get']('THREDDS_TUTORIAL_TDS_HOST') %} | ||
{% set THREDDS_TUTORIAL_TDS_PORT = salt['environ.get']('THREDDS_TUTORIAL_TDS_PORT') %} | ||
{% set THREDDS_SERVICE_NAME = 'tethys_thredds' %} | ||
{% set POSTGIS_SERVICE_NAME = 'tethys_postgis' %} | ||
{% set THREDDS_SERVICE_URL = THREDDS_TUTORIAL_TDS_USERNAME + ':' + THREDDS_TUTORIAL_TDS_PASSWORD + '@' + THREDDS_TUTORIAL_TDS_PROTOCOL +'://' + THREDDS_TUTORIAL_TDS_HOST + ':' + THREDDS_TUTORIAL_TDS_PORT %} | ||
{% set POSTGIS_SERVICE_URL = TETHYS_DB_SUPERUSER + ':' + TETHYS_DB_SUPERUSER_PASS + '@' + TETHYS_DB_HOST + ':' + TETHYS_DB_PORT %} | ||
|
||
Create_PostGIS_Database_Service: | ||
cmd.run: | ||
- name: ". {{ CONDA_HOME }}/bin/activate tethys && tethys services create persistent -n {{ POSTGIS_SERVICE_NAME }} -c {{ POSTGIS_SERVICE_URL }}" | ||
- shell: /bin/bash | ||
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/tethys_services_complete" ];" | ||
|
||
Create_THREDDS_Spatial_Dataset_Service: | ||
cmd.run: | ||
- name: ". {{ CONDA_HOME }}/bin/activate tethys && tethys services create spatial -t THREDDS -n {{ THREDDS_SERVICE_NAME }} -c {{ THREDDS_SERVICE_URL }}" | ||
- shell: /bin/bash | ||
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/tethys_services_complete" ];" | ||
|
||
Flag_Tethys_Services_Setup_Complete: | ||
cmd.run: | ||
- name: touch {{ TETHYS_PERSIST }}/tethys_services_complete | ||
- shell: /bin/bash | ||
- unless: /bin/bash -c "[ -f "{{ TETHYS_PERSIST }}/tethys_services_complete" ];" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
base: | ||
'*': | ||
- pre_tethys | ||
- tethyscore | ||
- tethys_services | ||
- init_apps | ||
- portal_theme | ||
- post_app |