fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.5 KiB

  1. * Minimal =compose.yml=
  2. #+begin_src yaml
  3. gogocarto:
  4. options:
  5. admin-password: MYADMINPASSWORD
  6. #+end_src
  7. * Charm note and status
  8. As the current docker install of gogocarto as of <2020-10-20 Tue> is
  9. far from being mature, we try here to get only the released part.
  10. We are talking of:
  11. [[https://gitlab.adullact.net/pixelhumain/GoGoCarto/-/blob/f3c10f16fc08b533ef44f1325fdb50f87fa73224/docs/installation_docker.md][gogocarto docker install documentation]]
  12. ** Updating
  13. This process will ensure to avoid rebuilding the gigantic intermediate
  14. image needed (with apache and build/install tools).
  15. You need to run this from the root of a code checkout of:
  16. https://gitlab.com/Seballot/gogocarto, on the version you want to
  17. produce a release from.
  18. #+begin_src sh
  19. docker_tree_hash=$(git rev-parse HEAD:docker)
  20. ## Intermediate docker image is cached on docker.0k.io if needed
  21. if ! docker pull docker.0k.io/gogocarto-builder:${docker_tree_hash}; then
  22. make docker-build &&
  23. docker tag gogocarto_gogocarto:latest docker.0k.io/gogocarto-builder:${docker_tree_hash} &&
  24. docker push docker.0k.io/gogocarto-builder:${docker_tree_hash} || {
  25. echo "You don't seem to be able to push something on docker.0k.io, that's ok."
  26. }
  27. else
  28. docker tag docker.0k.io/gogocarto-builder:${docker_tree_hash} gogocarto_gogocarto:latest
  29. fi
  30. make up &&
  31. docker-compose exec gogocarto make init
  32. #+end_src
  33. Last =make init= is building the actual code to be served.
  34. ** Full release is cached on =docker.0k.io/downloads=
  35. This is the content of the source tree, once populated by =make init=.
  36. *** mongodb initialisation is not included in source and is handled by the charm
  37. As of <2022-12-03 Sat>, the =Makefile='s =init= target is:
  38. #+begin_quote
  39. $ grep ^init Makefile -A1
  40. init: install assets load-fixtures fix-perms ## Initialize the project
  41. #+end_quote
  42. Note that =load-fixtures= target is actually the mongodb initialization:
  43. #+begin_src sh
  44. load-fixtures: ## Create the DB schema, generate DB classes and load fixtures
  45. $(SYMFONY) doctrine:mongodb:schema:create
  46. $(SYMFONY) doctrine:mongodb:generate:hydrators
  47. $(SYMFONY) doctrine:mongodb:generate:proxies
  48. $(SYMFONY) doctrine:mongodb:fixtures:load -n
  49. #+end_src
  50. This is be done in the =hooks/mongo_database-relation-joined= accordingly.
  51. *** create the full release bundle
  52. #+begin_src sh
  53. ## Force original versions
  54. git co web/index.php config/packages/doctrine_mongodb.yaml bin/console
  55. sed -ri "s/^(<\?php)/\1\n\ini_set('memory.limit', '1024M');/" \
  56. web/index.php bin/console
  57. sed -ri "s/\"use_as_saas=%env\(resolve:USE_AS_SAAS\)%\/%env\(resolve:DATABASE_NAME\)%\"/'%env(resolve:DATABASE_NAME)%'/g" \
  58. config/packages/doctrine_mongodb.yaml
  59. ## Add missing tags in git
  60. git log --format="%H" -- config/parameters.yaml |
  61. while read h; do
  62. printf "%s\t%s\n" "$h" "$(git show $h:config/parameters.yaml |
  63. grep version |
  64. cut -f 2 -d ":" |
  65. xargs echo)"
  66. done | uniq -f 1 |
  67. while read a b; do
  68. git tag "$b" "$a" 2>/dev/null
  69. done
  70. commit_sha=$(git describe HEAD --tags)
  71. tar cjv \
  72. --exclude=.git --exclude=.gitignore --exclude=.github \
  73. --owner=root --group=root \
  74. bin web vendor config src templates translations \
  75. > gogocarto-${commit_sha}.tar.bz2
  76. #+end_src
  77. This is still far from being perfect, I wonder if we can just remove
  78. all non '\*.{php,yml,js}' files. I noticed many many unrelated files in
  79. =vendor/=.
  80. We need =bin= for symphony utilities that allows to setup things.