Keeping config in git what is the suggested gitignore

I am looking to keep my config in source control by using --root but some of the directories are clearly data directories and some look like they might be docker-compose files that may or may not need to be controlled by tutor. Does anyone have a .gitignore that works?

The current directory tree is as follows.

.
β”œβ”€β”€ Pipfile
β”œβ”€β”€ Pipfile.lock
β”œβ”€β”€ config.yml
β”œβ”€β”€ data
β”‚   β”œβ”€β”€ cms
β”‚   β”‚   └── logs
β”‚   β”œβ”€β”€ elasticsearch
β”‚   β”‚   └── nodes
β”‚   β”œβ”€β”€ lms
β”‚   β”‚   β”œβ”€β”€ logs
β”‚   β”‚   β”œβ”€β”€ modulestore
β”‚   β”‚   └── ora2
β”‚   β”œβ”€β”€ mongodb
β”‚   β”‚   β”œβ”€β”€ WiredTiger
β”‚   β”‚   β”œβ”€β”€ WiredTiger.lock
β”‚   β”‚   β”œβ”€β”€ WiredTiger.turtle
β”‚   β”‚   β”œβ”€β”€ WiredTiger.wt
β”‚   β”‚   β”œβ”€β”€ WiredTigerLAS.wt
β”‚   β”‚   β”œβ”€β”€ _mdb_catalog.wt
β”‚   β”‚   β”œβ”€β”€ collection-0-1665046703606725615.wt
β”‚   β”‚   β”œβ”€β”€ collection-2-1665046703606725615.wt
β”‚   β”‚   β”œβ”€β”€ collection-4-1665046703606725615.wt
β”‚   β”‚   β”œβ”€β”€ diagnostic.data
β”‚   β”‚   β”œβ”€β”€ index-1-1665046703606725615.wt
β”‚   β”‚   β”œβ”€β”€ index-3-1665046703606725615.wt
β”‚   β”‚   β”œβ”€β”€ index-5-1665046703606725615.wt
β”‚   β”‚   β”œβ”€β”€ index-6-1665046703606725615.wt
β”‚   β”‚   β”œβ”€β”€ mongod.lock
β”‚   β”‚   β”œβ”€β”€ sizeStorer.wt
β”‚   β”‚   └── storage.bson
β”‚   β”œβ”€β”€ mysql
β”‚   β”‚   β”œβ”€β”€ auto.cnf
β”‚   β”‚   β”œβ”€β”€ ca-key.pem
β”‚   β”‚   β”œβ”€β”€ ca.pem
β”‚   β”‚   β”œβ”€β”€ client-cert.pem
β”‚   β”‚   β”œβ”€β”€ client-key.pem
β”‚   β”‚   β”œβ”€β”€ ib_buffer_pool
β”‚   β”‚   β”œβ”€β”€ ib_logfile0
β”‚   β”‚   β”œβ”€β”€ ib_logfile1
β”‚   β”‚   β”œβ”€β”€ ibdata1
β”‚   β”‚   β”œβ”€β”€ mysql
β”‚   β”‚   β”œβ”€β”€ openedx
β”‚   β”‚   β”œβ”€β”€ performance_schema
β”‚   β”‚   β”œβ”€β”€ private_key.pem
β”‚   β”‚   β”œβ”€β”€ public_key.pem
β”‚   β”‚   β”œβ”€β”€ server-cert.pem
β”‚   β”‚   β”œβ”€β”€ server-key.pem
β”‚   β”‚   └── sys
β”‚   β”œβ”€β”€ openedx-media
β”‚   └── redis
β”‚       β”œβ”€β”€ appendonly.aof
β”‚       └── dump.rdb
└── env
    β”œβ”€β”€ apps
    β”‚   β”œβ”€β”€ caddy
    β”‚   β”œβ”€β”€ openedx
    β”‚   └── redis
    β”œβ”€β”€ build
    β”‚   β”œβ”€β”€ openedx
    β”‚   └── permissions
    β”œβ”€β”€ dev
    β”‚   β”œβ”€β”€ docker-compose.jobs.tmp.yml
    β”‚   β”œβ”€β”€ docker-compose.jobs.yml
    β”‚   β”œβ”€β”€ docker-compose.tmp.yml
    β”‚   └── docker-compose.yml
    β”œβ”€β”€ k8s
    β”‚   β”œβ”€β”€ deployments.yml
    β”‚   β”œβ”€β”€ jobs.yml
    β”‚   β”œβ”€β”€ namespace.yml
    β”‚   β”œβ”€β”€ override.yml
    β”‚   β”œβ”€β”€ services.yml
    β”‚   └── volumes.yml
    β”œβ”€β”€ kustomization.yml
    β”œβ”€β”€ local
    β”‚   β”œβ”€β”€ docker-compose.jobs.tmp.yml
    β”‚   β”œβ”€β”€ docker-compose.jobs.yml
    β”‚   β”œβ”€β”€ docker-compose.prod.yml
    β”‚   β”œβ”€β”€ docker-compose.tmp.yml
    β”‚   └── docker-compose.yml
    β”œβ”€β”€ plugins
    β”‚   └── mfe
    └── version

The configuration is all contained in the env folder so that’s only one you would need to replicate your deployment.

However, the simplest solution is to keep config.yml file and your custom plugin(s) and you should be able to recreate what’s in the env folder. That’s the approach I’m currently using.

I think with the v2 interface of tutor plugins, you can add settings to config.yml from plugins. So in theory, you can have your entire deployment configuration in a single plugin and version control that plugin.

1 Like

Would the plugin also hold the extra requirements such as the custom-theme and the any xblocks?

I prefer to create the git repo on the parent directory to include tutor and tutor-plugins together.
Then, I add the following directories to .gitignore since they contain the dev environment and the platform data.

  • tutor/volumes
  • tutor/data

It would be best if you kept all of tutor/env since you can track what tutor config save actually does.

If you choose to go minimal, here are my preferences.

You have two options for the custom theme.

  • You can run a command with the Actions functionality to download the plugin to the
    "$(tutor config printroot)/env/build/openedx/themes/myopenedxtheme" location.
  • You can add it to your git repository alongside the plugin.py file at the above location.

The xblocks can be added with the OPENEDX_EXTRA_PIP_REQUIREMENTS patch.
https://docs.tutor.overhang.io/configuration.html?highlight=xblock#installing-extra-xblocks-and-requirements

1 Like

+1 for the options @uetuluk listed.

For the your custom theme, you can also create a tutor plugin (Beware of handling templates tags).

I turned my custom-them into a plugin recently because I realised it allows me to add/remove production specific js scripts using patches. For example I don’t need a chat widget when running locally.

I think I prefer the idea of having a parent repo that takes care of the build tools.

.gitignore

tutor/volumes
tutor/data

This should allow us to keep the project and dependencies included with the project and allow other devs to build the project as needed. Thank you.