Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom apps through config. #517

Merged
merged 4 commits into from
Jul 21, 2022
Merged

Conversation

jarosenb
Copy link
Contributor

Overview

Add support for custom apps through custom_app_settings.py and urls_custom.py

Related

Changes

  • Add configurable settings to insert new apps, middleware and static file paths into the core CMS.

Testing

  1. Copy custom_app_settings.example.py into custom_app_settings.py adn urls_custom.example.py into urls_custom.py
  2. Start the CMS according to the README instructions and navigate to http://localhost:8000/test/. You should see the custom_example app being rendered.

Screenshots

image

Copy link
Contributor

@jchuahtacc jchuahtacc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make more sense to move apps/custom_example to a separate sample repository that has a Dockerfile that demonstrates a downstream repository's structure? We could approve this PR and build a hashed image before building the sample repository. So the Dockerfile in the other repo might be:

FROM tacc/core-cms:tag_for_this_PR
COPY /apps/custom_example /apps

etc.

Copy link
Member

@wesleyboar wesleyboar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, after this PR, how Core-CMS-Resources need not be a submodule.

Steps
  1. Each Core-CMS-Resources directory becomes a repo or moves into tup-ui:/libs.

  2. A project urls.py and settings_custom.py would be loaded as a custom app's.

  3. To load project static files, a CMS STATICFILES_DIR entry would point outside CMS.

    Code Change

    change

    ) + tuple(glob(
    os.path.join(BASE_DIR, 'taccsite_custom', '*', 'static')
    ))

    to

        os.path.join(PATH_TO_THE_PROJECT_TO_RUN, 'static')
    )
    
  4. Which then means to locally run a project, Python needs access to project name.

    Ideas
    • Developer can add a local docker_repo.var, the same file Jenkins config uses.
    • We can use a .env, and update Jenkins config to read it instead.
  5. To load project templates/, a CMS TEMPLATESDIRS entry would point outside CMS.

    Code Change

    change

    'DIRS': glob(
    os.path.join(BASE_DIR, 'taccsite_custom')
    ) + [

    to

            'DIRS': [
                os.path.join(PATH_TO_THE_PROJECT_TO_RUN, 'templates')
    

Not as proper as a project cms app (poc) building off a a core cms app (poc), but at least it is not a submodule.

@jchuahtacc
Copy link
Contributor

We do not necessarily need them to be the same repo. They could, in theory, exist in the same Core-Cms-Resources repo where each directory has its own Dockerfile. It would require a little bit of tweaking to the Jenkins build job but would otherwise look the same from a Jenkins user's perspective.

@wesleyboar
Copy link
Member

They could, in theory, exist in the same Core-Cms-Resources repo where each directory has its own Dockerfile. It would require a little bit of tweaking to the Jenkins build job [...]

Then I am excited. That is something I would like to see and learn from. I thought our Jenkins could not clone multiple repos in one job, thus could not mix and match content to build from, so I gave up on a Jenkins solution.

Copy link
Member

@wesleyboar wesleyboar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested. Nothing breaks. Looks safe.

I don't immediately know how to use it, but it is required by https://github.com/TACC/tup-cms/tree/task/TUP-250--taccsite_custom-static-content which also works, and I do understand the use case of.

@wesleyboar wesleyboar merged commit 1d88c35 into main Jul 21, 2022
@wesleyboar wesleyboar deleted the task/TUP-250--custom-apps branch July 21, 2022 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants