Code Monkey home page Code Monkey logo

Comments (5)

josegonzalez avatar josegonzalez commented on July 24, 2024

I'm not sure what you are trying to do. Do you mean the container was destroyed so you needed another one with the same config/volume?

from dokku-mariadb.

ignlg avatar ignlg commented on July 24, 2024

Exactly. I need to start a new container but keep the config/volume.

create says that the service already exists.
start says that no container exists.

And both are right.

I was stuck so I created this command:

  $PLUGIN_COMMAND_PREFIX:deploy)
    [[ -z $2 ]] && dokku_log_fail "Please specify a name for the service"
    [[ -d "$PLUGIN_DATA_ROOT/$2" ]] || dokku_log_fail "$PLUGIN_SERVICE service $2 does not exist"
    SERVICE="$2"; SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"; LINKS_FILE="$SERVICE_ROOT/LINKS"

    if ! docker images | grep -e "^$PLUGIN_IMAGE " | grep -q " $PLUGIN_IMAGE_VERSION " ; then
      dokku_log_fail "$PLUGIN_SERVICE image $PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION not found"
    fi

    rootpassword=$(cat "$SERVICE_ROOT/ROOTPASSWORD")
    password=$(cat "$SERVICE_ROOT/PASSWORD")

    dokku_log_info1 "Starting container"
    SERVICE_NAME=$(get_service_name "$SERVICE")
    ID=$(docker run --name "$SERVICE_NAME" -v "$SERVICE_ROOT/data:/var/lib/mysql" -e "MYSQL_ROOT_PASSWORD=$rootpassword" -e MYSQL_USER=mariadb -e "MYSQL_PASSWORD=$password" -e "MYSQL_DATABASE=$SERVICE" -d --restart always --label dokku=service --label dokku.service=mariadb "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION")
    echo "$ID" > "$SERVICE_ROOT/ID"

    dokku_log_verbose_quiet "Waiting for container to be ready"
    docker run --rm --link "$SERVICE_NAME:$PLUGIN_COMMAND_PREFIX" dokkupaas/wait > /dev/null

    dokku_log_info2 "$PLUGIN_SERVICE container created: $SERVICE"
    dokku "$PLUGIN_COMMAND_PREFIX:info" "$SERVICE"
    ;;

That is like create but it reads the configuration instead of creating/writing it.

from dokku-mariadb.

josegonzalez avatar josegonzalez commented on July 24, 2024

start should probably warn and then create the container. That seems reasonable to me. Mind creating a pr with that functionality? I can port it to the other containers once you do.

from dokku-mariadb.

ignlg avatar ignlg commented on July 24, 2024

Sure, I was waiting to discuss if it should be a new command or not to create a PR. And I have the answer now :)

from dokku-mariadb.

josegonzalez avatar josegonzalez commented on July 24, 2024

Closed by #44

from dokku-mariadb.

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.