Skip to content

Commit

Permalink
feat(matcssi_cms) (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyboar committed May 25, 2023
1 parent 09f2275 commit 00d34a3
Show file tree
Hide file tree
Showing 13 changed files with 189 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ See [Core-CMS](https://github.com/TACC/Core-CMS#prequisites-for-running-the-cms)

#### Settings

See [Core-CMS](https://github.com/TACC/Core-CMS#settings) "Settings" section.
1. Understand how settings are organized. See [Core-CMS](https://github.com/TACC/Core-CMS#settings) "Settings" section.
2. **If** the project you work on has a `taccsite_cms/secrets.default.py`, **then**:

```bash
cd custom-project-dir
cp taccsite_cms/secrets.default.py taccsite_cms/secrets.py
```
3. Create a `settings_local.py` with content from [Core-CMS `settings_local.example.py`](https://github.com/TACC/Core-CMS/blob/main/taccsite_cms/settings_local.example.py).

## Running the CMS

Expand All @@ -45,7 +52,7 @@ make start

## Porting from [Core CMS Resources]

When porting a downstream CMS project from [Core CMS Resources], the contents of a specific project's custom assets should be copied to [`./custom-project-dir/src/taccsite_custom`](./src/taccsite_custom/). The `settings_custom.py` from the CMS project directory should be moved to [`./custom-project-dir/src/taccsite_cms`](./src/taccsite_cms/) since that is where the file would be placed during a CMS build process from Jenkins.
When porting a downstream CMS project from [Core CMS Resources], the contents of a specific project's custom assets should be copied to [`./custom_project-dir/src/taccsite_custom`](./src/taccsite_custom/). The `settings_custom.py` from the CMS project directory should be moved to [`./custom-project-dir/src/taccsite_cms`](./src/taccsite_cms/) since that is where the file would be placed during a CMS build process from Jenkins.


## Automatic Builds
Expand Down
4 changes: 4 additions & 0 deletions matcssi_cms/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
.cache
**/secrets.py
**/settings_local.py
8 changes: 8 additions & 0 deletions matcssi_cms/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions matcssi_cms/Makefile
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions matcssi_cms/README.md
Original file line number Diff line number Diff line change
@@ -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).
56 changes: 56 additions & 0 deletions matcssi_cms/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -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:
14 changes: 14 additions & 0 deletions matcssi_cms/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -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
Empty file added matcssi_cms/src/__init__.py
Empty file.
19 changes: 19 additions & 0 deletions matcssi_cms/src/taccsite_cms/secrets.default.py
Original file line number Diff line number Diff line change
@@ -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': 'matcssi_cms_postgres'
}
}
33 changes: 33 additions & 0 deletions matcssi_cms/src/taccsite_cms/settings_custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# CUSTOM SETTINGS VALUES.
# TACC WMA CMS SITE:
# *.MISE.TACC.UTEXAS.EDU


########################
# TACC: LOGOS
########################

LOGO = [
"matcssi",
"matcssi_cms/img/org_logos/matcssi.png",
"",
"/",
"_self",
"MATCSSI Logo for CMS/Portal",
"anonymous",
"True"
]

FAVICON = {
"img_file_src": "matcssi_cms/img/favicons/favicon.ico"
}

########################
# DJANGO (EMAIL)
########################

# Set on server, NOT here
# https://confluence.tacc.utexas.edu/x/coR9E
# EMAIL_BACKEND = "..."
# EMAIL_HOST = "..."
# DEFAULT_FROM_EMAIL = "..."
Empty file.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 00d34a3

Please sign in to comment.