diff --git a/example_cms/.dockerignore b/example_cms/.dockerignore new file mode 100644 index 00000000..a64885d2 --- /dev/null +++ b/example_cms/.dockerignore @@ -0,0 +1,4 @@ +.git +.cache +**/secrets.py +**/settings_local.py diff --git a/example_cms/Dockerfile b/example_cms/Dockerfile new file mode 100644 index 00000000..cb374f74 --- /dev/null +++ b/example_cms/Dockerfile @@ -0,0 +1,8 @@ +# v3.9.3 +FROM taccwma/core-cms:4ef3608 + +WORKDIR /code + +COPY /src/apps /code/apps +COPY /src/taccsite_custom /code/taccsite_custom +COPY /src/taccsite_cms /code/taccsite_cms diff --git a/example_cms/Makefile b/example_cms/Makefile new file mode 100644 index 00000000..04d475d0 --- /dev/null +++ b/example_cms/Makefile @@ -0,0 +1,39 @@ +DOCKERHUB_REPO := $(shell cat ./docker_repo.var) +DOCKER_TAG ?= $(shell git rev-parse --short HEAD) +DOCKER_IMAGE := $(DOCKERHUB_REPO):$(DOCKER_TAG) +DOCKER_IMAGE_LATEST := $(DOCKERHUB_REPO):latest + +#### +# `DOCKER_IMAGE_BRANCH` tag is the git tag for the commit if it exists, else the branch on which the commit exists +DOCKER_IMAGE_BRANCH := $(DOCKERHUB_REPO):$(shell git describe --exact-match --tags 2> /dev/null || git symbolic-ref --short HEAD) + +#.PHONY: build +build: + docker-compose -f docker-compose.dev.yml build + +.PHONY: build-full +build-full: + docker build -t $(DOCKER_IMAGE) --target production -f Dockerfile . + docker tag $(DOCKER_IMAGE) $(DOCKER_IMAGE_BRANCH) # Note: Currently broken for branches with slashes + +.PHONY: publish +publish: + docker push $(DOCKER_IMAGE) + docker push $(DOCKER_IMAGE_BRANCH) + +.PHONY: publish-latest +publish-latest: + docker tag $(DOCKER_IMAGE) $(DOCKER_IMAGE_LATEST) + docker push $(DOCKER_IMAGE_LATEST) + +.PHONY: start +start: + docker-compose -f docker-compose.dev.yml up + +.PHONY: stop +stop: + docker-compose -f docker-compose.dev.yml down + +.PHONY: stop-full +stop-v: + docker-compose -f docker-compose.dev.yml down -v diff --git a/example_cms/README.md b/example_cms/README.md new file mode 100644 index 00000000..9c63dc74 --- /dev/null +++ b/example_cms/README.md @@ -0,0 +1,7 @@ +# matcssi_cms + +An extension of the [Core CMS](https://github.com/TACC/Core-CMS) project + +## Basic Set Up + +See [Core-CMS-Custom](https://github.com/TACC/Core-CMS-Custom). diff --git a/example_cms/docker-compose.dev.yml b/example_cms/docker-compose.dev.yml new file mode 100644 index 00000000..ade79ea2 --- /dev/null +++ b/example_cms/docker-compose.dev.yml @@ -0,0 +1,56 @@ +version: "3" +services: + cms: + build: . + ports: + - 127.0.0.1:8000:8000 + command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"] + container_name: matcssi_cms + hostname: matcssi_cms + volumes: + - ./src/apps:/code/apps + - ./src/taccsite_custom:/code/taccsite_custom + - ./src/taccsite_cms/custom_app_settings.py:/code/taccsite_cms/custom_app_settings.py + - ./src/taccsite_cms/urls_custom.py:/code/taccsite_cms/urls_custom.py + - ./src/taccsite_cms/settings_custom.py:/code/taccsite_cms/settings_custom.py + - ./src/taccsite_cms/settings_local.py:/code/taccsite_cms/settings_local.py + - ./src/taccsite_cms/secrets.py:/code/taccsite_cms/secrets.py + networks: + - matcssi_cms_net + + postgres: + image: postgres:11.5 + environment: + - POSTGRES_PASSWORD=taccforever + - POSTGRES_USER=postgresadmin + - POSTGRES_DB=taccsite + - PGDATA=/var/lib/postgresql/data/taccsite + volumes: + - matcssi_cms_postgres_data:/var/lib/postgresql/data + hostname: matcssi_cms_postgres + container_name: matcssi_cms_postgres + networks: + - matcssi_cms_net + + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0 + ulimits: + memlock: -1 + environment: + - ES_HEAP_SIZE:1g + - discovery.type=single-node + volumes: + - ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml + - matcssi_cms_es_data:/usr/share/elasticsearch/data + container_name: matcssi_cms_elasticsearch + ports: + - 127.0.0.1:9201:9200 + networks: + - matcssi_cms_net + +volumes: + matcssi_cms_postgres_data: + matcssi_cms_es_data: + +networks: + matcssi_cms_net: diff --git a/example_cms/elasticsearch.yml b/example_cms/elasticsearch.yml new file mode 100644 index 00000000..55847499 --- /dev/null +++ b/example_cms/elasticsearch.yml @@ -0,0 +1,14 @@ +#Use this to configure elasticsearch +#More info: https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html +# +cluster.name: es-dev +network.host: 0.0.0.0 +#network.publish_host: hostname +node.name: es01 +#minimum_master_nodes need to be explicitly set when bound on a public IP +# set to 1 to allow single node clusters +# Details: https://github.com/elastic/elasticsearch/pull/17288 +discovery.zen.minimum_master_nodes: 1 +#More info about memory_lock: https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration-memory.html +bootstrap.memory_lock: true +xpack.security.enabled: false \ No newline at end of file diff --git a/demdata-cms/src/apps/custom_example/__init__.py b/example_cms/src/__init__.py old mode 100644 new mode 100755 similarity index 100% rename from demdata-cms/src/apps/custom_example/__init__.py rename to example_cms/src/__init__.py diff --git a/example_cms/src/apps/custom_example/__init__.py b/example_cms/src/apps/custom_example/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/demdata-cms/src/apps/custom_example/apps.py b/example_cms/src/apps/custom_example/apps.py similarity index 100% rename from demdata-cms/src/apps/custom_example/apps.py rename to example_cms/src/apps/custom_example/apps.py diff --git a/demdata-cms/src/apps/custom_example/templates/custom_example/custom_example.html b/example_cms/src/apps/custom_example/templates/custom_example/custom_example.html similarity index 100% rename from demdata-cms/src/apps/custom_example/templates/custom_example/custom_example.html rename to example_cms/src/apps/custom_example/templates/custom_example/custom_example.html diff --git a/demdata-cms/src/apps/custom_example/urls.py b/example_cms/src/apps/custom_example/urls.py similarity index 100% rename from demdata-cms/src/apps/custom_example/urls.py rename to example_cms/src/apps/custom_example/urls.py diff --git a/demdata-cms/src/apps/custom_example/views.py b/example_cms/src/apps/custom_example/views.py similarity index 100% rename from demdata-cms/src/apps/custom_example/views.py rename to example_cms/src/apps/custom_example/views.py diff --git a/demdata-cms/src/taccsite_cms/custom_app_settings.py b/example_cms/src/taccsite_cms/custom_app_settings.py similarity index 100% rename from demdata-cms/src/taccsite_cms/custom_app_settings.py rename to example_cms/src/taccsite_cms/custom_app_settings.py diff --git a/example_cms/src/taccsite_cms/secrets.default.py b/example_cms/src/taccsite_cms/secrets.default.py new file mode 100644 index 00000000..0ea29773 --- /dev/null +++ b/example_cms/src/taccsite_cms/secrets.default.py @@ -0,0 +1,19 @@ +# SECRET SETTINGS VALUES. +# (LOCAL TEST INSTANCE) + +######################## +# DATABASE SETTINGS +######################## + +from taccsite_cms.settings import DATABASES + +DATABASES = { + 'default': { + 'ENGINE': DATABASES['default']['ENGINE'], + 'PORT': DATABASES['default']['PORT'], + 'NAME': DATABASES['default']['NAME'], + 'USER': DATABASES['default']['USER'], + 'PASSWORD': DATABASES['default']['PASSWORD'], + 'HOST': 'example_cms_postgres' + } +} diff --git a/example_cms/src/taccsite_cms/settings_custom.py b/example_cms/src/taccsite_cms/settings_custom.py new file mode 100644 index 00000000..081a43c0 --- /dev/null +++ b/example_cms/src/taccsite_cms/settings_custom.py @@ -0,0 +1,76 @@ +# CUSTOM SETTINGS VALUES. +# TACC WMA CMS SITE: +# *.PROJECT_DOMAIN.TACC.UTEXAS.EDU + +######################## +# DJANGO CMS SETTINGS +######################## + +# CMS_TEMPLATES = ( +# ('standard.html', 'Standard'), +# ('fullwidth.html', 'Full Width'), + +# # Portal homepage placeholder +# ('home_portal.html', 'Standard Portal Homepage'), + +# # Portal guide pages +# ('guide.html', 'Guide'), +# ('guides/getting_started.tam.html', 'Guide: Getting Started'), +# # ('guides/getting_started.v2.html', 'Guide: Getting Started'), +# ('guides/data_transfer.html', 'Guide: Data Transfer'), +# ('guides/data_transfer.globus.html', 'Guide: Globus Data Transfer'), +# ('guides/portal_technology.html', 'Guide: Portal Technology Stack'), +# ) + +######################## +# DJANGO (EMAIL) +######################## + +# Set on server, NOT here +# https://confluence.tacc.utexas.edu/x/coR9E +# EMAIL_BACKEND = "..." +# EMAIL_HOST = "..." +# DEFAULT_FROM_EMAIL = "..." + +######################## +# TACC: BRANDING +######################## + +# from taccsite_cms.settings import TACC_BRANDING, UTEXAS_BRANDING, NSF_BRANDING +# +# _CUSTOM_BRANDING = [ +# "example", +# "example_cms/img/org_logos/example-logo.png", +# "", +# "https://example.com", +# "_blank", +# "Example Logo", +# "anonymous", +# "True" +# ] + +# BRANDING = [ TACC_BRANDING, UTEXAS_BRANDING, NSF_BRANDING, _CUSTOM_BRANDING ] + +######################## +# TACC: LOGOS +######################## + +LOGO = [ + "example", + "example_cms/img/org_logos/portal.png", + "", + "/", + "_self", + "Placeholder Logo for CMS/Portal", + "anonymous", + "True" +] + +######################## +# TACC: PORTAL +######################## + +# Does this CMS site have a portal? +# INCLUDES_CORE_PORTAL = False +# INCLUDES_PORTAL_NAV = False +# INCLUDES_SEARCH_BAR = False diff --git a/demdata-cms/src/taccsite_cms/urls_custom.py b/example_cms/src/taccsite_cms/urls_custom.py similarity index 100% rename from demdata-cms/src/taccsite_cms/urls_custom.py rename to example_cms/src/taccsite_cms/urls_custom.py diff --git a/example_cms/src/taccsite_custom/matcssi_cms/__init__.py b/example_cms/src/taccsite_custom/matcssi_cms/__init__.py new file mode 100755 index 00000000..e69de29b diff --git a/example_cms/src/taccsite_custom/matcssi_cms/static/matcssi_cms/img/favicons/favicon.ico b/example_cms/src/taccsite_custom/matcssi_cms/static/matcssi_cms/img/favicons/favicon.ico new file mode 100644 index 00000000..533966ed Binary files /dev/null and b/example_cms/src/taccsite_custom/matcssi_cms/static/matcssi_cms/img/favicons/favicon.ico differ diff --git a/example_cms/src/taccsite_custom/matcssi_cms/static/matcssi_cms/img/org_logos/matcssi.png b/example_cms/src/taccsite_custom/matcssi_cms/static/matcssi_cms/img/org_logos/matcssi.png new file mode 100644 index 00000000..4f98b177 Binary files /dev/null and b/example_cms/src/taccsite_custom/matcssi_cms/static/matcssi_cms/img/org_logos/matcssi.png differ