Giter Club home page Giter Club logo

Comments (27)

josegonzalez avatar josegonzalez commented on July 30, 2024

How about we just have a dokku server-restart command? It can be used instead of our current ps:rebuildall called in the dokku init script, and can have it's own pluginhook. That way any developer can go in and decide "oh this needs to happen when the server reboots" for their plugins. It would require a new pluginhook I think.

/cc @michaelshobbs

from dokku-postgres.

Flink avatar Flink commented on July 30, 2024

👍 I think it’s a far better solution (I was just trying with the current state of dokku)

from dokku-postgres.

michaelshobbs avatar michaelshobbs commented on July 30, 2024

ps:rebuildall literally rebuilds all app and subsequently calls all the normal pluginhooks that would have originally started up a datastore plugin's container. why would we need another method of doing the same thing? (or do I not understand what we're talking about here?)

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

These plugins aren't applications. Atm when the server restarts, the service containers aren't running because there isn't anything to start them - they don't have --restart=always flag.

from dokku-postgres.

michaelshobbs avatar michaelshobbs commented on July 30, 2024

Ah ok. I hadn't read through the code in the plugin. I see that the starting of the container is manual it seems. I handled this via an existing pluginhook when I did dokku-logspout.

https://github.com/michaelshobbs/dokku-logspout/blob/master/pre-build

I'm kinda partial to something like this in order to make sure your service container is definitely up on deploy.

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

Oh that's pretty smart. I like that a lot. @Flink Maybe we could do something similar by checking available service->app links and starting those service containers?

from dokku-postgres.

Flink avatar Flink commented on July 30, 2024

@josegonzalez yeah that’s what I did in psql-sc too (see my opening comment 😜). But what bothers me is that data stores as defined here aren’t necesseraly linked to an app. When you do a postgres:create, you don’t provide an app name as the argument but just the name of your data store. Then it is started. And if you use the expose command on it, another (external) application could use it without using docker links. So then we have a use case where a data store could never be started if no local app use it but where it could be used by something else. (Don’t know if I’m very clear 😁)

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

We should definitely add a service:start command that ensures a service is started (maybe even a stop).

What you mentioned just now is what I want to avoid. Perhaps just start all containers for a particular service if they are stopped in that pluginhook? That also seems wrong. What if I stop one service manually and then deploy an app?

from dokku-postgres.

Flink avatar Flink commented on July 30, 2024

👍 for a start and stop, it’ll simplify some logic (and restart will be easy 😄).

Then we could be a little bit opinionated about what we do. What you mentioned (and what we’re doing with @michaelshobbs in our respective plugins) is certainly the way to go for data stores linked to applications. We could see this as automatically managed containers when there is a link to an app. For the others, we consider them to be manually managed and to be the responsibility of the dokku user(s).

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

Fine by me. Want to come up with a pr for that? We can then transpose that to every plugin pretty easily :)

from dokku-postgres.

Flink avatar Flink commented on July 30, 2024

Yes no problem, so a start, stop and an autostart for containers linked to apps, alright?

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

Yep on both

Both commands should optionally take an service name. If no service is specified, all services are affected, otherwise just the single service will be manipulated.

from dokku-postgres.

Flink avatar Flink commented on July 30, 2024

Ok then, I’ll do that 😉

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

@Flink bumpers :)

from dokku-postgres.

Flink avatar Flink commented on July 30, 2024

@josegonzalez yep sorry, started to work on it but I’ve some weird bugs. So debugging before continuing :)

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

Heh the iptables thing doesn't appear to work. I found an alternative golang project that should do the trick, so I'm taking a look at the pr :)

from dokku-postgres.

Flink avatar Flink commented on July 30, 2024

It doesn’t work because it needs sudo or is it another problem?

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

Sudo, but also the rule I added doesn't work.

I was thinking of using something like this: https://github.com/Memset/tcp_fallback

Thoughts?

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

Also, we should rip out all the code relating to port exposing now from all plugins or people will assume it works.

from dokku-postgres.

Flink avatar Flink commented on July 30, 2024

as for dokku/dokku-redis#1, we should certainly use an ambassador to expose service.
So for now, do I rip the exposing code?

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

Should be something like this. We should follow a naming convention for the containers, ensure we write the ambassador's container id somewhere, and handle cleanup when unexposing/reloading. Can you test that out in the dokku-redis pr's branch?

from dokku-postgres.

Flink avatar Flink commented on July 30, 2024

yes I can test that. I still need to make the autostart feature :)

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

If you do the ambassador stuff, I can take care of autostart :)

from dokku-postgres.

Flink avatar Flink commented on July 30, 2024

As you wish 😁 I’ll take a look!

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

:)

from dokku-postgres.

Flink avatar Flink commented on July 30, 2024

I was thinking, one way to autostart service containers is to just use the --restart always option of docker when creating the container. It will only start automatically the container when this one won’t exit properly or when docker starts. Documentation says “Restart policies will ensure that linked containers are started in the correct order” so it seems great for our case.

The only “drawback” is that it’ll start at boot a previously stopped service but does it really matter?

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

This is done in all services with the merge of #1.

from dokku-postgres.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.