-
Notifications
You must be signed in to change notification settings - Fork 2
Locally Develop CMS Portal Docs
This setup will result in two CMS instances, but one CMS directory with static assets, templates, settings, et cetera.
- one set of CMS static assets, templates, and settings (shared between standalone CMS and Portal CMS)
-
two sets of CMS pages (one each for standalone CMS and Portal CMS) i.e. two databases and
/media's -
one Docs
/docs(shared between standalone Docs and Portal Docs) - two sets of docker image layers for Docs (one each for standalone Docs and Portal Docs)
Consider distinguishing standalone CMS and Portal CMS, because they will look identical.
Suggestions
- in standalone CMS
secrets.py, addINCLUDES_CORE_PORTAL = False - add unique homepage content to both CMS homepages
- add a link to the other CMS in the navigation of each:
- "Portal CMS → S.A.D. CMS" (use "Advanced settings" to redirect to http://localhost:8000)
- "S.A.D. CMS → Portal CMS" (use "Advanced settings" to redirect to https://cep.dev)
- change the logo for each using their respective
secrets.pyfiles
If you used make build and make start, you are using a docker compose file with container name(s) that will conflict with Portal.
-
Copy
docker-compose.dev.ymlasdocker-compose.custom.yml. -
In the
docker-compose.custom.ymlfile, replacecore_cmswithsad_cms, e.g.:-
core_cms→sad_cms -
core_cms_postgres→sad_cms_postgres -
core_cms_postgres_data→sad_cms_postgres_data - ...
-
-
(If no
taccsite_cms/secrets.pyfile),- Create
taccsite_cms/secrets.py. - Copy
DATABASES = { ... }fromtaccsite_cms/settings.pytotaccsite_cms/secrets.py.
- Create
-
In the
taccsite_cms/settings.local.pyfile, replace "core_cms_postgres" with "sad_cms_postgres". -
(If docker containers are running) Stop (i.e. bring
down) the docker containers. -
Rebuild the
cmsdocker container using custom docker compose file.Commands to Run
- If building from a different CMS image, then rebuild without cache (source):
docker-compose -f docker-compose.custom.yml build --no-cache cmsdocker-compose -f docker-compose.custom.yml up --force-recreate --no-deps -d cms
- If building from the same CMS image, then you may simply restart containers:
docker-compose -f docker-compose.custom.yml up
- If building from a different CMS image, then rebuild without cache (source):
-
In the CMS container, collect static assets.³
-
(If error contacting database) Stop (i.e. bring
down) then Restart (i.e. bringup) the docker containers.⁴ -
(If building assets locally) In the CMS container, run
python manage.py collectstatic --no-input.
Note: Commands or changes that reference
core_cmsorcore_cms_...should instead besad_cmsorsad_cms_....
-
Have an existing frontera-tech-docs in which you know how to develop.
-
Checkout relevant branch.⁵
-
For each change, follow the next steps:
-
(may be optional) Commit change (to create a new commit has for docker to use as a tag)
-
Run
make build. -
Save the docker tag from the output:
Truncated Example Output
... taccwma/frontera-tech-docs:1234567 ...Where
1234567is a string of characters. -
Repeat "Portal" step 6 at "[…] Values to Change".
-
Repeat "Portal" step 8.
This method is newly documented, and may be unreliable or not streamlined.
-
For each change, follow the next steps:
-
(may be optional) Commit change (to create a new commit has for docker to use as a tag)
-
Have an existing Frontera_Docs build to use.
-
Save the docker tag from the build output:
Truncated Example Output
... taccwma/frontera-docs:1234567 ...Where
1234567is a string of characters. -
Repeat "Portal" step 6 at "[…] Values to Change".
-
Repeat "Portal" step 6.
This method is the oldest Wes has documented, but it has been unreliable for him.
-
Have an existing frontera-tech-docs in which you know how to develop.
-
Checkout relevant branch.⁵
-
(might be necessary) In the relevant
docker-composeconfig file, disable in theservices:cms:volumesdirectories not to sync.Volumes to Disable
# - /var/www/frontera/docs:/docs/siteThis ensures the built docs stay within the current directory.
-
For each change, follow the next steps:
-
In the environment*, run
mkdocs build.* The environment can be your local machine (a Python virtual environment is recommended) or a running docker container (but the Docs docker container is closed after build is complete—last confirmed on 2021-08).
-
Have an existing Core-Portal in which you know how to develop.
-
(If docker containers are running) Stop (i.e. bring
down) the docker containers. -
Ensure relevant CMS secrets are up to date and accurate.
-
Checkout relevant branch.⁵
-
Add symlink in Portal to sync local stand-alone CMS content:
Symlinks to Create
- Replace Directory of Volume Mounts with Symlink to Stand-Alone CMS
Add
rm -rf ${__PATH_TO_LOCAL_CORE_PORTAL__}/server/cms ln -s ${__PATH_TO_LOCAL_CORE_CMS__} ${__PATH_TO_LOCAL_CORE_PORTAL__}/server/cms-standaloneserver/cms-standaloneon its own line in.git/info/exclude.* - (If using "Docs" "Method C") Replace Directory / Volume Mounts with Symlink to Stand-Alone Docs Output
Add
rm -rf ${__PATH_TO_LOCAL_CORE_PORTAL__}/server/docs ln -s ${__PATH_TO_LOCAL_DOCS_REPO__}/site ${__PATH_TO_LOCAL_CORE_PORTAL__}/server/docs-standaloneserver/docs-standaloneon its own line in.git/info/exclude.*
- This tells Git to ignore this new directory with no need to edit
.gitignore.
- Replace Directory of Volume Mounts with Symlink to Stand-Alone CMS
-
Update the relevant
docker-composeconfig file to sync local stand-alone CMS content:Volumes to Add to and Change in Nginx
To ensure Nginx container has actual directory contents, not broken symlink(s).
-
Add these replacements in
services:nginx:volumes:-
../../cms/→../../cms-standalone/
-
-
Make these replacements in
services:nginx:volumes:-
../../cms/→../../cms-standalone/*
* Except for
../../cms/media, because it was not changed inservices:cms:volumes.\ -
-
(If using "Docs" "Method C") Make these replacements in
services:nginx:volumes:-
../../docs/→../../docs-standalone/
-
Values to Change (only for "Docs" "Method A" and "Method B")
Replace the
services:docs:imagewith the one from "Docs" "Method A/B" step 4. -
-
Rebuild the
cmsdocker container without cache. (source)Commands to Run
docker-compose -f server/conf/docker/docker-compose-dev.all.debug.yml up --force-recreate --no-deps -d cmsThe
make stopandmake startcommands are not adequate. -
Rebuild the
docsdocker container without cache. (source)Commands to Run
docker-compose -f server/conf/docker/docker-compose-dev.all.debug.yml up --force-recreate --no-deps -d docsThe
make stopandmake startcommands are not adequate. -
(might be necessary) (could be overkill) Rebuild the
nginxdocker container without cache. (source)Commands to Run
docker-compose -f server/conf/docker/docker-compose-dev.all.debug.yml up --force-recreate --no-deps -d nginx -
Start (i.e. bring
up) the docker containers. -
(If
cmsservice has error contacting database) Stop (i.e. bringdown) then Restart (i.e. bringup) the docker containers.⁴
Header Content Load Returns Server Error
The CMS service has likely crashed.
- Check CMS container logs.
- If you see
ModuleNotFoundError: No module named 'test_without_migrations', then continue to next step. - If you see
ModuleNotFoundError: No module named 'some_module.you_know_exists', then checksettings.pyfor syntax error withinINSTALLED_APPS. - If you see something else, then this document has no specific guidance.
- If you see
-
docker exec -it core_portal_cms /bin/bashpip3 install --no-cache-dir -r requirements.txtexit
- Restart the CMS service. Methods:
- In Docker Desktop's Dashboard, in the
core_portal_cms, click "↻" button. docker-compose -f server/conf/docker/docker-compose-dev.all.debug.yml restart cms
- In Docker Desktop's Dashboard, in the
Either cep.dev or cep.dev/workbench Returns 502 Server Error
The Nginx service has likely crashed.
- Restart the Nginx service:
- In Docker Desktop's Dashboard, in the
core_portal_nginx, click "↻" button. docker-compose -f server/conf/docker/docker-compose-dev.all.debug.yml restart nginx
- In Docker Desktop's Dashboard, in the
To make sure Stand-Alone CMS and Portal CMS both receive re-built CSS assets, run:
npm run build && docker exec -it sad_cms python3 manage.py collectstatic --no-input && docker exec -it core_portal_cms python3 manage.py collectstatic --no-input
³ When you rebuild, the Node build output may be absent (because
- .:/codeentry forvolumesoverwrites containers files originating from image).⁴ The first start may hit a database contact error,
Name or service not known. The second start should not.⁵ So that the CMS test is against the correct Portal code:
- If the CMS branch has an accompanying Portal branch, then checkout that accompanying Portal branch.
- If the CMS branch does not have an accompanying Portal branch, then checkout
main.
TACC ACI WMA Core-CMS Project Documentation