We made a few edits in the app container in one of the files in the /var/www/discourse/app/views/layouts directory.
Then, we thought (like dummies) we could just rebuild the container with /var/discourse/launcher rebuild app (not!) but every time we do this, our edits are overwritten.
We don’t want to fork discourse; but we would like to rebuild the app using launcher without having it overwrite our local edits.
Looks like we found why whatever we tried resulted in our files being overwritten in the app during the rebuild process:
This is the reason seems to be because launcher pulls the base discourse image and that image has a.git directory and the git config file naturally points to the master discourse repo and then it overwrites our changes:
launcher
pull_image() {
# Add a single retry to work around dockerhub TLS errors
$docker_path pull $image || $docker_path pull $image
}
Before we mistakenly thought launcher built the image (how did we miss that?!) and it’s clear now that it pulls a base image from docker hub.
Back to the drawing board!
Is there a flag we can set which keeps launcher from pulling the base image and instead builds it?
Totally agree with you that plugins and theme components are the way to go! That method is fully supported and is good to stay in sync with the meta development team.
It’s also good to be curious, to explore possibilities, and to gain a deeper level of Discourse understanding; and after reading this topic by yesterday, I created a local Docker registry, tagged the Discourse base image locally, pushed that image to my new Docker registry (localhost) and then rebuilt a Discourse app pulling the base Discourse image registry.
It is fun, I think, to experiment and learn more about Discourse and I learned a lot from this sys admin exploration / experiment. Of course, this is not how we would run a production application, but I did learn a lot from going though the steps it takes to pull the Discourse base image from localhost versus remotely, and it was surprisingly easy to do, so I wrote this experiment up to share with other curious sys admins:
I hope other sys admin explorers will benefit from this experiment in some small way.
There’s a super simple way to implement this without worrying about images or authoring a plugin. Providing you’re just altering existing flat files you can modify them from the app.yml.
Search for hooks and pups. Several other guides already use this approach.
Even after experimenting with the local Docker registry and local Discourse base image, I could not get consistent results (not sure why, I must be missing some key detail in the configuration).
On the other hand, I learned more about local Docker registries and how to build and manage one.
Just a sidebar docker experiment… learned a lot, for sure!