Skip to content

Commit

Permalink
Merge pull request #537 from OpenC3/docker-compose
Browse files Browse the repository at this point in the history
Change docker-compose to docker compose
  • Loading branch information
ryanmelt authored Mar 15, 2023
2 parents 4604b9f + c3a6699 commit cf40143
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
shell: 'script -q -e -c "bash {0}"'
run: |
docker ps
docker logs cosmos_openc3-cosmos-init_1
docker logs cosmos_openc3-operator_1
docker logs cosmos-openc3-cosmos-init-1
docker logs cosmos-openc3-operator-1
# Build a test plugin for playwright and a copy so we can 'upgrade'
- name: Build plugin
shell: 'script -q -e -c "bash {0}"'
Expand Down
10 changes: 5 additions & 5 deletions openc3-cosmos-init/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ NOTE: All commands are assumed to be executed from this (openc3-cosmos-init) dir
openc3-cosmos-init> cd ../openc3-traefik
traefik> docker ps
# Look for the container with name including traefik
traefik> docker stop cosmos_openc3-traefik_1
traefik> docker stop cosmos-openc3-traefik-1
traefik> docker build -f Dockerfile-dev-base -t openc3-traefik-dev-base .
traefik> docker run --network=openc3-cosmos-network -p 2900:80 -it --rm openc3-traefik-dev-base

Expand All @@ -54,7 +54,7 @@ NOTE: All commands are assumed to be executed from this (openc3-cosmos-init) dir
openc3-cosmos-init> cd ../openc3-traefik
traefik> docker ps
# Look for the container with name including traefik
traefik> docker stop cosmos_openc3-traefik_1
traefik> docker stop cosmos-openc3-traefik-1
traefik> docker build -f Dockerfile-dev -t openc3-traefik-dev .
traefik> docker run --network=openc3-cosmos-network -p 2900:80 -it --rm openc3-traefik-dev

Expand All @@ -63,7 +63,7 @@ NOTE: All commands are assumed to be executed from this (openc3-cosmos-init) dir
openc3-cosmos-init> cd ../openc3-cosmos-cmd-tlm-api
openc3-cosmos-cmd-tlm-api> docker ps
# Look for the container with name including cmd-tlm-api
openc3-cosmos-cmd-tlm-api> docker stop cosmos_openc3-cosmos-cmd-tlm-api_1
openc3-cosmos-cmd-tlm-api> docker stop cosmos-openc3-cosmos-cmd-tlm-api-1
openc3-cosmos-cmd-tlm-api> dev_server.bat

# MINIO development
Expand All @@ -74,5 +74,5 @@ Note running OpenC3 COSMOS in development mode (openc3.bat dev) already does thi

> docker ps
# Look for the container with name including minio
> docker stop cosmos_openc3-minio_1
> docker run --name cosmos_openc3-minio_1 --network=openc3-cosmos-network -v cosmos_openc3-minio-v:/data -p 9000:9000 -e "MINIO_ROOT_USER=openc3minio" -e "MINIO_ROOT_PASSWORD=openc3miniopassword" minio/minio:RELEASE.2022-10-29T06-21-33Z server --console-address ":9001" /data
> docker stop cosmos-openc3-minio-1
> docker run --name cosmos-openc3-minio-1 --network=openc3-cosmos-network -v cosmos-openc3-minio-v:/data -p 9000:9000 -e "MINIO_ROOT_USER=openc3minio" -e "MINIO_ROOT_PASSWORD=openc3miniopassword" minio/minio:RELEASE.2022-10-29T06-21-33Z server --console-address ":9001" /data
26 changes: 13 additions & 13 deletions openc3.bat
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ GOTO usage

:startup
CALL openc3 build || exit /b
docker-compose -f compose.yaml up -d
docker compose -f compose.yaml up -d
@echo off
GOTO :EOF

:stop
docker-compose stop openc3-operator
docker-compose stop openc3-cosmos-script-runner-api
docker-compose stop openc3-cosmos-cmd-tlm-api
docker compose stop openc3-operator
docker compose stop openc3-cosmos-script-runner-api
docker compose stop openc3-cosmos-cmd-tlm-api
timeout /t 5 /nobreak
docker-compose -f compose.yaml down -t 30
docker compose -f compose.yaml down -t 30
@echo off
GOTO :EOF

Expand All @@ -77,33 +77,33 @@ GOTO :EOF
)

:cleanup_y
docker-compose -f compose.yaml down -t 30 -v
docker compose -f compose.yaml down -t 30 -v
@echo off
GOTO :EOF

:build
CALL scripts\windows\openc3_setup || exit /b
docker-compose -f compose.yaml -f compose-build.yaml build openc3-ruby || exit /b
docker-compose -f compose.yaml -f compose-build.yaml build openc3-base || exit /b
docker-compose -f compose.yaml -f compose-build.yaml build openc3-node || exit /b
docker-compose -f compose.yaml -f compose-build.yaml build || exit /b
docker compose -f compose.yaml -f compose-build.yaml build openc3-ruby || exit /b
docker compose -f compose.yaml -f compose-build.yaml build openc3-base || exit /b
docker compose -f compose.yaml -f compose-build.yaml build openc3-node || exit /b
docker compose -f compose.yaml -f compose-build.yaml build || exit /b
@echo off
GOTO :EOF

:run
docker-compose -f compose.yaml up -d
docker compose -f compose.yaml up -d
@echo off
GOTO :EOF

:dev
docker-compose -f compose.yaml -f compose-dev.yaml up -d
docker compose -f compose.yaml -f compose-dev.yaml up -d
@echo off
GOTO :EOF

:test
REM Building OpenC3
CALL scripts\windows\openc3_setup || exit /b
docker-compose -f compose.yaml -f compose-build.yaml build
docker compose -f compose.yaml -f compose-build.yaml build
set args=%*
call set args=%%args:*%1=%%
REM Running tests
Expand Down
40 changes: 24 additions & 16 deletions openc3.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
#!/bin/bash

set +e

export DOCKER_COMPOSE_COMMAND="docker compose"
${DOCKER_COMPOSE_COMMAND} version
if [ "$?" -ne 0 ]; then
export DOCKER_COMPOSE_COMMAND="docker-compose"
fi

set -e

usage() {
echo "Usage: $1 [cli, cliroot, start, stop, cleanup, build, run, dev, test, util]" >&2
echo "* cli: run a cli command as the default user ('cli help' for more info)" 1>&2
echo "* cliroot: run a cli command as the root user ('cli help' for more info)" 1>&2
echo "* start: start the docker-compose openc3" >&2
echo "* start: start the docker compose openc3" >&2
echo "* stop: stop the running dockers for openc3" >&2
echo "* cleanup: cleanup network and volumes for openc3" >&2
echo "* build: build the containers for openc3" >&2
Expand Down Expand Up @@ -46,46 +54,46 @@ case $1 in
;;
start )
./openc3.sh build
docker-compose -f compose.yaml -f compose-build.yaml build
docker-compose -f compose.yaml up -d
${DOCKER_COMPOSE_COMMAND} -f compose.yaml -f compose-build.yaml build
${DOCKER_COMPOSE_COMMAND} -f compose.yaml up -d
;;
stop )
docker-compose stop openc3-operator
docker-compose stop openc3-cosmos-script-runner-api
docker-compose stop openc3-cosmos-cmd-tlm-api
${DOCKER_COMPOSE_COMMAND} stop openc3-operator
${DOCKER_COMPOSE_COMMAND} stop openc3-cosmos-script-runner-api
${DOCKER_COMPOSE_COMMAND} stop openc3-cosmos-cmd-tlm-api
sleep 5
docker-compose -f compose.yaml down -t 30
${DOCKER_COMPOSE_COMMAND} -f compose.yaml down -t 30
;;
cleanup )
if [ "$2" == "force" ]
then
docker-compose -f compose.yaml down -t 30 -v
${DOCKER_COMPOSE_COMMAND} -f compose.yaml down -t 30 -v
else
echo "Are you sure? Cleanup removes ALL docker volumes and all COSMOS data! (1-Yes / 2-No)"
select yn in "Yes" "No"; do
case $yn in
Yes ) docker-compose -f compose.yaml down -t 30 -v; break;;
Yes ) ${DOCKER_COMPOSE_COMMAND} -f compose.yaml down -t 30 -v; break;;
No ) exit;;
esac
done
fi
;;
build )
scripts/linux/openc3_setup.sh
docker-compose -f compose.yaml -f compose-build.yaml build openc3-ruby
docker-compose -f compose.yaml -f compose-build.yaml build openc3-base
docker-compose -f compose.yaml -f compose-build.yaml build openc3-node
docker-compose -f compose.yaml -f compose-build.yaml build
${DOCKER_COMPOSE_COMMAND} -f compose.yaml -f compose-build.yaml build openc3-ruby
${DOCKER_COMPOSE_COMMAND} -f compose.yaml -f compose-build.yaml build openc3-base
${DOCKER_COMPOSE_COMMAND} -f compose.yaml -f compose-build.yaml build openc3-node
${DOCKER_COMPOSE_COMMAND} -f compose.yaml -f compose-build.yaml build
;;
run )
docker-compose -f compose.yaml up -d
${DOCKER_COMPOSE_COMMAND} -f compose.yaml up -d
;;
dev )
docker-compose -f compose.yaml -f compose-dev.yaml up -d
${DOCKER_COMPOSE_COMMAND} -f compose.yaml -f compose-dev.yaml up -d
;;
test )
scripts/linux/openc3_setup.sh
docker-compose -f compose.yaml -f compose-build.yaml build
${DOCKER_COMPOSE_COMMAND} -f compose.yaml -f compose-build.yaml build
scripts/linux/openc3_test.sh $2
;;
util )
Expand Down
2 changes: 1 addition & 1 deletion openc3/lib/openc3/io/raw_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# All changes Copyright 2022, OpenC3, Inc.
# All Rights Reserved
#
# This file may also be used under the terms of a commercial license
# This file may also be used under the terms of a commercial license
# if purchased from OpenC3, Inc.

require 'thread'
Expand Down
7 changes: 0 additions & 7 deletions scripts/linux/openc3_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,3 @@ if [ "$?" -ne 0 ]; then
echo "${0} FAILED" 1>&2
exit 1
fi

docker-compose --version
if [ "$?" -ne 0 ]; then
echo "ERROR: docker-compose is not installed, please install and try again." 1>&2
echo "${0} FAILED" 1>&2
exit 1
fi
10 changes: 9 additions & 1 deletion scripts/linux/openc3_test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

set +e

export DOCKER_COMPOSE_COMMAND="docker compose"
${DOCKER_COMPOSE_COMMAND} version
if [ "$?" -ne 0 ]; then
export DOCKER_COMPOSE_COMMAND="docker-compose"
fi

set -e

usage() {
Expand All @@ -20,7 +28,7 @@ case $1 in
cd -
;;
hash )
docker-compose -f compose.yaml up -d
${DOCKER_COMPOSE_COMMAND} -f compose.yaml up -d
cd playwright
yarn run fixlinux
yarn playwright test
Expand Down
2 changes: 1 addition & 1 deletion scripts/windows/openc3_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GOTO :EOF

:playwright
REM Starting OpenC3
docker-compose -f compose.yaml up -d
docker compose -f compose.yaml up -d
CD playwright
CALL yarn run fixwindows
CALL yarn playwright test
Expand Down

0 comments on commit cf40143

Please sign in to comment.