Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker-Compose no more #5190

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The following tools are required for building, testing and contributing to this
- [Rust](https://www.rust-lang.org/tools/install) toolchain - _required_
- [nodejs](https://nodejs.org/) >= v14.18.x - _required_ (However volta will try to use v18.6)
- [yarn classic](https://classic.yarnpkg.com/en/docs/install) package manager v1.22.x- _required_
- [docker](https://www.docker.com/get-started) and docker-compose v2.20.x or higher - _required_
- [docker](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository) v2.20.x or higher - _required_
- [ansible](https://www.ansible.com/) - _optional_

If you use VSCode as your code editor we recommend using the workspace [settings](devops/vscode/settings.json) for recommend eslint plugin to function properly.
Expand Down
21 changes: 10 additions & 11 deletions devops/ansible/roles/common/tasks/install-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
- docker-compose
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line is no longer needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Ansible task will actually uninstall docker-compose. See the later line state: absent so the apt module will remove it if found.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, makes sense then 👍

- docker.io
- docker-doc
- docker-compose
- podman-docker
- containerd
- runc
Expand Down Expand Up @@ -74,16 +73,16 @@
state: latest
update_cache: true

- name: Install docker-compose
become: true
shell:
cmd: |
bash -c "
curl -L 'https://github.com/docker/compose/releases/download/v2.20.1/docker-compose-$(uname -s)-$(uname -m)' -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
"
creates: /usr/local/bin/docker-compose
# - name: Install docker-compose
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part can probably be removed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

# become: true
# shell:
# cmd: |
# bash -c "
# curl -L 'https://github.com/docker/compose/releases/download/v2.20.1/docker-compose-$(uname -s)-$(uname -m)' -o /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
# ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# "
# creates: /usr/local/bin/docker-compose

- name: Install Docker module for Python
pip:
Expand Down
10 changes: 0 additions & 10 deletions docker-compose-no-bind-volumes.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Complete joystream development network
version: '3.4'
services:
joystream-node:
image: joystream/node:$JOYSTREAM_NODE_TAG
Expand Down Expand Up @@ -30,7 +29,6 @@ services:
ports:
- 3333:3333
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
# ACCOUNT_URI overrides command line arg --accountUri
Expand Down Expand Up @@ -65,7 +63,6 @@ services:
- 3334:3334
- 127.0.0.1:4334:4334
env_file:
# relative to working directory where docker-compose was run from
- .env
# Node configuration can be overriden via env, for exampe:
environment:
Expand Down Expand Up @@ -101,7 +98,6 @@ services:
ports:
- 3335:3333
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
# ACCOUNT_URI overrides command line arg --accountUri
Expand Down Expand Up @@ -131,7 +127,6 @@ services:
- 3336:3334
- 127.0.0.1:4336:4334
env_file:
# relative to working directory where docker-compose was run from
- .env
# Node configuration can be overriden via env, for exampe:
environment:
Expand Down Expand Up @@ -163,7 +158,6 @@ services:
volumes:
- query-node-data:/var/lib/postgresql/data
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
POSTGRES_USER: ${DB_USER}
Expand All @@ -179,7 +173,6 @@ services:
container_name: graphql-server
restart: unless-stopped
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
- DB_HOST=db
Expand All @@ -203,7 +196,6 @@ services:
container_name: processor
restart: unless-stopped
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
- INDEXER_ENDPOINT_URL=${PROCESSOR_INDEXER_GATEWAY}
Expand Down Expand Up @@ -233,7 +225,6 @@ services:
container_name: indexer
restart: unless-stopped
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
- DB_NAME=${INDEXER_DB_NAME}
Expand All @@ -255,7 +246,6 @@ services:
container_name: hydra-indexer-gateway
restart: unless-stopped
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
- WARTHOG_STARTER_DB_DATABASE=${INDEXER_DB_NAME}
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.4'

services:
# Ref: https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docker.html
elasticsearch:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.storage-squid.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
squid_db:
container_name: squid_db
Expand Down
10 changes: 0 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Complete joystream development network
version: '3.4'
services:
joystream-node:
image: joystream/node:$JOYSTREAM_NODE_TAG
Expand Down Expand Up @@ -30,7 +29,6 @@ services:
ports:
- 3333:3333
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
# ACCOUNT_URI overrides command line arg --accountUri
Expand Down Expand Up @@ -65,7 +63,6 @@ services:
- 3334:3334
- 127.0.0.1:4334:4334
env_file:
# relative to working directory where docker-compose was run from
- .env
# Node configuration can be overriden via env, for exampe:
environment:
Expand Down Expand Up @@ -104,7 +101,6 @@ services:
ports:
- 3335:3333
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
# ACCOUNT_URI overrides command line arg --accountUri
Expand Down Expand Up @@ -137,7 +133,6 @@ services:
- 3336:3334
- 127.0.0.1:4336:4334
env_file:
# relative to working directory where docker-compose was run from
- .env
# Node configuration can be overriden via env, for exampe:
environment:
Expand Down Expand Up @@ -169,7 +164,6 @@ services:
volumes:
- query-node-data:/var/lib/postgresql/data
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
POSTGRES_USER: ${DB_USER}
Expand All @@ -182,7 +176,6 @@ services:
container_name: graphql-server
restart: unless-stopped
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
- DB_HOST=db
Expand All @@ -209,7 +202,6 @@ services:
container_name: processor
restart: unless-stopped
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
- INDEXER_ENDPOINT_URL=${PROCESSOR_INDEXER_GATEWAY}
Expand Down Expand Up @@ -244,7 +236,6 @@ services:
container_name: indexer
restart: unless-stopped
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
- DB_NAME=${INDEXER_DB_NAME}
Expand All @@ -266,7 +257,6 @@ services:
container_name: hydra-indexer-gateway
restart: unless-stopped
env_file:
# relative to working directory where docker-compose was run from
- .env
environment:
- WARTHOG_STARTER_DB_DATABASE=${INDEXER_DB_NAME}
Expand Down
12 changes: 6 additions & 6 deletions query-node/kill.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
cd $SCRIPT_PATH

# Only remove query-node related services
docker-compose -f ../docker-compose.yml rm -vsf processor
docker-compose -f ../docker-compose.yml rm -vsf graphql-server
docker-compose -f ../docker-compose.yml rm -vsf indexer
docker-compose -f ../docker-compose.yml rm -vsf hydra-indexer-gateway
docker-compose -f ../docker-compose.yml rm -vsf redis
docker-compose -f ../docker-compose.yml rm -vsf db
docker compose -f ../docker-compose.yml rm -vsf processor
docker compose -f ../docker-compose.yml rm -vsf graphql-server
docker compose -f ../docker-compose.yml rm -vsf indexer
docker compose -f ../docker-compose.yml rm -vsf hydra-indexer-gateway
docker compose -f ../docker-compose.yml rm -vsf redis
docker compose -f ../docker-compose.yml rm -vsf db
docker volume rm joystream_query-node-data
4 changes: 2 additions & 2 deletions query-node/reset-processor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
cd $SCRIPT_PATH

docker-compose -f ../docker-compose.yml rm -vsf processor
docker-compose -f ../docker-compose.yml rm -vsf graphql-server
docker compose -f ../docker-compose.yml rm -vsf processor
docker compose -f ../docker-compose.yml rm -vsf graphql-server
docker exec db psql -U postgres -c "DROP DATABASE query_node_processor;"
./start.sh
10 changes: 5 additions & 5 deletions query-node/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ cd $SCRIPT_PATH
[ ! -d "generated/" ] && yarn build

# Bring up db
docker-compose -f ../docker-compose.yml up -d db
docker compose -f ../docker-compose.yml up -d db
echo "Waiting for the db to be ready..."
sleep 5

# Start indexer and gateway
docker-compose -f ../docker-compose.yml up -d indexer
docker-compose -f ../docker-compose.yml up -d hydra-indexer-gateway
docker compose -f ../docker-compose.yml up -d indexer
docker compose -f ../docker-compose.yml up -d hydra-indexer-gateway

# Start processor
docker-compose -f ../docker-compose.yml up -d processor
docker compose -f ../docker-compose.yml up -d processor
echo "Waiting for processor to be ready..." && sleep 30
if [[ "$OSTYPE" == "darwin"* ]]; then
# On Docker Desktop things take a bit longer to startup
sleep 150
fi

# Start graphql-server
docker-compose -f ../docker-compose.yml up -d graphql-server
docker compose -f ../docker-compose.yml up -d graphql-server
echo "Waiting for graphql-server to be ready..." && sleep 30
6 changes: 3 additions & 3 deletions scripts/save-to-docker-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
set -e

# clean start
docker-compose -f ../docker-compose.yml down -v
docker compose -f ../docker-compose.yml down -v

function cleanup() {
docker-compose -f ../docker-compose.yml down -v
docker compose -f ../docker-compose.yml down -v
}

trap cleanup EXIT
Expand All @@ -21,7 +21,7 @@ if [[ -z $JOYSTREAM_NODE_TAG ]]; then
fi

# start node image, network and volume
docker-compose -f ../docker-compose.yml up -d joystream-node
docker compose -f ../docker-compose.yml up -d joystream-node

# copy native runtime
docker cp ../target/release/joystream-node joystream-node:/joystream/node
Expand Down
7 changes: 1 addition & 6 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ if [[ "$OSTYPE" == "linux-gnu" ]]; then
if ! command -v docker &> /dev/null
then
# Install Docker from linux distro maintaners
sudo apt-get install -y docker.io containerd runc
echo "docker not found. You will need to install it. Visit https://www.docker.com/get-started"
fi
# Install latest version of docker-compose
COMPOSE_VERSION=`curl -sL https://api.github.com/repos/docker/compose/releases/latest | jq -r ".tag_name"`
sudo curl -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose
elif [[ "$OSTYPE" == "darwin"* ]]; then
# install brew package manager
if ! which brew >/dev/null 2>&1; then
Expand Down
14 changes: 7 additions & 7 deletions start-elasticsearch-stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ ELASTIC_USERNAME=${ELASTIC_USERNAME:="elastic"}
ELASTIC_PASSWORD=${ELASTIC_PASSWORD:="password"}

# Remove elasticsearch stack containers & volumes
docker-compose -f ./docker-compose.elasticsearch.yml down -v
docker compose -f ./docker-compose.elasticsearch.yml down -v

# Run docker-compose to start elasticsearch container
docker-compose -f ./docker-compose.elasticsearch.yml up -d elasticsearch
# Run docker compose to start elasticsearch container
docker compose -f ./docker-compose.elasticsearch.yml up -d elasticsearch

echo 'Waiting for Elasticsearch...'

Expand Down Expand Up @@ -46,10 +46,10 @@ export ELASTICSEARCH_SERVICEACCOUNTTOKEN=$(echo $response_body | jq -r '.token.v

echo 'Starting for Kibana...'

## Run docker-compose to start kibana container
docker-compose -f ./docker-compose.elasticsearch.yml up -d kibana
## Run docker compose to start kibana container
docker compose -f ./docker-compose.elasticsearch.yml up -d kibana

echo 'Starting APM Server...'

## Run docker-compose to start apm-server container
docker-compose -f ./docker-compose.elasticsearch.yml up -d apm-server
## Run docker compose to start apm-server container
docker compose -f ./docker-compose.elasticsearch.yml up -d apm-server
20 changes: 10 additions & 10 deletions start-multistorage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ else
function down()
{
# Stop containers and clear volumes
docker-compose -f ./docker-compose.storage-squid.yml down -v
docker-compose down -v
docker compose -f ./docker-compose.storage-squid.yml down -v
docker compose down -v
}

trap down EXIT ERR SIGINT SIGTERM
Expand All @@ -34,7 +34,7 @@ fi
if [ "${SKIP_NODE}" != true ]
then
## Run a local development chain
docker-compose up -d joystream-node
docker compose up -d joystream-node
fi

## Query Node Infrastructure
Expand All @@ -44,7 +44,7 @@ fi
./start-orion.sh

## Storage Squid
docker-compose -f ./docker-compose.storage-squid.yml up -d
docker compose -f ./docker-compose.storage-squid.yml up -d

## Init the chain with some state
if [[ $SKIP_CHAIN_SETUP != 'true' ]]; then
Expand All @@ -58,19 +58,19 @@ if [[ $SKIP_CHAIN_SETUP != 'true' ]]; then

## Member faucet
export INVITER_KEY=`cat ./tests/network-tests/output.json | jq -r .faucet.suri`
docker-compose up -d faucet
docker compose up -d faucet

## Storage Infrastructure Nodes
docker-compose up -d colossus-1
docker-compose up -d distributor-1
docker-compose up -d colossus-2
docker-compose up -d distributor-2
docker compose up -d colossus-1
docker compose up -d distributor-1
docker compose up -d colossus-2
docker compose up -d distributor-2
fi

if [ "${PERSIST}" == true ]
then
echo "All services started in the background"
echo "Remember to run 'docker-compose down -v' to kill all docker services before starting new playground."
echo "Remember to run 'docker compose down -v' to kill all docker services before starting new playground."
else
echo "use Ctrl+C to shutdown the development network."
while true; do
Expand Down
Loading
Loading