I forked the Discourse repository on GitHub. How can I replace it with the existing Discourse installation on my site? I have tried everything, but I encountered errors each time. I added my own Discourse repository from GitHub to the app.yml file, but I couldn’t proceed due to errors. Even when I managed to make the changes, it always reinstalled the original Discourse. How can we properly execute this process?
It helps to be specific.
Upon re-examination, I made a modification to the discourse I was analyzing, and I noticed that this change is visible on the update page within the admin panel. I am now updating it; if the adjustment functions correctly, I will revise this message accordingly.
These are the settings in my app.yml file, which I have rebuilt without encountering any errors. However, upon subsequent review, the modifications I made are not visible, although Discourse continues to operate flawlessly.
run:
- exec: echo "Beginning of custom commands"
## If you want to set the 'From' email address for your first registration, uncomment and change:
## After getting the first signup email, re-comment the line. It only needs to run once.
#- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
- exec:
cd: /var/www/discourse
cmd:
- sudo -u discourse git remote set-url origin https://github.com/KilicSelcuk/discourse.git
- sudo -u discourse git fetch origin
- sudo -u discourse git checkout origin/main
- sudo -u discourse git remote set-branches --add origin main
- sudo -u discourse git remote set-branches origin tests-passed
- sudo -u discourse git reset --hard origin/main
- exec: echo "End of custom commands"
So when you do view source and look at the 6th line or so, does the commit hash in the version string correspond to the latest commit in your forked repository?
I believed I had completed the task, but it appears to be ineffective. The latest update visible on the admin update page is: https://github.com/KilicSelcuk/discourse/commit/e44347414a8325ec25e5892c35bcd889d39a6668.
However, the actual modifications I made are reflected here: Commits · KilicSelcuk/discourse · GitHub.
In essence, the changes I implemented are not visible on the update page. Additionally, when I perform a rebuild, it does not incorporate my repository’s updates. If the changes had been applied, they would be visible.
My most recent configuration is as follows:
## Any custom commands to run after building
run:
- exec: echo "Beginning of custom commands"
## To set the 'From' email address for your initial registration, uncomment and modify:
## After receiving the first signup email, re-comment the line. It only needs to run once.
#- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
- exec:
cd: /var/www/discourse
cmd:
- sudo -u discourse git remote set-url origin https://github.com/KilicSelcuk/discourse.git
- sudo -u discourse git fetch origin
- sudo -u discourse git checkout origin/main
- sudo -u discourse git remote set-branches --add origin main
# - sudo -u discourse git remote set-branches origin tests-passed
# - sudo -u discourse git branch -u origin/main
- sudo -u discourse git reset --hard origin/main
Resolving this issue would be beneficial. I couldn’t find a helpful resource on the forum, but it might serve as a guiding reference for those who follow.
That’s usually a bad idea. You should make changes in a plugin.
Indeed, I was originally doing this, but once the plugin was integrated into the core, I am no longer able to modify it. Unfortunately, the suggested solutions also proved ineffective: Overriding user_guardian.rb in a plugin (no fork necessary!) - #24 by kuaza
If you have forked a plugin, then you should rm the included plugin and clone your version.
I think I’ve told told you about this in another topic. You definitely want to fork just the plugin and not the whole app and all the other plugins.
I encounter an error whenever I attempt to install the plugin. If I have more time, I will try again: Overriding user_guardian.rb in a plugin (no fork necessary!) - #29 by pfaffman
That is the way to solve your problem. If you have an error, and want help, you should say exactly what the error is, and include the plugins section of your yml file and a link to your forked plugin.
Regrettably, I am diligently striving to resolve the issue; I have shared the fault in this matter as well, yet I have not yet found a solution. Overriding user_guardian.rb in a plugin (no fork necessary!) - #29 by pfaffman
I am making this configuration; do you think I am making a mistake? Discourse updates indicate there is a change, but it shows the one from my local repository instead of the one from Discourse. I am updating, but nothing changes; the update still appears. (I believe it recognizes my modifications, but when I update, it pulls from the main repository):
## Any custom commands to run after building
run:
- exec: echo "Beginning of custom commands"
## If you want to set the 'From' email address for your first registration, uncomment and change:
## After getting the first signup email, re-comment the line. It only needs to run once.
#- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
- exec:
cd: /var/www/discourse
cmd:
- sudo -u discourse git remote set-url origin https://github.com/KilicSelcuk/discourse.git
- sudo -u discourse git fetch --tags --prune-tags --prune --force origin
- sudo -u discourse git checkout origin/main
- sudo -u discourse git remote set-branches --add origin main
- sudo -u discourse git remote set-branches origin tests-passed
# - sudo -u discourse git branch -u origin
- sudo -u discourse git reset --hard origin/main
- exec: echo "End of custom commands"
Yes. I told you how to include just your forked plugin and you’re not doing that.
Indeed, I have undertaken this task: Overriding user_guardian.rb in a plugin (no fork necessary!) - #29 by pfaffman. As you suggested, I experimented with both methods. The first approach resulted in an error, as documented here: Overriding user_guardian.rb in a plugin (no fork necessary!) - #30 by kuaza.
The second method rendered the site inaccessible. I am exploring alternative solutions in my quest for resolution, but progress has been limited, prompting me to consider other avenues.
Since I prefer not to make extensive modifications, I contemplated forking Discourse. I would simply update my fork with the latest changes from the main repository each time, then reapply only the modifications I have made, accepting this approach.
My primary challenge lies in identifying an effective and correct solution. I am willing to delete and rewrite the code, trying new approaches. However, in the face of uncertain errors, I am unfortunately unable to produce a definitive resolution.
thanks
Do as @pfaffman suggests.
I do this (delete the original plugin in app.yml, clone yours) with clients and it is the best way.
Especially as a less experienced developer you are going to get into trouble forking the main repo. Keeping up with the velocity of the main repo will not be fun.
That’s a full time job. People who did this term years ago are still sorry, and things moved much more slowly then.
I am already doing this, yet it still results in an error. I appreciate your attempt to assist, but I have already mentioned this two or three times before
You are correct, but how can I keep updates made to a core plugin within my own plugin? Should I not copy the core files and upload them to my repository? Or is there a way to automate this process?
thanks
You haven’t shared what went wrong when you tried just the forked plugin.
Exactly the same way as before it was a core plugin.
Also, what are you changing? Perhaps you can move just those changes to your own plugin.
I attempted again and included the details of the error I encountered this time (almost all of them). Could you please review it: Overriding user_guardian.rb in a plugin (no fork necessary!) - #30 by kuaza