Skip to content

Commit

Permalink
feat: ecep_cms (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyboar committed Sep 1, 2023
1 parent e626d60 commit 2bcadc0
Show file tree
Hide file tree
Showing 22 changed files with 522 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ecep_cms/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
.cache
**/secrets.py
**/settings_local.py
7 changes: 7 additions & 0 deletions ecep_cms/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# TACC/Core-CMS#v3.12.0-beta.3
FROM taccwma/core-cms:aba079b

WORKDIR /code

COPY /src/taccsite_custom /code/taccsite_custom
COPY /src/taccsite_cms /code/taccsite_cms
39 changes: 39 additions & 0 deletions ecep_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 ecep_cms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Example

An extension of the [Core CMS](https://github.com/TACC/Core-CMS) project

## Basics

See [Core-CMS-Custom](../README.md).
54 changes: 54 additions & 0 deletions ecep_cms/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
version: "3"
services:
cms:
build: .
ports:
- 127.0.0.1:8000:8000
command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
container_name: core_cms
hostname: core_cms
volumes:
- ./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:
- core_cms_net

postgres:
image: postgres:11.5
environment:
- POSTGRES_PASSWORD=taccforever
- POSTGRES_USER=postgresadmin
- POSTGRES_DB=taccsite
- PGDATA=/var/lib/postgresql/data/taccsite
volumes:
- core_cms_postgres_data:/var/lib/postgresql/data
hostname: core_cms_postgres
container_name: core_cms_postgres
networks:
- core_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:
- core_cms_es_data:/usr/share/elasticsearch/data
container_name: core_cms_elasticsearch
ports:
- 127.0.0.1:9201:9200
networks:
- core_cms_net

volumes:
core_cms_postgres_data:
core_cms_es_data:

networks:
core_cms_net:
25 changes: 25 additions & 0 deletions ecep_cms/src/taccsite_cms/custom_app_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CUSTOM_APPS = [

# ...

########################
# NEWS / BLOG
########################

# 'filer', # already in Core
# 'easy_thumbnails', # already in Core
'parler',
'taggit',
'taggit_autosuggest',
# 'meta', # already in Core
'sortedm2m',
'djangocms_blog',

# REQ: 'taggit_autosuggest' requires the following is added to `urls_custom.py`
# custom_urls = [
# # Support `taggit_autosuggest` (from `djangocms-blog`)
# url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
# ]
]
CUSTOM_MIDDLEWARE = []
STATICFILES_DIRS = ()
127 changes: 127 additions & 0 deletions ecep_cms/src/taccsite_cms/settings_custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# CUSTOM SETTINGS VALUES.
# TACC WMA CMS SITE:
# *.ECEP.TACC.UTEXAS.EDU

# FAQ: Some _VARIABLES are duplicated from settings.py (but prefixed with "_")
# because current infrastructure lacks ability to reference default values

########################
# DJANGO CMS SETTINGS
########################

CMS_TEMPLATES = (
('standard.html', 'Standard'),
('fullwidth.html', 'Full Width'),

('guide.html', 'Guide'),
('guides/getting_started.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')
)

########################
# TACC: BRANDING
########################

_NSF_BRANDING = [
"nsf",
"site_cms/img/nsf-white.png",
"branding-nsf",
"https://www.nsf.gov/",
"_blank",
"NSF Logo",
"anonymous",
"True"
]

_TACC_BRANDING = [
"tacc",
"site_cms/img/tacc-white.png",
"branding-tacc",
"https://www.tacc.utexas.edu/",
"_blank",
"TACC Logo",
"anonymous",
"True"
]

_UTEXAS_BRANDING = [
"utexas",
"site_cms/img/utaustin-white.png",
"branding-utaustin",
"https://www.utexas.edu/",
"_blank",
"University of Texas at Austin Logo",
"anonymous",
"True"
]

BRANDING = [_NSF_BRANDING, _TACC_BRANDING, _UTEXAS_BRANDING]

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

LOGO = [
"ecep",
"ecep_cms/img/ecep-white-no_words.svg",
"",
"/",
"_self",
"ECEP Logo",
"anonymous",
"True"
]

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

########################
# TACC: PORTAL
########################

INCLUDES_CORE_PORTAL = True
INCLUDES_PORTAL_NAV = True
INCLUDES_SEARCH_BAR = True

########################
# TACC: NEWS/BLOG
########################

# TACC settings
TACC_BLOG_SHOW_CATEGORIES = False
TACC_BLOG_SHOW_TAGS = False

########################
# NEWS / BLOG
########################

# REQ: Assumes various "NEWS / BLOG" are installed via `custom_app_settings.py`

# Paths for alternate templates that user can choose for blog-specific plugin
# - Devs can customize core templates at `templates/djangocms_blog/`.
# - Users can choose alt. templates from `templates/djangocms_blog/plugins/*`.
# - Devs can customize alt. templates at `templates/djangocms_blog/plugins/*`.
BLOG_PLUGIN_TEMPLATE_FOLDERS = (
('plugins', 'Default'),
# ('plugins/alternate', 'Alternate'),
)

# Change default values for the auto-setup of one `BlogConfig`
# SEE: https://github.com/nephila/djangocms-blog/issues/629
BLOG_AUTO_SETUP = False # Set to False after setup (to minimize server overhead)
BLOG_AUTO_HOME_TITLE ='Home'
BLOG_AUTO_BLOG_TITLE = 'News'
BLOG_AUTO_APP_TITLE = 'News'
BLOG_AUTO_NAMESPACE = 'News'

# Miscellaneous settings
BLOG_ENABLE_COMMENTS = False

########################
# TACC: CORE STYLES
########################

TACC_CORE_STYLES_VERSION = 0
22 changes: 22 additions & 0 deletions ecep_cms/src/taccsite_cms/templates/assets_custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{# This template overwrites the original from TACC/Core-CMS #}
{# NOTE: This should extend taccsite_cms via taccsite_custom, not overwrite #}
{# FAQ: To extend, via app template inheritance, see TACC/Core-CMS#492 #}



{# COPIED FROM CORE #}
{# https://github.com/TACC/Core-CMS/blob/c8844e1/taccsite_cms/templates/assets_custom.html #}

{% load static %}

<!-- Custom Site Assets: Favicon. -->
{% with settings.FAVICON as favicon %}
<link rel="icon" href="{% static favicon.img_file_src %}" type="image/x-icon" />
{% endwith %}



{# NEW CODE #}

<!-- To style old CMS content on new CMS -->
<link rel="stylesheet" href="{% static 'ecep_cms/css/site.css' %}">
6 changes: 6 additions & 0 deletions ecep_cms/src/taccsite_cms/urls_custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.conf.urls import include, url

custom_urls = [
# Support `taggit_autosuggest` (from `djangocms-blog`)
url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
]
Empty file.
67 changes: 67 additions & 0 deletions ecep_cms/src/taccsite_custom/ecep_cms/static/ecep_cms/css/site.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/* Organize via ITCSS */
/* SEE: https://confluence.tacc.utexas.edu/x/IAA9Cw */





/* SETTINGS */

/* https://github.com/TACC/Core-Styles/blob/v0.13.0/src/lib/_imports/settings/color.css */
:root {
/* Accent */
--global-color-accent--xxx-light: #DAADFF;
--global-color-accent--x-light: #A12EFF;
--global-color-accent--light: #6E00C8;
--global-color-accent--normal: #4F008F;
--global-color-accent--dark: #2F0054;
--global-color-accent--x-dark: #1E0037;

--global-color-accent--alt: #DDC4F2;
--global-color-accent--weak: #5B00A440;

/* Link */
--global-color-link-on-light--normal: var(--global-color-accent--normal);
--global-color-link-on-dark--normal: var(--global-color-accent--xxx-light);
}

/* https://github.com/TACC/Core-Styles/blob/v0.13.0/src/lib/_imports/theme.default.css */
:root {
--header-bkgd-color: #4F008F;
--header-minor-border-color: #DAADFF;
--header-search-brdr-color: #A12EFF;
--header-search-bkgd-color: #5f00ad;
}





/* COMPONENTS */

/* https://github.com/TACC/Core-CMS/blob/main/taccsite_cms/static/site_cms/css/src/_imports/components/django.cms.blog.app.item.css */
.blog-list article .byline,
article.post-detail .byline {
display: none;
}





/* TRUMPS */

/* SEE: TACC/Core-Styles/blob/main/source/_imports/trumps/s-header.css */
.s-header .navbar-brand {
min-width: 76px;
}





/* UNORGANIZED */

/* SEE: TACC/Core-Styles/blob/main/source/_imports/branding_logos.css */
/* NOTE: This is ONLY allowed because branding was added to Footer via CMS */
#header-branding { display: none; }
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading

0 comments on commit 2bcadc0

Please sign in to comment.