chore(CI): update docker compose file

This commit is contained in:
zhanghongtong 2021-03-29 22:26:08 +08:00 committed by Rory Z
parent 6f5aa88562
commit ac9a229c37
38 changed files with 238 additions and 628 deletions

View File

@ -1,119 +0,0 @@
version: '3.9'
services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
depends_on:
- mysql_server
- redis_server
- mongo_server
- pgsql_server
- ldap_server
networks:
- emqx_bridge
env_file:
- conf.env
environment:
GITHUB_ACTIONS: ${GITHUB_ACTIONS}
GITHUB_TOKEN: ${GITHUB_TOKEN}
GITHUB_RUN_ID: ${GITHUB_RUN_ID}
GITHUB_SHA: ${GITHUB_SHA}
GITHUB_RUN_NUMBER: ${GITHUB_RUN_NUMBER}
GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME}
GITHUB_REF: ${GITHUB_REF}
volumes:
- ../../.:/emqx
working_dir: /emqx
tty: true
deploy:
resources:
reservations:
cpus: '0.5'
memory: 500M
mysql_server:
container_name: mysql
image: mysql:${MYSQL_TAG}
restart: always
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: public
MYSQL_DATABASE: mqtt
command:
--bind-address 0.0.0.0
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
--max_allowed_packet=128M
--skip-symbolic-links
networks:
- emqx_bridge
redis_server:
container_name: redis
image: redis:${REDIS_TAG}
ports:
- 6379:6379
command:
- redis-server
- "--bind 0.0.0.0 ::"
restart: always
networks:
- emqx_bridge
mongo_server:
container_name: mongo
image: mongo:${MONGO_TAG}
ports:
- 27017:27017
restart: always
environment:
MONGO_INITDB_DATABASE: mqtt
command:
--ipv6
--bind_ip_all
networks:
- emqx_bridge
pgsql_server:
container_name: pgsql
image: postgres:${PGSQL_TAG}
ports:
- 5432:5432
restart: always
environment:
POSTGRES_PASSWORD: public
POSTGRES_USER: root
POSTGRES_DB: mqtt
networks:
- emqx_bridge
ldap_server:
container_name: openldap
build:
context: ../..
dockerfile: .ci/apps_tests/openldap/Dockerfile
args:
LDAP_TAG: ${LDAP_TAG}
image: emqx-ldap:1.0
ports:
- 389:389
restart: always
networks:
- emqx_bridge
networks:
emqx_bridge:
driver: bridge
name: emqx_bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.100.239.0/24
gateway: 172.100.239.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -1,26 +0,0 @@
FROM buildpack-deps:stretch
ARG LDAP_TAG=2.4.50
RUN apt-get update && apt-get install -y groff groff-base
RUN wget ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-${LDAP_TAG}.tgz \
&& gunzip -c openldap-${LDAP_TAG}.tgz | tar xvfB - \
&& cd openldap-${LDAP_TAG} \
&& ./configure && make depend && make && make install \
&& cd .. && rm -rf openldap-${LDAP_TAG}
COPY .ci/apps_tests/openldap/slapd.conf /usr/local/etc/openldap/slapd.conf
COPY apps/emqx_auth_ldap/emqx.io.ldif /usr/local/etc/openldap/schema/emqx.io.ldif
COPY apps/emqx_auth_ldap/emqx.schema /usr/local/etc/openldap/schema/emqx.schema
COPY apps/emqx_auth_ldap/test/certs/*.pem /usr/local/etc/openldap/
RUN mkdir -p /usr/local/etc/openldap/data \
&& slapadd -l /usr/local/etc/openldap/schema/emqx.io.ldif -f /usr/local/etc/openldap/slapd.conf
WORKDIR /usr/local/etc/openldap
EXPOSE 389 636
ENTRYPOINT ["/usr/local/libexec/slapd", "-h", "ldap:/// ldaps:///", "-d", "3", "-f", "/usr/local/etc/openldap/slapd.conf"]
CMD []

View File

@ -1,5 +0,0 @@
MYSQL_TAG=5.7
REDIS_TAG=6
MONGO_TAG=4.1
PGSQL_TAG=11
LDAP_TAG=2.4.50

View File

@ -1,43 +0,0 @@
version: '3'
services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
volumes:
- ../../:/emqx
working_dir: /emqx
networks:
- emqx_bridge
depends_on:
- mongo_server
tty: true
mongo_server:
container_name: mongo
image: mongo:${MONGO_TAG}
restart: always
environment:
MONGO_INITDB_DATABASE: mqtt
volumes:
- ../../apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/mongodb.pem/:/etc/certs/mongodb.pem
networks:
- emqx_bridge
command:
--ipv6
--bind_ip_all
--sslMode requireSSL
--sslPEMKeyFile /etc/certs/mongodb.pem
networks:
emqx_bridge:
driver: bridge
name: emqx_bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.100.100.0/24
gateway: 172.100.100.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -1,39 +0,0 @@
version: '3'
services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
volumes:
- ../..:/emqx
working_dir: /emqx
networks:
- emqx_bridge
depends_on:
- mongo_server
tty: true
mongo_server:
container_name: mongo
image: mongo:${MONGO_TAG}
restart: always
environment:
MONGO_INITDB_DATABASE: mqtt
networks:
- emqx_bridge
command:
--ipv6
--bind_ip_all
networks:
emqx_bridge:
driver: bridge
name: emqx_bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.100.100.0/24
gateway: 172.100.100.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -1,45 +0,0 @@
version: '3'
services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
volumes:
- ../../:/emqx
working_dir: /emqx
networks:
- emqx_bridge
depends_on:
- mysql_server
tty: true
mysql_server:
container_name: mysql
image: mysql:${MYSQL_TAG}
restart: always
environment:
MYSQL_ROOT_PASSWORD: public
MYSQL_DATABASE: mqtt
networks:
- emqx_bridge
command:
--bind-address "::"
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
--max_allowed_packet=128M
--skip-symbolic-links
networks:
emqx_bridge:
driver: bridge
name: emqx_bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.100.100.0/24
gateway: 172.100.100.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -1,38 +0,0 @@
version: '3'
services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
volumes:
- ../../:/emqx
working_dir: /emqx
networks:
- emqx_bridge
depends_on:
- pgsql_server
tty: true
pgsql_server:
container_name: pgsql
image: postgres:${PGSQL_TAG}
restart: always
environment:
POSTGRES_PASSWORD: public
POSTGRES_USER: root
POSTGRES_DB: mqtt
networks:
- emqx_bridge
networks:
emqx_bridge:
driver: bridge
name: emqx_bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.100.100.0/24
gateway: 172.100.100.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -1,41 +0,0 @@
version: '2.4'
# network configuration is limited in version 3
# https://github.com/docker/compose/issues/4958
services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
volumes:
- ../..:/emqx
networks:
- app_net
depends_on:
- redis_cluster
working_dir: /emqx
tty: true
redis_cluster:
container_name: redis
image: redis:${REDIS_TAG}
volumes:
- ../../apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs:/tls
- ./redis/:/data/conf
command: bash -c "/bin/bash /data/conf/redis.sh --node cluster --tls-enabled && while true; do echo 1; sleep 1; done"
networks:
app_net:
# Assign a public address. Erlang container cannot find cluster nodes by network-scoped alias (redis_cluster).
ipv4_address: 172.16.239.10
ipv6_address: 2001:3200:3200::20
networks:
app_net:
driver: bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.16.239.0/24
gateway: 172.16.239.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -1,40 +0,0 @@
version: '2.4'
# network configuration is limited in version 3
# https://github.com/docker/compose/issues/4958
services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
volumes:
- ../..:/emqx
networks:
- app_net
depends_on:
- redis_cluster
working_dir: /emqx
tty: true
redis_cluster:
image: redis:${REDIS_TAG}
container_name: redis
volumes:
- ./redis/:/data/conf
command: bash -c "/bin/bash /data/conf/redis.sh --node cluster && while true; do echo 1; sleep 1; done"
networks:
app_net:
# Assign a public address. Erlang container cannot find cluster nodes by network-scoped alias (redis_cluster).
ipv4_address: 172.16.239.10
ipv6_address: 2001:3200:3200::20
networks:
app_net:
driver: bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.16.239.0/24
gateway: 172.16.239.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -1,40 +0,0 @@
version: '2.4'
# network configuration is limited in version 3
# https://github.com/docker/compose/issues/4958
services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
volumes:
- ../..:/emqx
networks:
- app_net
depends_on:
- redis_cluster
working_dir: /emqx
tty: true
redis_cluster:
container_name: redis
image: redis:${REDIS_TAG}
volumes:
- ./redis/:/data/conf
command: bash -c "/bin/bash /data/conf/redis.sh --node sentinel && while true; do echo 1; sleep 1; done"
networks:
app_net:
# Assign a public address. Erlang container cannot find cluster nodes by network-scoped alias (redis_cluster).
ipv4_address: 172.16.239.10
ipv6_address: 2001:3200:3200::20
networks:
app_net:
driver: bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.16.239.0/24
gateway: 172.16.239.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -1,43 +0,0 @@
version: '3'
services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
volumes:
- ../..:/emqx
networks:
- emqx_bridge
depends_on:
- redis_server
working_dir: /emqx
tty: true
redis_server:
container_name: redis
image: redis:${REDIS_TAG}
volumes:
- ../../apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs:/tls
command:
- redis-server
- "--bind 0.0.0.0 ::"
- --tls-port 6380
- --tls-cert-file /tls/redis.crt
- --tls-key-file /tls/redis.key
- --tls-ca-cert-file /tls/ca.crt
restart: always
networks:
- emqx_bridge
networks:
emqx_bridge:
driver: bridge
name: emqx_bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.100.100.0/24
gateway: 172.100.100.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -1,37 +0,0 @@
version: '3'
services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
volumes:
- ../..:/emqx
networks:
- emqx_bridge
depends_on:
- redis_server
working_dir: /emqx
tty: true
redis_server:
container_name: redis
image: redis:${REDIS_TAG}
command:
- redis-server
- "--bind 0.0.0.0 ::"
restart: always
networks:
- emqx_bridge
networks:
emqx_bridge:
driver: bridge
name: emqx_bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.100.100.0/24
gateway: 172.100.100.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -1,16 +0,0 @@
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/ppolicy.schema
include /usr/local/etc/openldap/schema/emqx.schema
TLSCACertificateFile /usr/local/etc/openldap/cacert.pem
TLSCertificateFile /usr/local/etc/openldap/cert.pem
TLSCertificateKeyFile /usr/local/etc/openldap/key.pem
database bdb
suffix "dc=emqx,dc=io"
rootdn "cn=root,dc=emqx,dc=io"
rootpw {SSHA}eoF7NhNrejVYYyGHqnt+MdKNBh4r1w3W
directory /usr/local/etc/openldap/data

View File

@ -1,6 +1,5 @@
EMQX_AUTH__LDAP__SERVERS=ldap_server EMQX_AUTH__LDAP__SERVERS=ldap_server
EMQX_AUTH__MONGO__SERVER=mongo_server:27017 EMQX_AUTH__MONGO__SERVER=mongo_server:27017
EMQX_AUTH__REDIS__SERVER=redis_server:6379
EMQX_AUTH__MYSQL__SERVER=mysql_server:3306 EMQX_AUTH__MYSQL__SERVER=mysql_server:3306
EMQX_AUTH__MYSQL__USERNAME=root EMQX_AUTH__MYSQL__USERNAME=root
EMQX_AUTH__MYSQL__PASSWORD=public EMQX_AUTH__MYSQL__PASSWORD=public
@ -9,4 +8,5 @@ EMQX_AUTH__PGSQL__SERVER=pgsql_server:5432
EMQX_AUTH__PGSQL__USERNAME=root EMQX_AUTH__PGSQL__USERNAME=root
EMQX_AUTH__PGSQL__PASSWORD=public EMQX_AUTH__PGSQL__PASSWORD=public
EMQX_AUTH__PGSQL__DATABASE=mqtt EMQX_AUTH__PGSQL__DATABASE=mqtt
EMQX_AUTH__REDIS__SERVER=redis_server:6379
CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_ CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_

View File

@ -0,0 +1,18 @@
version: '3.9'
services:
ldap_server:
container_name: ldap
build:
context: ../..
dockerfile: .ci/docker-compose-file/openldap/Dockerfile
args:
LDAP_TAG: ${LDAP_TAG}
image: openldap
ports:
- 389:389
restart: always
networks:
emqx_bridge:
ipv4_address: 172.100.239.10
ipv6_address: 2001:3200:3200::10

View File

@ -0,0 +1,16 @@
version: '3.9'
services:
mongo_server:
container_name: mongo
image: mongo:${MONGO_TAG}
restart: always
environment:
MONGO_INITDB_DATABASE: mqtt
networks:
emqx_bridge:
ipv4_address: 172.100.239.11
ipv6_address: 2001:3200:3200::11
command:
--ipv6
--bind_ip_all

View File

@ -0,0 +1,20 @@
version: '3.9'
services:
mongo_server:
container_name: mongo
image: mongo:${MONGO_TAG}
restart: always
environment:
MONGO_INITDB_DATABASE: mqtt
volumes:
- ../../apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/mongodb.pem/:/etc/certs/mongodb.pem
networks:
emqx_bridge:
ipv4_address: 172.100.239.11
ipv6_address: 2001:3200:3200::11
command:
--ipv6
--bind_ip_all
--sslMode requireSSL
--sslPEMKeyFile /etc/certs/mongodb.pem

View File

@ -0,0 +1,22 @@
version: '3.9'
services:
mysql_server:
container_name: mysql
image: mysql:${MYSQL_TAG}
restart: always
environment:
MYSQL_ROOT_PASSWORD: public
MYSQL_DATABASE: mqtt
networks:
emqx_bridge:
ipv4_address: 172.100.239.12
ipv6_address: 2001:3200:3200::12
command:
--bind-address "::"
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
--max_allowed_packet=128M
--skip-symbolic-links

View File

@ -1,18 +1,6 @@
version: '3' version: '3.9'
services: services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
volumes:
- ../../:/emqx
working_dir: /emqx
networks:
- emqx_bridge
depends_on:
- mysql_server
tty: true
mysql_server: mysql_server:
container_name: mysql container_name: mysql
image: mysql:${MYSQL_TAG} image: mysql:${MYSQL_TAG}
@ -25,7 +13,9 @@ services:
- ../../apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/server-cert.pem:/etc/certs/server-cert.pem - ../../apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/server-cert.pem:/etc/certs/server-cert.pem
- ../../apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/server-key.pem:/etc/certs/server-key.pem - ../../apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/server-key.pem:/etc/certs/server-key.pem
networks: networks:
- emqx_bridge emqx_bridge:
ipv4_address: 172.100.239.12
ipv6_address: 2001:3200:3200::12
command: command:
--bind-address "::" --bind-address "::"
--character-set-server=utf8mb4 --character-set-server=utf8mb4
@ -37,16 +27,3 @@ services:
--ssl-ca=/etc/certs/ca-cert.pem --ssl-ca=/etc/certs/ca-cert.pem
--ssl-cert=/etc/certs/server-cert.pem --ssl-cert=/etc/certs/server-cert.pem
--ssl-key=/etc/certs/server-key.pem --ssl-key=/etc/certs/server-key.pem
networks:
emqx_bridge:
driver: bridge
name: emqx_bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.100.100.0/24
gateway: 172.100.100.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -0,0 +1,17 @@
version: '3.9'
services:
pgsql_server:
container_name: pgsql
image: postgres:${PGSQL_TAG}
restart: always
environment:
POSTGRES_PASSWORD: public
POSTGRES_USER: root
POSTGRES_DB: mqtt
ports:
- "5432:5432"
networks:
emqx_bridge:
ipv4_address: 172.100.239.13
ipv6_address: 2001:3200:3200::13

View File

@ -1,23 +1,11 @@
version: '3' version: '3.9'
services: services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04
volumes:
- ../../:/emqx
working_dir: /emqx
networks:
- emqx_bridge
depends_on:
- pgsql_server
tty: true
pgsql_server: pgsql_server:
container_name: pgsql container_name: pgsql
build: build:
context: ../.. context: ../..
dockerfile: .ci/compatibility_tests/pgsql/Dockerfile dockerfile: .ci/docker-compose-file/pgsql/Dockerfile
args: args:
POSTGRES_USER: postgres POSTGRES_USER: postgres
BUILD_FROM: postgres:${PGSQL_TAG} BUILD_FROM: postgres:${PGSQL_TAG}
@ -41,17 +29,6 @@ services:
- -c - -c
- hba_file=/var/lib/postgresql/pg_hba.conf - hba_file=/var/lib/postgresql/pg_hba.conf
networks: networks:
- emqx_bridge emqx_bridge:
ipv4_address: 172.100.239.13
networks: ipv6_address: 2001:3200:3200::13
emqx_bridge:
driver: bridge
name: emqx_bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.100.100.0/24
gateway: 172.100.100.1
- subnet: 2001:3200:3200::/64
gateway: 2001:3200:3200::1

View File

@ -0,0 +1,14 @@
version: '3.9'
services:
redis_cluster:
image: redis:${REDIS_TAG}
container_name: redis
volumes:
- ./redis/:/data/conf
command: bash -c "/bin/bash /data/conf/redis.sh --node cluster && while true; do echo 1; sleep 1; done"
networks:
emqx_bridge:
# Assign a public address. Erlang container cannot find cluster nodes by network-scoped alias (redis_cluster).
ipv4_address: 172.100.239.14
ipv6_address: 2001:3200:3200::14

View File

@ -0,0 +1,15 @@
version: '3.9'
services:
redis_cluster:
container_name: redis
image: redis:${REDIS_TAG}
volumes:
- ../../apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs:/tls
- ./redis/:/data/conf
command: bash -c "/bin/bash /data/conf/redis.sh --node cluster --tls-enabled && while true; do echo 1; sleep 1; done"
networks:
emqx_bridge:
# Assign a public address. Erlang container cannot find cluster nodes by network-scoped alias (redis_cluster).
ipv4_address: 172.100.239.14
ipv6_address: 2001:3200:3200::14

View File

@ -0,0 +1,14 @@
version: '3.9'
services:
redis_cluster:
container_name: redis
image: redis:${REDIS_TAG}
volumes:
- ./redis/:/data/conf
command: bash -c "/bin/bash /data/conf/redis.sh --node sentinel && while true; do echo 1; sleep 1; done"
networks:
emqx_bridge:
# Assign a public address. Erlang container cannot find cluster nodes by network-scoped alias (redis_cluster).
ipv4_address: 172.100.239.14
ipv6_address: 2001:3200:3200::14

View File

@ -0,0 +1,15 @@
version: '3.9'
services:
redis_server:
container_name: redis
image: redis:${REDIS_TAG}
command:
- redis-server
- "--bind 0.0.0.0 ::"
restart: always
networks:
emqx_bridge:
# Assign a public address. Erlang container cannot find cluster nodes by network-scoped alias (redis_cluster).
ipv4_address: 172.100.239.14
ipv6_address: 2001:3200:3200::14

View File

@ -0,0 +1,21 @@
version: '3.9'
services:
redis_server:
container_name: redis
image: redis:${REDIS_TAG}
volumes:
- ../../apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs:/tls
command:
- redis-server
- "--bind 0.0.0.0 ::"
- --tls-port 6380
- --tls-cert-file /tls/redis.crt
- --tls-key-file /tls/redis.key
- --tls-ca-cert-file /tls/ca.crt
restart: always
networks:
emqx_bridge:
# Assign a public address. Erlang container cannot find cluster nodes by network-scoped alias (redis_cluster).
ipv4_address: 172.100.239.14
ipv6_address: 2001:3200:3200::14

View File

@ -1,32 +1,26 @@
version: '3' version: '3.9'
services: services:
erlang: erlang:
container_name: erlang container_name: erlang
image: emqx/build-env:erl23.2.7-ubuntu20.04 image: emqx/build-env:erl23.2.7-ubuntu20.04
depends_on: env_file:
- ldap_server - conf.env
environment:
GITHUB_ACTIONS: ${GITHUB_ACTIONS}
GITHUB_TOKEN: ${GITHUB_TOKEN}
GITHUB_RUN_ID: ${GITHUB_RUN_ID}
GITHUB_SHA: ${GITHUB_SHA}
GITHUB_RUN_NUMBER: ${GITHUB_RUN_NUMBER}
GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME}
GITHUB_REF: ${GITHUB_REF}
networks: networks:
- emqx_bridge - emqx_bridge
volumes: volumes:
- ../../.:/emqx - ../..:/emqx
working_dir: /emqx working_dir: /emqx
tty: true tty: true
ldap_server:
container_name: ldap
build:
context: ../..
dockerfile: .ci/compatibility_tests/openldap/Dockerfile
args:
LDAP_TAG: ${LDAP_TAG}
image: openldap
ports:
- 389:389
restart: always
networks:
- emqx_bridge
networks: networks:
emqx_bridge: emqx_bridge:
driver: bridge driver: bridge

View File

@ -9,7 +9,7 @@ RUN wget ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-${LDAP_TA
&& ./configure && make depend && make && make install \ && ./configure && make depend && make && make install \
&& cd .. && rm -rf openldap-${LDAP_TAG} && cd .. && rm -rf openldap-${LDAP_TAG}
COPY .ci/compatibility_tests/openldap/slapd.conf /usr/local/etc/openldap/slapd.conf COPY .ci/docker-compose-file/openldap/slapd.conf /usr/local/etc/openldap/slapd.conf
COPY apps/emqx_auth_ldap/emqx.io.ldif /usr/local/etc/openldap/schema/emqx.io.ldif COPY apps/emqx_auth_ldap/emqx.io.ldif /usr/local/etc/openldap/schema/emqx.io.ldif
COPY apps/emqx_auth_ldap/emqx.schema /usr/local/etc/openldap/schema/emqx.schema COPY apps/emqx_auth_ldap/emqx.schema /usr/local/etc/openldap/schema/emqx.schema
COPY apps/emqx_auth_ldap/test/certs/*.pem /usr/local/etc/openldap/ COPY apps/emqx_auth_ldap/test/certs/*.pem /usr/local/etc/openldap/

View File

@ -1,7 +1,7 @@
ARG BUILD_FROM=postgres:11 ARG BUILD_FROM=postgres:11
FROM ${BUILD_FROM} FROM ${BUILD_FROM}
ARG POSTGRES_USER=postgres ARG POSTGRES_USER=postgres
COPY --chown=$POSTGRES_USER .ci/compatibility_tests/pgsql/pg_hba.conf /var/lib/postgresql/pg_hba.conf COPY --chown=$POSTGRES_USER .ci/docker-compose-file/pgsql/pg_hba.conf /var/lib/postgresql/pg_hba.conf
COPY --chown=$POSTGRES_USER apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/server-key.pem /var/lib/postgresql/server.key COPY --chown=$POSTGRES_USER apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/server-key.pem /var/lib/postgresql/server.key
COPY --chown=$POSTGRES_USER apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/server-cert.pem /var/lib/postgresql/server.crt COPY --chown=$POSTGRES_USER apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/server-cert.pem /var/lib/postgresql/server.crt
COPY --chown=$POSTGRES_USER apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/ca.pem /var/lib/postgresql/root.crt COPY --chown=$POSTGRES_USER apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/ca.pem /var/lib/postgresql/root.crt

View File

@ -24,12 +24,14 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: setup - name: docker compose up
env: env:
LDAP_TAG: ${{ matrix.ldap_tag }} LDAP_TAG: ${{ matrix.ldap_tag }}
run: | run: |
docker-compose -f .ci/compatibility_tests/docker-compose-ldap.yaml build --no-cache docker-compose \
docker-compose -f .ci/compatibility_tests/docker-compose-ldap.yaml up -d -f .ci/docker-compose-file/docker-compose-ldap-tcp.yaml \
-f .ci/docker-compose-file/docker-compose.yaml \
up -d --build
- name: setup - name: setup
if: matrix.network_type == 'ipv4' if: matrix.network_type == 'ipv4'
run: | run: |
@ -74,12 +76,17 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: docker-compose up
run: |
docker-compose \
-f .ci/docker-compose-file/docker-compose-mongo-${{ matrix.connect_type }}.yaml \
-f .ci/docker-compose-file/docker-compose.yaml \
up -d --build
- name: setup - name: setup
env: env:
MONGO_TAG: ${{ matrix.mongo_tag }} MONGO_TAG: ${{ matrix.mongo_tag }}
if: matrix.connect_type == 'tls' if: matrix.connect_type == 'tls'
run: | run: |
docker-compose -f .ci/compatibility_tests/docker-compose-mongo-tls.yaml up -d
cat <<-EOF >> "$GITHUB_ENV" cat <<-EOF >> "$GITHUB_ENV"
EMQX_AUTH__MONGO__SSL=on EMQX_AUTH__MONGO__SSL=on
EMQX_AUTH__MONGO__SSL__CACERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/ca.pem EMQX_AUTH__MONGO__SSL__CACERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/ca.pem
@ -93,7 +100,6 @@ jobs:
MONGO_TAG: ${{ matrix.mongo_tag }} MONGO_TAG: ${{ matrix.mongo_tag }}
if: matrix.connect_type == 'tcp' if: matrix.connect_type == 'tcp'
run: | run: |
docker-compose -f .ci/compatibility_tests/docker-compose-mongo.yaml up -d
echo EMQX_AUTH__MONGO__SSL=off >> "$GITHUB_ENV" echo EMQX_AUTH__MONGO__SSL=off >> "$GITHUB_ENV"
- name: setup - name: setup
if: matrix.network_type == 'ipv4' if: matrix.network_type == 'ipv4'
@ -139,12 +145,17 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: docker-compose up
run: |
docker-compose \
-f .ci/docker-compose-file/docker-compose-mysql-${{ matrix.connect_type }}.yaml \
-f .ci/docker-compose-file/docker-compose.yaml \
up -d --build
- name: setup - name: setup
env: env:
MYSQL_TAG: ${{ matrix.mysql_tag }} MYSQL_TAG: ${{ matrix.mysql_tag }}
if: matrix.connect_type == 'tls' if: matrix.connect_type == 'tls'
run: | run: |
docker-compose -f .ci/compatibility_tests/docker-compose-mysql-tls.yaml up -d
cat <<-EOF >> "$GITHUB_ENV" cat <<-EOF >> "$GITHUB_ENV"
EMQX_AUTH__MYSQL__SSL=on EMQX_AUTH__MYSQL__SSL=on
EMQX_AUTH__MYSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/ca.pem EMQX_AUTH__MYSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/ca.pem
@ -158,7 +169,6 @@ jobs:
MYSQL_TAG: ${{ matrix.mysql_tag }} MYSQL_TAG: ${{ matrix.mysql_tag }}
if: matrix.connect_type == 'tcp' if: matrix.connect_type == 'tcp'
run: | run: |
docker-compose -f .ci/compatibility_tests/docker-compose-mysql.yaml up -d
echo EMQX_AUTH__MYSQL__SSL=off >> "$GITHUB_ENV" echo EMQX_AUTH__MYSQL__SSL=off >> "$GITHUB_ENV"
- name: setup - name: setup
if: matrix.network_type == 'ipv4' if: matrix.network_type == 'ipv4'
@ -209,13 +219,17 @@ jobs:
- tcp - tcp
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: docker-compose up
run: |
docker-compose \
-f .ci/docker-compose-file/docker-compose-pgsql-${{ matrix.connect_type }}.yaml \
-f .ci/docker-compose-file/docker-compose.yaml \
up -d --build
- name: setup - name: setup
env: env:
PGSQL_TAG: ${{ matrix.pgsql_tag }} PGSQL_TAG: ${{ matrix.pgsql_tag }}
if: matrix.connect_type == 'tls' if: matrix.connect_type == 'tls'
run: | run: |
docker-compose -f .ci/compatibility_tests/docker-compose-pgsql-tls.yaml build --no-cache
docker-compose -f .ci/compatibility_tests/docker-compose-pgsql-tls.yaml up -d
cat <<-EOF >> "$GITHUB_ENV" cat <<-EOF >> "$GITHUB_ENV"
EMQX_AUTH__PGSQL__SSL=on EMQX_AUTH__PGSQL__SSL=on
EMQX_AUTH__PGSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/ca.pem EMQX_AUTH__PGSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/ca.pem
@ -229,7 +243,6 @@ jobs:
PGSQL_TAG: ${{ matrix.pgsql_tag }} PGSQL_TAG: ${{ matrix.pgsql_tag }}
if: matrix.connect_type == 'tcp' if: matrix.connect_type == 'tcp'
run: | run: |
docker-compose -f .ci/compatibility_tests/docker-compose-pgsql.yaml up -d
echo EMQX_AUTH__PGSQL__SSL=off >> "$GITHUB_ENV" echo EMQX_AUTH__PGSQL__SSL=off >> "$GITHUB_ENV"
- name: setup - name: setup
if: matrix.network_type == 'ipv4' if: matrix.network_type == 'ipv4'
@ -284,13 +297,17 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: docker-compose up
run: |
docker-compose \
-f .ci/docker-compose-file/docker-compose-redis-${{ matrix.node_type }}-${{ matrix.connect_type }}.yaml \
-f .ci/docker-compose-file/docker-compose.yaml \
up -d --build
- name: setup - name: setup
env: env:
REDIS_TAG: ${{ matrix.redis_tag }} REDIS_TAG: ${{ matrix.redis_tag }}
if: matrix.connect_type == 'tls' if: matrix.connect_type == 'tls'
run: | run: |
set -exu
docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}-tls.yaml up -d
cat <<-EOF >> "$GITHUB_ENV" cat <<-EOF >> "$GITHUB_ENV"
EMQX_AUTH__REDIS__SSL=on EMQX_AUTH__REDIS__SSL=on
EMQX_AUTH__REDIS__SSL__CACERTFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/ca.crt EMQX_AUTH__REDIS__SSL__CACERTFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/ca.crt
@ -304,11 +321,9 @@ jobs:
REDIS_TAG: ${{ matrix.redis_tag }} REDIS_TAG: ${{ matrix.redis_tag }}
if: matrix.connect_type == 'tcp' if: matrix.connect_type == 'tcp'
run: | run: |
docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}.yaml up -d
echo EMQX_AUTH__REDIS__SSL=off >> "$GITHUB_ENV" echo EMQX_AUTH__REDIS__SSL=off >> "$GITHUB_ENV"
- name: get server address - name: get server address
run: | run: |
set -exu
ipv4_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' redis) ipv4_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' redis)
ipv6_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' redis) ipv6_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' redis)
cat <<-EOF >> "$GITHUB_ENV" cat <<-EOF >> "$GITHUB_ENV"
@ -318,7 +333,6 @@ jobs:
- name: setup - name: setup
if: matrix.node_type == 'single' && matrix.connect_type == 'tcp' if: matrix.node_type == 'single' && matrix.connect_type == 'tcp'
run: | run: |
set -exu
cat <<-EOF >> "$GITHUB_ENV" cat <<-EOF >> "$GITHUB_ENV"
EMQX_AUTH__REDIS__TYPE=single EMQX_AUTH__REDIS__TYPE=single
EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6379 EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6379
@ -326,7 +340,6 @@ jobs:
- name: setup - name: setup
if: matrix.node_type == 'single' && matrix.connect_type == 'tls' if: matrix.node_type == 'single' && matrix.connect_type == 'tls'
run: | run: |
set -exu
cat <<-EOF >> "$GITHUB_ENV" cat <<-EOF >> "$GITHUB_ENV"
EMQX_AUTH__REDIS__TYPE=single EMQX_AUTH__REDIS__TYPE=single
EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6380 EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6380
@ -334,7 +347,6 @@ jobs:
- name: setup - name: setup
if: matrix.node_type == 'cluster' && matrix.connect_type == 'tcp' if: matrix.node_type == 'cluster' && matrix.connect_type == 'tcp'
run: | run: |
set -exu
cat <<-EOF >> "$GITHUB_ENV" cat <<-EOF >> "$GITHUB_ENV"
EMQX_AUTH__REDIS__TYPE=cluster EMQX_AUTH__REDIS__TYPE=cluster
EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:7000 EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:7000
@ -342,7 +354,6 @@ jobs:
- name: setup - name: setup
if: matrix.node_type == 'cluster' && matrix.connect_type == 'tls' if: matrix.node_type == 'cluster' && matrix.connect_type == 'tls'
run: | run: |
set -exu
cat <<-EOF >> "$GITHUB_ENV" cat <<-EOF >> "$GITHUB_ENV"
EMQX_AUTH__REDIS__TYPE=cluster EMQX_AUTH__REDIS__TYPE=cluster
EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:8000 EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:8000
@ -353,7 +364,12 @@ jobs:
docker exec -i erlang bash -c "echo \"https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com\" > /root/.git-credentials && git config --global credential.helper store" docker exec -i erlang bash -c "echo \"https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com\" > /root/.git-credentials && git config --global credential.helper store"
fi fi
- name: run test cases - name: run test cases
timeout-minutes: 10
run: | run: |
while ! nc -zv ${EMQX_AUTH__REDIS__SERVER%:*} ${EMQX_AUTH__REDIS__SERVER##*:} > /dev/null 2>&1; do
echo "waiting redis server"
sleep 1
done
export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_ export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
printenv > .env printenv > .env
docker exec -i erlang sh -c "make ensure-rebar3" docker exec -i erlang sh -c "make ensure-rebar3"

View File

@ -50,8 +50,14 @@ jobs:
LDAP_TAG: 2.4.50 LDAP_TAG: 2.4.50
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
docker-compose -f .ci/apps_tests/docker-compose.yaml build --no-cache docker-compose \
docker-compose -f .ci/apps_tests/docker-compose.yaml up -d -f .ci/docker-compose-file/docker-compose.yaml \
-f .ci/docker-compose-file/docker-compose-ldap-tcp.yaml \
-f .ci/docker-compose-file/docker-compose-mongo-tcp.yaml \
-f .ci/docker-compose-file/docker-compose-mysql-tcp.yaml \
-f .ci/docker-compose-file/docker-compose-pgsql-tcp.yaml \
-f .ci/docker-compose-file/docker-compose-redis-single-tcp.yaml \
up -d --build
- name: docker compose up - name: docker compose up
if: env.EDITION == 'enterprise' if: env.EDITION == 'enterprise'
env: env: