- chentex/random-logger: random produce log to stdout/stderr, very useful for create mock servers to test logging.
Last active
June 10, 2022 13:51
-
-
Save phunguyen19/1ab1b6b5102c5ad021c9a680c0bc0d9b to your computer and use it in GitHub Desktop.
docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3' | |
| networks: | |
| workspaces: | |
| driver: bridge | |
| services: | |
| zookeeper: | |
| image: confluentinc/cp-zookeeper:5.3.1 | |
| restart: always | |
| ports: | |
| - 2181:2181 | |
| environment: | |
| ZOOKEEPER_CLIENT_PORT: 2181 | |
| ZOOKEEPER_TICK_TIME: 2000 | |
| kafka: | |
| # ----------------------------------------------------------------------------- | |
| # For connections _internal_ to the docker network, such as from other services | |
| # and components, use kafka:29092. | |
| # | |
| # See https://rmoff.net/2018/08/02/kafka-listeners-explained/ for details | |
| # ----------------------------------------------------------------------------- | |
| image: confluentinc/cp-kafka:5.3.1 | |
| restart: always | |
| depends_on: | |
| - zookeeper | |
| ports: | |
| - 9092:9092 | |
| environment: | |
| KAFKA_BROKER_ID: 1 | |
| KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 | |
| KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092 | |
| KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT | |
| KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT | |
| KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | |
| mysql: | |
| image: mysql | |
| command: --default-authentication-plugin=mysql_native_password | |
| restart: always | |
| ports: | |
| - '3306:3306' | |
| environment: | |
| MYSQL_ROOT_PASSWORD: root | |
| adminer: | |
| image: adminer | |
| restart: always | |
| ports: | |
| - 33061:8080 | |
| jaeger: | |
| image: jaegertracing/all-in-one | |
| restart: always | |
| ports: | |
| - 5775:5775/udp | |
| - 6831:6831/udp | |
| - 6832:6832/udp | |
| - 5778:5778 | |
| - 16686:16686 | |
| - 14268:14268 | |
| - 9411:9411 | |
| consul: | |
| image: consul | |
| restart: always | |
| ports: | |
| - 8500:8500 | |
| environment: | |
| CONSUL_BIND_INTERFACE: eth0 | |
| mongo: | |
| image: mongo | |
| restart: always | |
| ports: | |
| - 27017:27017 | |
| environment: | |
| MONGO_INITDB_ROOT_USERNAME: root | |
| MONGO_INITDB_ROOT_PASSWORD: example | |
| mongo-express: | |
| image: mongo-express | |
| restart: always | |
| ports: | |
| - 8081:8081 | |
| environment: | |
| ME_CONFIG_MONGODB_ADMINUSERNAME: root | |
| ME_CONFIG_MONGODB_ADMINPASSWORD: example | |
| redis: | |
| image: redis | |
| restart: always | |
| ports: | |
| - 6379:6379 | |
| rabbitmq: | |
| image: rabbitmq | |
| restart: always | |
| ports: | |
| - 5672:5672 | |
| prometheus: | |
| image: prom/prometheus | |
| restart: always | |
| ports: | |
| - 9090:9090 | |
| volumes: | |
| - /tmp/prometheus.yml:/etc/prometheus/prometheus.yml | |
| # user: postgres | |
| postgres: | |
| image: postgres:alpine | |
| restart: always | |
| ports: | |
| - 5432:5432 | |
| environment: | |
| POSTGRES_PASSWORD: password | |
| # user: pgadmin4@pgadmin.org | |
| # password: admin | |
| pgadmin: | |
| image: fenglc/pgadmin4:alpine | |
| ports: | |
| - 5050:5050 | |
| links: | |
| - postgres |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Wait for Redis service start | |
| PONG=`redis-cli -h redis -p 6379 ping | grep PONG` | |
| while [ -z "$PONG" ]; do | |
| sleep 1 | |
| echo "Retry Redis ping... " | |
| PONG=`redis-cli -h redis -p 6379 ping | grep PONG` | |
| done | |
| echo "Redis fully started." | |
| # Wait for PostgreSQL start | |
| RETRIES=30 | |
| until PGPASSWORD=password psql -h postgres -U postgres -p5432 -c "select 1" > /dev/null 2>&1 || [ $RETRIES -eq 0 ]; do | |
| echo "Waiting for postgres server, $((RETRIES--)) remaining attempts..." | |
| sleep 1 | |
| done | |
| # Make sure to start with clean database | |
| PGPASSWORD=password psql -h postgres -U postgres -p5432 -c "DROP DATABASE app_docker WITH (FORCE);" | |
| PGPASSWORD=password psql -h postgres -U postgres -p5432 -c "CREATE DATABASE app_docker;" | |
| PGPASSWORD=password psql -h postgres -U postgres -d app_docker -p5432 -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" | |
| # Start app | |
| npm run migrate | |
| npm run seed:reset | |
| npm run start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment