Skip to content

Commit 1eafa45

Browse files
gl-johnsonGitHub Enterprise
authored andcommitted
Merge pull request #2 from Conjur-Enterprise/fix-compose
CNJR-2127: Update docker compose syntax
2 parents 43b28cf + 77ceff8 commit 1eafa45

7 files changed

Lines changed: 30 additions & 30 deletions

File tree

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ The file `docker-compose.yml` is a self-contained development environment for th
6464
To bring it up, run:
6565

6666
```sh-session
67-
$ docker-compose build
68-
$ docker-compose up -d pg conjur_4 conjur_5
67+
$ docker compose build
68+
$ docker compose up -d pg conjur_4 conjur_5
6969
```
7070

7171
Then configure the v4 and v5 servers:
@@ -82,7 +82,7 @@ $ ./ci/configure_v5.sh
8282
Obtain the API key for the v5 admin user:
8383

8484
```
85-
$ docker-compose exec conjur_5 rake 'role:retrieve-key[cucumber:user:admin]'
85+
$ docker compose exec conjur_5 rake 'role:retrieve-key[cucumber:user:admin]'
8686
3aezp05q3wkem3hmegymwzz8wh3bs3dr6xx3y3m2q41k5ymebkc
8787
```
8888

@@ -91,7 +91,7 @@ The password of the v4 admin user is "secret".
9191
Now you can run the client `dev` container:
9292

9393
```sh-session
94-
$ docker-compose run --rm dev
94+
$ docker compose run --rm dev
9595
```
9696

9797
This gives you a shell session with `conjur_4` and `conjur_5` available as linked containers.
@@ -115,7 +115,7 @@ $ bundle exec ./example/demo_v4.rb
115115
To bring it down, run:
116116

117117
```sh-session
118-
$ docker-compose down
118+
$ docker compose down
119119
```
120120

121121
## Releasing

ci/configure_v4.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22

3-
cat << "CONFIGURE" | docker exec -i $(docker-compose ps -q conjur_4) bash
3+
cat << "CONFIGURE" | docker exec -i $(docker compose ps -q conjur_4) bash
44
set -e
55
66
/opt/conjur/evoke/bin/wait_for_conjur
@@ -9,4 +9,4 @@ evoke ca regenerate conjur_4
99
env CONJUR_AUTHN_LOGIN=admin CONJUR_AUTHN_API_KEY=secret conjur policy load --as-group security_admin /etc/policy.yml
1010
CONFIGURE
1111

12-
docker cp $(docker-compose ps -q conjur_4):/opt/conjur/etc/ssl/ca.pem ./tmp/conjur.pem
12+
docker cp $(docker compose ps -q conjur_4):/opt/conjur/etc/ssl/ca.pem ./tmp/conjur.pem

ci/configure_v5.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
source ./ci/oauth/keycloak/keycloak_functions.sh
44

5-
cat << "CONFIGURE" | docker exec -i $(docker-compose ps -q conjur_5) bash
5+
cat << "CONFIGURE" | docker exec -i $(docker compose ps -q conjur_5) bash
66
set -e
77
88
for _ in $(seq 20); do

ci/oauth/keycloak/keycloak_functions.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function _hydrate_keycloak_env_args() {
1212
set -o pipefail
1313
# Note: This prints all lines that look like:
1414
# KEYCLOAK_XXX=someval
15-
docker-compose exec -T ${KEYCLOAK_SERVICE_NAME} printenv | awk '/KEYCLOAK/'
15+
docker compose exec -T ${KEYCLOAK_SERVICE_NAME} printenv | awk '/KEYCLOAK/'
1616
)
1717

1818
# shellcheck disable=SC2034
@@ -30,22 +30,22 @@ function _hydrate_keycloak_env_args() {
3030
# _create_keycloak_user '$APP_USER' '$APP_PW' '$APP_EMAIL'
3131
#
3232
# This is because those variables are not available to this script. They are
33-
# available to bash commands run via "docker-compose exec keycloak bash
33+
# available to bash commands run via "docker compose exec keycloak bash
3434
# -c...", since they're defined in the docker-compose.yml.
3535
function _create_keycloak_user() {
3636
local user_var=$1
3737
local pw_var=$2
3838
local email_var=$3
3939

40-
docker-compose exec -T \
40+
docker compose exec -T \
4141
${KEYCLOAK_SERVICE_NAME} \
4242
bash -c "/scripts/create_user \"$user_var\" \"$pw_var\" \"$email_var\""
4343
}
4444

4545
function create_keycloak_users() {
4646
echo "Defining keycloak client"
4747

48-
docker-compose exec -T ${KEYCLOAK_SERVICE_NAME} /scripts/create_client
48+
docker compose exec -T ${KEYCLOAK_SERVICE_NAME} /scripts/create_client
4949

5050
echo "Creating user 'alice' in Keycloak"
5151

@@ -58,14 +58,14 @@ function create_keycloak_users() {
5858
}
5959

6060
function wait_for_keycloak_server() {
61-
docker-compose exec -T \
61+
docker compose exec -T \
6262
${KEYCLOAK_SERVICE_NAME} /scripts/wait_for_server
6363
}
6464

6565
function fetch_keycloak_certificate() {
6666
# there's a dep on the docker-compose.yml volumes.
6767
# Fetch SSL cert to communicate with keycloak (OIDC provider).
6868
echo "Initialize keycloak certificate in conjur server"
69-
docker-compose exec -T \
69+
docker compose exec -T \
7070
conjur_5 /scripts/fetch_certificate
7171
}

dev/start

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#!/bin/bash -ex
22

33
function v5_development() {
4-
docker-compose up -d --no-deps conjur_5 pg gem client
4+
docker compose up -d --no-deps conjur_5 pg gem client
55

6-
docker-compose exec -T conjur_5 conjurctl wait
6+
docker compose exec -T conjur_5 conjurctl wait
77

8-
local api_key=$(docker-compose exec -T conjur_5 rake 'role:retrieve-key[cucumber:user:admin]')
9-
api_key=$(docker-compose exec -T conjur_5 conjurctl role retrieve-key cucumber:user:admin | tr -d '\r')
8+
local api_key=$(docker compose exec -T conjur_5 rake 'role:retrieve-key[cucumber:user:admin]')
9+
api_key=$(docker compose exec -T conjur_5 conjurctl role retrieve-key cucumber:user:admin | tr -d '\r')
1010

11-
docker exec -e CONJUR_AUTHN_API_KEY="$api_key" -it --detach-keys 'ctrl-\' $(docker-compose ps -q gem) bash
11+
docker exec -e CONJUR_AUTHN_API_KEY="$api_key" -it --detach-keys 'ctrl-\' $(docker compose ps -q gem) bash
1212
}
1313

1414
# Set up VERSION file for local development
1515
if [ ! -f "../VERSION" ]; then
1616
echo -n "0.0.dev" > ../VERSION
1717
fi
1818

19-
docker-compose pull
20-
docker-compose build
19+
docker compose pull
20+
docker compose build
2121

2222
v5_development

dev/stop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
echo 'Removing test environment'
44
echo '---'
5-
docker-compose down --rmi 'local' --volumes
5+
docker compose down --rmi 'local' --volumes

test.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ TOP_LEVEL=$(git rev-parse --show-toplevel)
1010
function finish {
1111
echo 'Removing test environment'
1212
echo '---'
13-
docker-compose down --rmi 'local' --volumes
13+
docker compose down --rmi 'local' --volumes
1414
}
1515

1616
trap finish EXIT
@@ -41,20 +41,20 @@ function startConjur() {
4141
# failing to ensure that has caused many mysterious failures in CI.
4242
# However, unconditionally pulling prevents working offline even
4343
# with a warm cache. So try to pull, but ignore failures.
44-
docker-compose pull --ignore-pull-failures
45-
docker-compose build --build-arg RUBY_VERSION="$RUBY_VERSION"
46-
docker-compose up -d pg conjur_4 conjur_5
44+
docker compose pull --ignore-pull-failures
45+
docker compose build --build-arg RUBY_VERSION="$RUBY_VERSION"
46+
docker compose up -d pg conjur_4 conjur_5
4747
}
4848

4949
function runTests_5() {
5050
echo 'Waiting for Conjur v5 to come up, and configuring it...'
5151
./ci/configure_v5.sh
5252

53-
local api_key=$(docker-compose exec -T conjur_5 rake 'role:retrieve-key[cucumber:user:admin]')
53+
local api_key=$(docker compose exec -T conjur_5 rake 'role:retrieve-key[cucumber:user:admin]')
5454

5555
echo 'Running tests'
5656
echo '-----'
57-
docker-compose run --rm \
57+
docker compose run --rm \
5858
-e CONJUR_AUTHN_API_KEY="$api_key" \
5959
-e SSL_CERT_FILE=/etc/ssl/certs/keycloak.pem \
6060
tester_5 \
@@ -65,11 +65,11 @@ function runTests_4() {
6565
echo 'Waiting for Conjur v4 to come up, and configuring it...'
6666
./ci/configure_v4.sh
6767

68-
local api_key=$(docker-compose exec -T conjur_4 su conjur -c "conjur-plugin-service authn env RAILS_ENV=appliance rails r \"puts User['admin'].api_key\" 2>/dev/null")
68+
local api_key=$(docker compose exec -T conjur_4 su conjur -c "conjur-plugin-service authn env RAILS_ENV=appliance rails r \"puts User['admin'].api_key\" 2>/dev/null")
6969

7070
echo 'Running tests'
7171
echo '-----'
72-
docker-compose run --rm \
72+
docker compose run --rm \
7373
-e CONJUR_AUTHN_API_KEY="$api_key" \
7474
tester_4 rake jenkins_cucumber_v4
7575
}

0 commit comments

Comments
 (0)