arches-he-sysref-funcs 1.0.1rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/Dockerfile +115 -0
  2. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/config.json +7 -0
  3. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker/conf.d/celerybeat.conf +23 -0
  4. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker/conf.d/celeryd.conf +22 -0
  5. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker/entrypoint.sh +275 -0
  6. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker/env_file.env +39 -0
  7. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker/init-unix.sql +17 -0
  8. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker/nginx-config/default.conf +7 -0
  9. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker/nginx-config/default_with_pg_serv.conf +15 -0
  10. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker/pg_featureserv_config/pg_featureserv.toml +68 -0
  11. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker/pg_tileserv_config/pg_tileserv.toml +90 -0
  12. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker/settings_local.py +81 -0
  13. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker/supervisor.conf +29 -0
  14. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker-compose-dependencies.yml +93 -0
  15. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker-compose-init.yml +21 -0
  16. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker-compose-persist-dependencies.yml +102 -0
  17. arches_he_sysref_funcs-1.0.1rc1/.ac_arches_he_sysref_funcs/docker-compose.yml +90 -0
  18. arches_he_sysref_funcs-1.0.1rc1/.babelrc +7 -0
  19. arches_he_sysref_funcs-1.0.1rc1/.browserslistrc +10 -0
  20. arches_he_sysref_funcs-1.0.1rc1/.coveragerc +30 -0
  21. arches_he_sysref_funcs-1.0.1rc1/.gitattributes +11 -0
  22. arches_he_sysref_funcs-1.0.1rc1/.github/actions/build-and-test-branch/action.yml +118 -0
  23. arches_he_sysref_funcs-1.0.1rc1/.github/actions/install-arches-applications/action.yml +29 -0
  24. arches_he_sysref_funcs-1.0.1rc1/.github/workflows/main.yml +280 -0
  25. arches_he_sysref_funcs-1.0.1rc1/.github/workflows/publish-to-pypi.yml +38 -0
  26. arches_he_sysref_funcs-1.0.1rc1/.gitignore +19 -0
  27. arches_he_sysref_funcs-1.0.1rc1/.pre-commit-config.yaml +34 -0
  28. arches_he_sysref_funcs-1.0.1rc1/.prettierrc +4 -0
  29. arches_he_sysref_funcs-1.0.1rc1/.stylelintrc.json +3 -0
  30. arches_he_sysref_funcs-1.0.1rc1/CONTRIBUTING.md +110 -0
  31. arches_he_sysref_funcs-1.0.1rc1/LICENSE +674 -0
  32. arches_he_sysref_funcs-1.0.1rc1/MANIFEST.in +1 -0
  33. arches_he_sysref_funcs-1.0.1rc1/PKG-INFO +177 -0
  34. arches_he_sysref_funcs-1.0.1rc1/README.md +147 -0
  35. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/__init__.py +0 -0
  36. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/apps.py +13 -0
  37. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/celery.py +13 -0
  38. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/datatypes/__init__.py +0 -0
  39. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/functions/README.md +69 -0
  40. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/functions/__init__.py +0 -0
  41. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/functions/generate_unique_references_function.py +238 -0
  42. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/hosts.py +11 -0
  43. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/locale/.gitkeep +0 -0
  44. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/management/__init__.py +0 -0
  45. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/management/commands/__init__.py +0 -0
  46. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/media/css/themes/_project.scss +6 -0
  47. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/media/img/favicon.png +0 -0
  48. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/media/js/reports/default.js +14 -0
  49. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/media/js/views/components/functions/generate-unique-references-function.js +67 -0
  50. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/migrations/90092_initial_generate_unique_refererences_function.py +47 -0
  51. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/migrations/__init__.py +0 -0
  52. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/search_components/__init__.py +0 -0
  53. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/search_indexes/__init__.py +0 -0
  54. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/search_indexes/sample_index.py +20 -0
  55. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/settings.py +442 -0
  56. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/src/arches_he_sysref_funcs/declarations.d.ts +4 -0
  57. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/src/arches_he_sysref_funcs/declarations.test.ts +1 -0
  58. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/system_settings/readme.txt +8 -0
  59. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/templates/custom_email_css.htm +1 -0
  60. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/templates/custom_email_footer.htm +0 -0
  61. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/templates/custom_email_header.htm +0 -0
  62. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/templates/email/download_ready_email_notification.htm +35 -0
  63. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/templates/email/general_notification.htm +56 -0
  64. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/templates/email/package_load_complete_email_notification.htm +31 -0
  65. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/templates/html_export/example-000000-0000-0000-0000-0000001.htm +90 -0
  66. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/templates/index.htm +548 -0
  67. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/templates/registration/password_reset_subject.txt +1 -0
  68. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/templates/views/components/functions/generate-unique-references-function.htm +40 -0
  69. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/urls.py +22 -0
  70. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs/wsgi.py +39 -0
  71. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs.egg-info/PKG-INFO +177 -0
  72. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs.egg-info/SOURCES.txt +100 -0
  73. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs.egg-info/dependency_links.txt +1 -0
  74. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs.egg-info/requires.txt +9 -0
  75. arches_he_sysref_funcs-1.0.1rc1/arches_he_sysref_funcs.egg-info/top_level.txt +1 -0
  76. arches_he_sysref_funcs-1.0.1rc1/eslint.config.mjs +43 -0
  77. arches_he_sysref_funcs-1.0.1rc1/gettext.config.js +43 -0
  78. arches_he_sysref_funcs-1.0.1rc1/manage.py +30 -0
  79. arches_he_sysref_funcs-1.0.1rc1/nodemon.json +5 -0
  80. arches_he_sysref_funcs-1.0.1rc1/package-lock.json +16312 -0
  81. arches_he_sysref_funcs-1.0.1rc1/package.json +34 -0
  82. arches_he_sysref_funcs-1.0.1rc1/pyproject.toml +42 -0
  83. arches_he_sysref_funcs-1.0.1rc1/releases/1.0.1.md +10 -0
  84. arches_he_sysref_funcs-1.0.1rc1/setup.cfg +4 -0
  85. arches_he_sysref_funcs-1.0.1rc1/tests/__init__.py +0 -0
  86. arches_he_sysref_funcs-1.0.1rc1/tests/fixtures/resource_graphs/second_test_model.json +1116 -0
  87. arches_he_sysref_funcs-1.0.1rc1/tests/fixtures/resource_graphs/test_model.json +1116 -0
  88. arches_he_sysref_funcs-1.0.1rc1/tests/generate_unique_references/__init__.py +0 -0
  89. arches_he_sysref_funcs-1.0.1rc1/tests/generate_unique_references/generate_unique_references_tests.py +309 -0
  90. arches_he_sysref_funcs-1.0.1rc1/tests/search_indexes/__init__.py +2 -0
  91. arches_he_sysref_funcs-1.0.1rc1/tests/search_indexes/sample_index_tests.py +43 -0
  92. arches_he_sysref_funcs-1.0.1rc1/tests/test_settings.py +77 -0
  93. arches_he_sysref_funcs-1.0.1rc1/tests/test_settings_for_docker.py.template +34 -0
  94. arches_he_sysref_funcs-1.0.1rc1/tsconfig.json +22 -0
  95. arches_he_sysref_funcs-1.0.1rc1/vitest.config.mts +66 -0
  96. arches_he_sysref_funcs-1.0.1rc1/vitest.setup.mts +15 -0
  97. arches_he_sysref_funcs-1.0.1rc1/webpack/README.md +23 -0
  98. arches_he_sysref_funcs-1.0.1rc1/webpack/webpack-utils/build-filepath-lookup.js +51 -0
  99. arches_he_sysref_funcs-1.0.1rc1/webpack/webpack-utils/find-file.js +24 -0
  100. arches_he_sysref_funcs-1.0.1rc1/webpack/webpack.common.js +516 -0
  101. arches_he_sysref_funcs-1.0.1rc1/webpack/webpack.config.dev.js +51 -0
  102. arches_he_sysref_funcs-1.0.1rc1/webpack/webpack.config.prod.js +40 -0
@@ -0,0 +1,115 @@
1
+ FROM python:3.11.8
2
+ USER root
3
+
4
+ ## Build Args
5
+ ARG PROJ_NAME=project
6
+ ARG ARCHES_PATH=./arches
7
+ ARG DOCKER_PATH=./docker
8
+
9
+ ## Setting default environment variables
10
+ ENV ARCHES_PROJECT=$PROJ_NAME
11
+ ENV WEB_ROOT=/web_root
12
+ ENV APP_ROOT=${WEB_ROOT}/${ARCHES_PROJECT}
13
+ ENV PKG_ROOT=${APP_ROOT}_package
14
+ ENV DATA_ROOT=${APP_ROOT}_data
15
+ # Root project folder
16
+ ENV ARCHES_ROOT=${WEB_ROOT}/arches
17
+ ENV WHEELS=/wheels
18
+ ENV PYTHONUNBUFFERED=1
19
+ ENV NODE_VERSION 20.14.0
20
+
21
+ RUN apt-get update && apt-get install -y make software-properties-common
22
+
23
+ # Get the pre-built python wheels from the build environment
24
+ RUN mkdir ${WEB_ROOT}
25
+ RUN mkdir ${PKG_ROOT}
26
+ RUN mkdir ${DATA_ROOT}
27
+
28
+ # Install packages required to run Arches
29
+ # Note that the ubuntu/debian package for libgdal1-dev pulls in libgdal1i, which is built
30
+ # with everything enabled, and so, it has a huge amount of dependancies (everything that GDAL
31
+ # support, directly and indirectly pulling in mysql-common, odbc, jp2, perl! ... )
32
+ # a minimised build of GDAL could remove several hundred MB from the container layer.
33
+ RUN apt-get install -y --no-install-recommends curl \
34
+ && apt-get update -y
35
+
36
+ RUN curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
37
+ && sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' \
38
+ && apt-get update -y
39
+
40
+ RUN set -ex \
41
+ && RUN_DEPS=" \
42
+ build-essential \
43
+ mime-support \
44
+ libgdal-dev \
45
+ postgresql-client-14 \
46
+ dos2unix \
47
+ " \
48
+ && apt-get install -y --no-install-recommends $RUN_DEPS
49
+
50
+
51
+ # nvm environment variables
52
+ ENV NVM_DIR /usr/local/nvm
53
+ RUN mkdir $NVM_DIR
54
+
55
+
56
+
57
+ # install nvm
58
+ # https://github.com/nvm-sh/nvm#install-script
59
+ RUN curl --silent -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash -
60
+
61
+ # install node and npm
62
+ RUN echo "source $NVM_DIR/nvm.sh \
63
+ && nvm install $NODE_VERSION \
64
+ && nvm alias default $NODE_VERSION \
65
+ && nvm use default" | bash -
66
+
67
+ # add node and npm to path so the commands are available
68
+ ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
69
+ ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
70
+
71
+ RUN apt install wait-for-it
72
+
73
+ RUN rm -rf /root/.cache/pip/*
74
+
75
+ # Install the Arches application
76
+ # FIXME: ADD from github repository instead?
77
+ COPY $ARCHES_PATH ${ARCHES_ROOT}
78
+ RUN chmod +x ${ARCHES_ROOT}/arches/install/arches_admin.py
79
+ RUN pip install --upgrade pip setuptools wheel
80
+
81
+ # Install project
82
+ COPY ./${PROJ_NAME} ${APP_ROOT}
83
+ WORKDIR ${APP_ROOT}
84
+ RUN pip install -e '.[dev]'
85
+
86
+ # From here, run commands from ARCHES_ROOT
87
+ WORKDIR ${ARCHES_ROOT}
88
+
89
+
90
+ RUN pip install -e '.[dev]'
91
+ RUN pre-commit install
92
+
93
+ COPY $DOCKER_PATH/entrypoint.sh /entrypoint.sh
94
+ RUN chmod -R 700 /entrypoint.sh && \
95
+ dos2unix /entrypoint.sh
96
+
97
+ WORKDIR ${WEB_ROOT}
98
+ RUN mkdir docker
99
+ COPY $DOCKER_PATH/settings_local.py ${WEB_ROOT}/docker/settings_local.py
100
+ COPY $DOCKER_PATH/conf.d ${WEB_ROOT}/docker/conf.d
101
+ COPY $DOCKER_PATH/supervisor.conf ${WEB_ROOT}/docker/supervisor.conf
102
+
103
+ RUN pip install supervisor
104
+ RUN mkdir /var/log/supervisor
105
+ RUN mkdir /var/log/celery
106
+
107
+ # Set default workdir
108
+ WORKDIR ${WEB_ROOT}
109
+
110
+ # # Set entrypoint
111
+ ENTRYPOINT ["/entrypoint.sh"]
112
+ CMD ["run_arches"]
113
+
114
+ # Expose port 8000
115
+ EXPOSE 8000
@@ -0,0 +1,7 @@
1
+ {
2
+ "project_name": "arches_he_sysref_funcs",
3
+ "project_name_url_safe": "archeshesysreffuncs",
4
+ "arches_version": "7.6",
5
+ "arches_repo_organization": "archesproject",
6
+ "arches_repo_branch": "stable/7.6.22"
7
+ }
@@ -0,0 +1,23 @@
1
+ ; ================================
2
+ ; celery beat supervisor
3
+ ; ================================
4
+
5
+ [program:celerybeat]
6
+ command=celery -A arches_he_sysref_funcs.celery beat --schedule=/tmp/celerybeat-schedule --loglevel=INFO --pidfile=/tmp/celerybeat.pid
7
+ directory=/web_root/arches_he_sysref_funcs
8
+ user=root
9
+ numprocs=1
10
+ stdout_logfile=/var/log/celery/beat.log
11
+ stderr_logfile=/var/log/celery/beat.log
12
+ autostart=true
13
+ autorestart=true
14
+ startsecs=60
15
+ ; Need to wait for currently executing tasks to finish at shutdown.
16
+ ; Increase this if you have very long running tasks.
17
+ stopwaitsecs = 600
18
+
19
+ ; Causes supervisor to send the termination signal (SIGTERM) to the whole process group.
20
+ stopasgroup=true
21
+ ; if rabbitmq is supervised, set its priority higher
22
+ ; so it starts first
23
+ priority=999
@@ -0,0 +1,22 @@
1
+ ; ==================================
2
+ ; celery worker supervisor
3
+ ; ==================================
4
+
5
+ [program:celery]
6
+ command=celery -A arches_he_sysref_funcs.celery worker --loglevel=INFO
7
+ directory=/web_root/arches_he_sysref_funcs
8
+ user=root
9
+ numprocs=1
10
+ stdout_logfile=/var/log/celery/worker.log
11
+ stderr_logfile=/var/log/celery/worker.log
12
+ autostart=true
13
+ autorestart=true
14
+ startsecs=10
15
+ ; Need to wait for currently executing tasks to finish at shutdown.
16
+ ; Increase this if you have very long running tasks.
17
+ stopwaitsecs = 600
18
+ ; Causes supervisor to send the termination signal (SIGTERM) to the whole process group.
19
+ stopasgroup=true
20
+ ; Set Celery priority higher than default (999)
21
+ ; so, if rabbitmq is supervised, it will start first.
22
+ priority=1000
@@ -0,0 +1,275 @@
1
+ #!/bin/bash
2
+
3
+ # APP and YARN folder locations
4
+ # ${WEB_ROOT} and ${ARCHES_ROOT} is defined in the Dockerfile, ${ARCHES_PROJECT} in env_file.env
5
+ if [[ -z ${ARCHES_PROJECT} ]]; then
6
+ APP_FOLDER=${ARCHES_ROOT}
7
+ PACKAGE_JSON_FOLDER=${ARCHES_ROOT}
8
+ else
9
+ APP_FOLDER=${WEB_ROOT}/${ARCHES_PROJECT}
10
+ PACKAGE_JSON_FOLDER=${APP_FOLDER}
11
+ fi
12
+
13
+ # SET DEFAULT WORKING DIRECTORY
14
+ cd ${APP_FOLDER}
15
+
16
+ #Utility functions that check db status
17
+ wait_for_db() {
18
+ echo "Testing if database server is up..."
19
+ while [[ ! ${return_code} == 0 ]]
20
+ do
21
+ psql --host=${PGHOST} --port=${PGPORT} --user=${PGUSERNAME} --dbname=postgres -c "select 1" >&/dev/null
22
+ return_code=$?
23
+ sleep 3
24
+ done
25
+ echo "Database server is up"
26
+
27
+ echo "Testing if Elasticsearch is up..."
28
+ while [[ ! ${return_code} == 0 ]]
29
+ do
30
+ curl -s "http://${ESHOST}:${ESPORT}/_cluster/health?wait_for_status=green&timeout=60s" >&/dev/null
31
+ return_code=$?
32
+ sleep 3
33
+ done
34
+ echo "Elasticsearch is up"
35
+ }
36
+
37
+ db_exists() {
38
+ echo "Checking if database "${PGDBNAME}" exists..."
39
+ count=`psql --host=${PGHOST} --port=${PGPORT} --user=${PGUSERNAME} --dbname=postgres -Atc "SELECT COUNT(*) FROM pg_catalog.pg_database WHERE datname='${PGDBNAME}'"`
40
+
41
+ # Check if returned value is a number and not some error message
42
+ re='^[0-9]+$'
43
+ if ! [[ ${count} =~ $re ]] ; then
44
+ echo "Error: Something went wrong when checking if database "${PGDBNAME}" exists..." >&2;
45
+ echo "Exiting..."
46
+ exit 1
47
+ fi
48
+
49
+ # Return 0 (= true) if database exists
50
+ if [[ ${count} > 0 ]]; then
51
+ echo "Checking if database is setup "${PGDBNAME}"..."
52
+ tcount=`psql --host=${PGHOST} --port=${PGPORT} --user=${PGUSERNAME} --dbname=${PGDBNAME} -Atc "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'public' AND table_name = 'nodes'"`
53
+ # Check if returned value is a number and not some error message
54
+ re='^[0-9]+$'
55
+ if ! [[ ${tcount} =~ $re ]] ; then
56
+ echo "Error: Something went wrong when checking if tables exists in database "${PGDBNAME}"..." >&2;
57
+ echo "Exiting..."
58
+ exit 1
59
+ fi
60
+
61
+ # Return 0 (= true) if table exists
62
+ if [[ ${tcount} > 0 ]]; then
63
+ return 0
64
+ else
65
+ return 1
66
+ fi
67
+ else
68
+ return 1
69
+ fi
70
+ }
71
+
72
+
73
+ #### Install
74
+ init_arches() {
75
+ echo "Checking if Arches project "${ARCHES_PROJECT}" exists..."
76
+ if [[ ! -d ${APP_FOLDER}/${ARCHES_PROJECT} ]] || [[ ! "$(ls ${APP_FOLDER}/${ARCHES_PROJECT})" ]]; then
77
+ echo ""
78
+ echo "----- Custom Arches project '${ARCHES_PROJECT}' does not exist. -----"
79
+ #echo "----- Use the "create_project" command to create the project and then restart the container -----"
80
+ echo ""
81
+ create_arches_project
82
+ else
83
+ echo "Custom Arches project '${ARCHES_PROJECT}' exists."
84
+ fi
85
+
86
+ wait_for_db
87
+ if db_exists; then
88
+ echo "Database ${PGDBNAME} already exists."
89
+ echo "Skipping Package Loading"
90
+ else
91
+ echo "Database ${PGDBNAME} does not exists yet."
92
+ run_setup_db #change to run_load_package if preferred
93
+ fi
94
+ }
95
+
96
+ create_arches_project_only(){
97
+ echo ""
98
+ echo "----- Creating '${ARCHES_PROJECT}'... -----"
99
+ echo ""
100
+
101
+ cd ${WEB_ROOT}
102
+ python3 ${WEB_ROOT}/arches/arches/install/arches_admin.py startproject ${ARCHES_PROJECT}
103
+ APP_FOLDER=${WEB_ROOT}/${ARCHES_PROJECT}
104
+ }
105
+
106
+ create_arches_project() {
107
+ echo "Checking if Arches project "${ARCHES_PROJECT}" exists..."
108
+ if [[ ! -d ${APP_FOLDER}/${ARCHES_PROJECT} ]] || [[ ! "$(ls ${APP_FOLDER}/${ARCHES_PROJECT})" ]]; then
109
+ echo ""
110
+ echo "----- Creating '${ARCHES_PROJECT}'... -----"
111
+ echo ""
112
+ create_arches_project_only
113
+ copy_settings_local
114
+ run_setup_db
115
+
116
+ exit_code=$?
117
+ if [[ ${exit_code} != 0 ]]; then
118
+ echo "Something went wrong when creating your Arches project: ${ARCHES_PROJECT}."
119
+ echo "Exiting..."
120
+ exit ${exit_code}
121
+ fi
122
+ else
123
+ echo "Custom Arches project '${ARCHES_PROJECT}' exists."
124
+ fi
125
+ }
126
+
127
+ # Yarn
128
+ install_npm_components() {
129
+ cd ${PACKAGE_JSON_FOLDER}
130
+ npm install
131
+ }
132
+
133
+ #### Misc
134
+ copy_settings_local() {
135
+ # The settings_local.py in ${ARCHES_ROOT}/arches/ gets ignored if running manage.py from a custom Arches project instead of Arches core app
136
+ echo "Copying ${WEB_ROOT}/docker/settings_local.py to ${APP_FOLDER}/${ARCHES_PROJECT}/settings_local.py..."
137
+ yes | cp ${WEB_ROOT}/docker/settings_local.py ${APP_FOLDER}/${ARCHES_PROJECT}/settings_local.py
138
+ }
139
+
140
+ #### Run commands
141
+
142
+ start_celery_supervisor() {
143
+ cd ${WEB_ROOT}
144
+ supervisord -c docker/supervisor.conf
145
+ }
146
+
147
+ run_migrations() {
148
+ echo ""
149
+ echo "----- RUNNING DATABASE MIGRATIONS -----"
150
+ echo ""
151
+ cd ${APP_FOLDER}
152
+ python3 manage.py migrate
153
+ }
154
+
155
+ run_setup_db() {
156
+ echo ""
157
+ echo "----- RUNNING SETUP_DB -----"
158
+ echo ""
159
+ if [[ -d ${WEB_ROOT}/${ARCHES_PROJECT}/pkg ]];then
160
+ python3 manage.py packages -o load_package -s ${ARCHES_PROJECT}/pkg -db -dev -y
161
+ else
162
+ cd ${WEB_ROOT}/${ARCHES_PROJECT}
163
+ python3 manage.py setup_db --force
164
+ fi
165
+ }
166
+
167
+ run_load_package() {
168
+ echo ""
169
+ echo "----- *** LOADING PACKAGE: ${ARCHES_PROJECT} *** -----"
170
+ echo ""
171
+ cd ${APP_FOLDER}
172
+ if [[ -d ${ARCHES_PROJECT}/pkg ]];then
173
+ python3 manage.py packages -o load_package -s ${ARCHES_PROJECT}/pkg -db -dev -y
174
+ fi
175
+ }
176
+
177
+ # "exec" means that it will finish building???
178
+ run_django_server() {
179
+ echo ""
180
+ echo "----- *** RUNNING DJANGO DEVELOPMENT SERVER *** -----"
181
+ echo ""
182
+ cd ${APP_FOLDER}
183
+ echo "Running Django"
184
+ exec sh -c "pip install debugpy -t /tmp && python3 /tmp/debugpy --listen 0.0.0.0:5678 manage.py runserver 0.0.0.0:${DJANGO_PORT}"
185
+ }
186
+
187
+ run_livereload_server() {
188
+ echo ""
189
+ echo "----- *** RUNNING LIVERELOAD SERVER *** -----"
190
+ echo ""
191
+ cd ${APP_FOLDER}
192
+ echo "Running livereload"
193
+ exec sh -c "python3 manage.py developer livereload --livereloadhost 0.0.0.0"
194
+ }
195
+
196
+ activate_virtualenv() {
197
+ . ${WEB_ROOT}/ENV/bin/activate
198
+ }
199
+
200
+ #### Main commands
201
+ run_arches() {
202
+ init_arches
203
+ install_npm_components
204
+ run_django_server
205
+ }
206
+
207
+ #### Main commands
208
+ run_livereload() {
209
+ run_livereload_server
210
+ }
211
+
212
+ run_webpack() {
213
+ echo ""
214
+ echo "----- *** RUNNING WEBPACK DEVELOPMENT SERVER *** -----"
215
+ echo ""
216
+ cd ${APP_FOLDER}
217
+ echo "Running Webpack"
218
+ exec sh -c "wait-for-it archeshesysreffuncs:${DJANGO_PORT} -t 1200 && cd /web_root/arches_he_sysref_funcs && npm install && npm start"
219
+ }
220
+
221
+ ### Starting point ###
222
+
223
+ # If no arguments are supplied, assume the server needs to be run
224
+ if [[ $# -eq 0 ]]; then
225
+ echo "No arguments supplied, running Arches server..."
226
+ copy_settings_local
227
+ start_celery_supervisor
228
+ wait_for_db
229
+ run_arches
230
+ fi
231
+
232
+ # Else, process arguments
233
+ echo "Full command: $@"
234
+ while [[ $# -gt 0 ]]
235
+ do
236
+ key="$1"
237
+ echo "Command: ${key}"
238
+
239
+ case ${key} in
240
+ run_arches)
241
+ copy_settings_local
242
+ wait_for_db
243
+ start_celery_supervisor
244
+ run_arches
245
+ ;;
246
+ run_livereload)
247
+ run_livereload_server
248
+ ;;
249
+ run_webpack)
250
+ run_webpack
251
+ ;;
252
+ run_tests)
253
+ copy_settings_local
254
+ wait_for_db
255
+ run_tests
256
+ ;;
257
+ run_migrations)
258
+ copy_settings_local
259
+ wait_for_db
260
+ run_migrations
261
+ ;;
262
+ create_project)
263
+ create_arches_project_only
264
+ ;;
265
+ help|-h)
266
+ display_help
267
+ ;;
268
+ *)
269
+ cd ${APP_FOLDER}
270
+ "$@"
271
+ exit 0
272
+ ;;
273
+ esac
274
+ shift # next argument or value
275
+ done
@@ -0,0 +1,39 @@
1
+ #arches
2
+ ARCHES_PROJECT=arches_he_sysref_funcs
3
+ PUBLIC_SERVER_PROJECT_NAME=archeshesysreffuncs
4
+ INSTALL_DEFAULT_GRAPHS=False
5
+ INSTALL_DEFAULT_CONCEPTS=False
6
+ PGUSERNAME=postgres
7
+ PGPASSWORD=postgis
8
+ PGDBNAME=arches_he_sysref_funcs
9
+ PGHOST=db-archeshesysreffuncs
10
+ PGPORT=5432
11
+ ESHOST=elasticsearch-archeshesysreffuncs
12
+ ESPORT=9200
13
+ DJANGO_MODE=DEV
14
+ DJANGO_DEBUG=True
15
+ DJANGO_PORT=8000
16
+ DOMAIN_NAMES=*
17
+ #DJANGO_REMOTE_DEBUG=False
18
+ PYTHONUNBUFFERED=0
19
+ TZ=PST
20
+ ELASTICSEARCH_PREFIX=arches_he_sysref_funcs
21
+
22
+ #postgresql
23
+ POSTGRES_USER=postgres
24
+ POSTGRES_PASSWORD=postgis
25
+
26
+ #elasticsearch
27
+ TZ=PST
28
+ discovery.type=single-node
29
+ xpack.security.enabled=false
30
+ ES_JAVA_OPTS="-Xms512m -Xmx512m -XX:ParallelGCThreads=1"
31
+
32
+ #rabbitmq
33
+ RABBITMQ_USER=guest
34
+ RABBITMQ_PASS=guest
35
+ RABBITMQ_HOST=rabbitmq-archeshesysreffuncs
36
+
37
+ #webpack
38
+ NODE_OPTIONS=--max-old-space-size=10000
39
+
@@ -0,0 +1,17 @@
1
+
2
+ -- IF USING THE postgis docker template then you don't need to setup template-postgis - commented out.
3
+ --======================================================================================================
4
+ --UPDATE pg_database SET datistemplate='false' WHERE datname='template_postgis';
5
+ --DROP DATABASE IF EXISTS template_postgis;
6
+ --CREATE DATABASE template_postgis WITH ENCODING 'UTF8';
7
+ --UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';
8
+
9
+ --\c template_postgis
10
+ --=======================================================================================================
11
+
12
+ CREATE EXTENSION IF NOT EXISTS postgis;
13
+ GRANT ALL ON geometry_columns TO PUBLIC;
14
+ GRANT ALL ON geography_columns TO PUBLIC;
15
+ GRANT ALL ON spatial_ref_sys TO PUBLIC;
16
+
17
+ CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
@@ -0,0 +1,7 @@
1
+ server {
2
+
3
+ location / {
4
+ proxy_pass http://archeshesysreffuncs:8000;
5
+ }
6
+
7
+ }
@@ -0,0 +1,15 @@
1
+ server {
2
+
3
+ location /featureserver/ {
4
+ proxy_pass http://pg-feat-archeshesysreffuncs:9000/;
5
+ }
6
+
7
+ location /tileserver/ {
8
+ proxy_pass http://pg-tile-archeshesysreffuncs:7800/tileserver/;
9
+ }
10
+
11
+ location / {
12
+ proxy_pass http://archeshesysreffuncs:8000/;
13
+ }
14
+
15
+ }
@@ -0,0 +1,68 @@
1
+ [Server]
2
+ # Accept connections on this subnet (default accepts on all)
3
+ HttpHost = "0.0.0.0"
4
+
5
+ # IP ports to listen on
6
+ HttpPort = 9000
7
+ # HttpsPort = 9001
8
+
9
+ # HTTPS configuration - TLS server certificate full chain and key
10
+ # If these are not specified, the TLS server will not be started
11
+ # TlsServerCertificateFile = ""
12
+ # TlsServerPrivateKeyFile = ""
13
+
14
+ # Advertise URLs relative to this server name and path
15
+ # The default is to look this up from incoming request headers
16
+ # Note: do not add a trailing slash.
17
+ UrlBase = "http://localhost:8080/featureserver"
18
+
19
+ # String to return for Access-Control-Allow-Origin header
20
+ # CORSOrigins = "*"
21
+
22
+ # set Debug to true to run in debug mode (can also be set on cmd-line)
23
+ # Debug = true
24
+
25
+ # Read html templates from this directory
26
+ AssetsPath = "./assets"
27
+
28
+ # Maximum duration for reading entire request (in seconds)
29
+ ReadTimeoutSec = 10
30
+
31
+ # Maximum duration for writing response (in seconds)
32
+ # Also controls maximum time for processing request
33
+ WriteTimeoutSec = 30
34
+
35
+ # Database functions allowed in the transform query parameter
36
+ #TransformFunctions = [
37
+ # "ST_Boundary", "ST_Centroid", "ST_Envelope", "ST_PointOnSurface",
38
+ # "ST_Buffer", "ST_ConvexHull", "ST_MinimumBoundingCircle", "ST_OffsetCurve",
39
+ # "ST_GeneratePoints", "ST_Simplify", "ST_ChaikinSmoothing", "ST_LineSubstring"
40
+ #]
41
+
42
+ [Database]
43
+ # Database connection
44
+ # postgresql://username:password@host/dbname
45
+ # DATABASE_URL environment variable takes precendence if set.
46
+ # DbConnection = "postgresql://username:password@host/dbname"
47
+
48
+ DbConnection = "postgresql://arches_spatial_views:arches_spatial_views@db-archeshesysreffuncs:5433/arches_he_sysref_funcs"
49
+
50
+
51
+ # Close pooled connections after this interval
52
+ # 1d, 1h, 1m, 1s, see https://golang.org/pkg/time/#ParseDuration
53
+ # DbPoolMaxConnLifeTime = "1h"
54
+
55
+ # Hold no more than this number of connections in the database pool
56
+ # DbPoolMaxConns = 4
57
+
58
+ [Paging]
59
+ # The default number of features in a response
60
+ LimitDefault = 100000
61
+ # Maxium number of features in a response
62
+ LimitMax = 100000
63
+
64
+ [Metadata]
65
+ # Title for this service
66
+ Title = "Arches Feature Services"
67
+ # Description of this service
68
+ Description = "Feature services for geospatial data in Arches using the OGC Open API. Powered by Crunchy Data pg_featureserv."
@@ -0,0 +1,90 @@
1
+
2
+ # pg_tileserv
3
+
4
+ # Database connection
5
+ # postgresql://username:password@host/dbname
6
+ # DbConnection = "postgresql://username:password@host/dbname"
7
+
8
+ DbConnection = "postgresql://arches_spatial_views:arches_spatial_views@db-archeshesysreffuncs:5433/arches_he_sysref_funcs"
9
+
10
+ # Close pooled connections after this interval
11
+ # 1d, 1h, 1m, 1s, see https://golang.org/pkg/time/#ParseDuration
12
+ # DbPoolMaxConnLifeTime = "1h"
13
+
14
+ # Hold no more than this number of connections in the database pool
15
+ # DbPoolMaxConns = 4
16
+
17
+ # Cancel a tile request if a tile can't be rendered in this time (seconds)
18
+ # DbTimeout = 10
19
+
20
+ # Look to read html templates from this directory
21
+ # AssetsPath = "/usr/share/pg_tileserv/assets"
22
+
23
+ # Accept connections on this subnet (default accepts on all)
24
+ # HttpHost = "0.0.0.0"
25
+
26
+ # Accept connections on this port
27
+ # HttpPort = 7800
28
+ # HttpsPort = 7801
29
+
30
+ # HTTPS configuration - TLS server certificate full chain and key
31
+ # If you do not specify these, the TLS server will not be started
32
+ # To generate self-signed key pair for testing,
33
+ # openssl req -nodes -new -x509 -keyout server.key -out server.crt
34
+ # TlsServerCertificateFile = "server.crt"
35
+ # TlsServerPrivateKeyFile = "server.key"
36
+
37
+ # Cache control configuration. TTL is time in seconds to request
38
+ # that responses be cached by any downstream caching services.
39
+ # Zero means no cache control header will be set.
40
+ # CacheTTL = 0
41
+
42
+ # Advertise URLs relative to this server name
43
+ # default is to look this up from incoming request headers
44
+ UrlBase = "http://localhost:8080/tileserver/"
45
+
46
+ # Optional path to add to the service base URL
47
+ # If set, all routes will be prefixed with this path
48
+ BasePath = "/tileserver/"
49
+
50
+ # Resolution to quantize vector tiles to
51
+ # DefaultResolution = 4096
52
+
53
+ # Padding to add to vector tiles
54
+ # DefaultBuffer = 256
55
+
56
+ # Limit number of features requested (-1 = no limit)
57
+ # MaxFeaturesPerTile = 10000
58
+
59
+ # Advertise this minimum zoom level
60
+ # DefaultMinZoom = 0
61
+
62
+ # Advertise this maximum zoom level
63
+ # DefaultMaxZoom = 22
64
+
65
+ # Allow any page to consume these tiles (default)
66
+ # To specify domain(s) that should be CORS-allowed, express them as ["https://mydomain.com", "https://anotherdomain.org"]
67
+ # CORSOrigins = ["*"]
68
+
69
+ # Output extra logging information?
70
+ # Debug = false
71
+
72
+ # Enable Prometheus metrics
73
+ # Metrics will be exported at `/metrics`.
74
+ # EnableMetrics = false
75
+
76
+ # Default CS is Web Mercator (EPSG:3857)
77
+ # [CoordinateSystem]
78
+ # SRID = 3857
79
+ # Xmin = -20037508.3427892
80
+ # Ymin = -20037508.3427892
81
+ # Xmax = 20037508.3427892
82
+ # Ymax = 20037508.3427892
83
+
84
+ # "True" Mercator (EPSG:3395) is only a little different
85
+ # [CoordinateSystem]
86
+ # SRID = 3395
87
+ # Xmin = -20037508.342789244
88
+ # Ymin = -20037508.342789244
89
+ # Xmax = 20037508.342789244
90
+ # Ymax = 20037508.342789244