Docker pod for charlesreid1.com: (mediawiki + mysql + phpmyadmin + apache) + gitea + python + nginx. #krash https://pages.charlesreid1.com/pod-charlesreid1

apply_templates.py 932B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import os, re, sys
  2. from jinja2 import Environment, FileSystemLoader, select_autoescape
  3. """
  4. Apply Default Values to Jinja Templates
  5. This script applies default values to
  6. docker-compose.yml file.
  7. The template is useful for Ansible,
  8. but this is useful for experiments/one-offs.
  9. """
  10. # Where templates live
  11. TEMPLATEDIR = '.'
  12. # Where rendered templates will go
  13. OUTDIR = '.'
  14. # Should existing files be overwritten
  15. OVERWRITE = False
  16. env = Environment(loader=FileSystemLoader('.'))
  17. tfile = 'docker-compose.yml.j2'
  18. rfile = 'docker-compose.yml'
  19. content = env.get_template(tfile).render({
  20. "server_name_default" : "charlesreid1.com",
  21. "mediawiki_secretkey" : "asdfqwerty_oiuqoweiruoasdfi",
  22. "mysql_password" : "MySuperSecretPassword"
  23. })
  24. # Write to file
  25. if os.path.exists(rfile) and not OVERWRITE:
  26. raise Exception("Error: file %s already exists!"%(rfile))
  27. else:
  28. with open(rfile,'w') as f:
  29. f.write(content)