How to modify source code while using docker?


(Tom) #1

How can we modify the source code while installing discourse whith the docker?
Or is there any chance that I can make my own docker image?
Or should I just install it on the host rather than the docker?
Thanks guys

PS I would like to develop a plugin thats automatically makes every user in the forum anoymous so I think modifying the source code should be more convienient.


#2

To edit one file or two, I use these commands :

cd /var/discourse
./launcher enter app
vi /var/www/discourse/plugins/lazyYT/plugin.rb

After editing, you must save it (I use CTRL+ZZ), then exit and you’ll need to restart the app using ./launcher restart app

For bigger modifications, I don’t have the method


(Tom) #3

I am sorry but Is reboostraping simply type
./launcher rebuild?


#4

./launcher rebuild app is a long process, and not necessary here. After some files modifications, you’ll just need to ./launcher restart app, it takes 10 secondes. A rebuild is more a 5-15 minutes process.

I don’t know if i answer your question correctly


(Tom) #5

Well, I modified the javascript (simply shows an alert when the page is loaded)
but either restarting or rebuilding doesnt change anything
Is this the original property of dockes or I did something wrong?


#6

Oh i forgot something important sorry, when you rebuild the app, it “cancels” all your modifications and put the default files back.

So you just need to restart and do the modifications after every upgrade or rebuild.

After the restart, you need to refresh your browser and it should be ok


(Robin Ward) #7

Don’t do this.

When you install discourse via docker it is in production mode. Assets are compiled and source code is cached. You will have to restart the rails app every time you make a change.

Additionally, upgrading your discourse will blow away your changes.

Please follow the development guide in the readme to set up a proper development environment.


How to set the Discourse Timezone
(Robin Ward) #8