Discourse on k8s on a private network

I am trying to setup discourse for my organisation on k8s. However there are few issues I am facing.
When I try to deploy the bootstrapped image on kubernetes it tries to do stuff like
git pull pups and git pull discourse which doesnt work since I am on a private network without any access to the internet and as a result the container doesn’t start up. Is there anyway I can skip those parts, so that I can deploy?

Are you sure you are deploying an already bootstrapped image? Sounds like you pushed the wrong image to your registry.

Oh is it, I am using the image created by ./launcher bootstrap app

So you are saying that the final bootstrapped image shouldn’t be having any such dependencies?

No it won’t. After bootstrapping, there will be a local_discourse/app image. That is the one that you need to push to the registry and use elsewhere.

5 Likes

One final doubt, so it seems i was pushing the wrong image, my bad. So after i push the actual image I can change the env variables during k8s deployment right? Like DISCOURSE_DB_HOST etc? Because I have a separate postgres cluster and redis cluster!

Been there, done that. No worries, that is a very common mistake. That is why I asked :stuck_out_tongue:

Well, it’s complicated.

While you can easily overwrite those, just add the necessary ENV variable to the container run, during bootstrap we run migrations. If you try to point the image to a different database after bootstrapped the database schema will be completely wrong. Doing this would put you well into the #unsupported-install territory.

2 Likes

So i already have an instance of discourse running but thats on bare metal, i want to move it to k8s, and connect to the same db the bare metal one was using.

Or if possible can I do the bootstrap again with the DISCOURSE_DB_HOST and DISCOURSE_DB_NAME pointing to the same db the bare metal one is using?

1 Like

That should work!

You may want to stop the current Discourse container that is connected to the DB while doing that, because migrations may make it behave in a broken way.

3 Likes

If I create a fresh new empty db and bootstrap using that, then is it possible for me to migrate the data from the UI instead (using the UI of the old discourse instance and the new discourse instance) like /admin/backups? I want to avoid corrupting the old DB , its being used by a lot of users.

You can’t migrate from the ux.

See Introducing Post Deployment Migration. This allows you to migrate the database such that it works for both the old and new container, then do final migrations after you deploy.

1 Like

Well, i tried what you said (pushed the bootstrapped image) seems like I’m still getting the same error.

fatal: unable to access 'https://github.com/discourse/pups.git/': Failed to connect to github.com port 443: Connection timed out

I am on a private network so cannot access github.com

@pfaffman @Falco is this expected? This i am running on k8s

That means you pushed the wrong image, again.

I’d change the internal /etc/hosts file to mimic the resources you want … then add in what is required.

Even easier … put in a modem/router with a 4g / sim connection. make the network recognise that device as the default router for your internal network … connect … do the work … disconnect.

It’s pretty simple.

Cheers

Keith John Hutchison - Ceiteach Seán Mac Úistin
Bringing Data to Life Pty. Ltd. (BD2L)

this time it seems i’m pretty sure :sweat_smile: Is there any possibility that something is erroring out during
./launcher bootstrap app

Moreover I even tried using the current discourse image which is running on bare metal and hosting our current discourse website, and used that on k8s , and that too errors out with the same error as above.

Even on my local machine when i do

docker run local_discourse/app

without internet i seem to get the above error