polonskiy / crowdr

Crowdr is a tool for managing multiple Docker containers
MIT License
95 stars 9 forks source link

New version #18

Closed polonskiy closed 8 years ago

polonskiy commented 8 years ago

New config example (it works!):

#!/bin/bash

crowdr_project="example"
crowdr_name_format="%s_%s"

crowdr_config="
database env DB_NAME=gitlabhq_production
database env DB_USER=gitlab
database env DB_PASS=password
database volume $(crowdr_fullname database):/var/lib/postgresql
database image sameersbn/postgresql:9.4-11
database before.run create_volume database
database after.start wait_port database 5432

redis volume $(crowdr_fullname redis):/var/lib/redis
redis image sameersbn/redis:latest
redis before.run create_volume redis
redis after.start wait_port redis 6379

gitlab before.run create_volume gitlab
gitlab after.start wait_gitlab
gitlab link database:postgresql
gitlab link redis:redisio
gitlab publish 10022:22
gitlab publish 10080:80
gitlab env GITLAB_PORT=10080
gitlab env GITLAB_SSH_PORT=10022
gitlab env GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string
gitlab volume $(crowdr_fullname gitlab):/home/git/data
gitlab image sameersbn/gitlab:8.3.2
"

create_volume() {
    docker volume create --name=$(crowdr_fullname $1) > /dev/null
}

wait_port() {
    ip=$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $(crowdr_fullname $1))
    echo "Waiting for $1"
    while ! nc -q 1 $ip $2 </dev/null >/dev/null; do
        echo -n .
        sleep 1;
    done
    echo
}

wait_gitlab() {
    echo "Waiting for gitlab"
    while ! curl -ILs http://localhost:10080 | grep -q '200 OK'; do
        echo -n .
        sleep 1;
    done
    echo
    xdg-open http://localhost:10080
}

Readme is in progress.

What do you think?

@coderofsalvation @byrnedo @superm00s @marcinwaldowski

marcinwaldowski commented 8 years ago

:+1: :+1: :+1:

It is great! It looks perfect. I will test this version tomorrow.

The only thing I miss is crowdr create, which would work as 'crowdr run' but does not start containers.

polonskiy commented 8 years ago

Thanks. I want to merge this branch asap, the only thing blocking me now is documentation. English is not my native language and it is a lot harder for me than coding :smile: Your help will be greatly appreciated.

I also thought about create but I have never used it. Any suggestions and use cases are welcome.

coderofsalvation commented 8 years ago

awesome. superflexible. Concerning the english thing, I'm afraid i'm in the same situation ;)

marcinwaldowski commented 8 years ago

English is also not native for me but I hope to find time to contribute to documentation before end of this week.

marcinwaldowski commented 8 years ago

I worked on new documentation but didn't finish it yet. I have at least half of the work done.

polonskiy commented 8 years ago

:+1: Thanks!