How do I make changes to app/views/layouts/?

Quick simple question:

Surely, I am missing some brain cells!

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.

Can someone please tell us how to do this?

Thanks!

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?

Hi @DBHacker

Sounds like what you might want to do is:

  1. make changes to the base container (as you mentioned)
  2. tag and save that image and
  3. push that image to your own docker image repo
  4. edit launcher to docker pull that modified base image from your repo

Hope this helps in some small way?

Anyway, this is not supported on meta (in the least, I think), so you are own your own.

Happy Hacking! :slight_smile:

Note: I have not tried this … but it sounds like you are having fun! :slight_smile:

1 Like

You need to make those changes in a plugin or a theme component.

6 Likes

Hi @pfaffman

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.

Stay Curious

1 Like

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.

5 Likes

Thanks @neounix

I like learning and trying new things too.

Someday when I have time, I’ll try to learn more about docker and local registries.

For now, I’m going to stick with plugin dev, since it is supported by Discourse and fits into the Discourse dev model.

As you said, learning these things are fun, but it is also good to remain in the mainstream!

:slight_smile:

2 Likes

Agreed.

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!

1 Like

Yeah, looks like the only viable option is a plugin.

Thanks everyone for the replies and help.

2 Likes

What kind of file changes are you making?

1 Like