generated from go-kratos/kratos-layout
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
shiqinfeng
committed
Nov 18, 2023
1 parent
35f749c
commit 3773c86
Showing
11 changed files
with
180 additions
and
77 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
- name: Get docker Image Registry Hostname | ||
hosts: registry | ||
tasks: | ||
- name: get registry hostname | ||
command: cat /etc/hostname | ||
register: registry_hostname | ||
|
||
- name: Install Nacos | ||
hosts: nacos | ||
vars_files: | ||
- vars.yml | ||
vars: | ||
- registry_addr: "{{registry_hostname.stdout}}:{{registry_srv_port}}" | ||
become: true | ||
tasks: | ||
- name: Copy Docker Compose files | ||
template: | ||
src: ../{{ item }} | ||
dest: /tmp/{{ item }} | ||
force: true | ||
loop: | ||
- "{{nacos1_compose_file}}" | ||
- "{{nacos2_compose_file}}" | ||
- "{{nacos3_compose_file}}" | ||
- "{{nacos_mysql_compose_file}}" | ||
|
||
- name: Start Nacos1 | ||
shell: | ||
cmd: "docker-compose -f /tmp/{{nacos1_compose_file}} up -d" | ||
when: nacos1_host == ansible_hostname | ||
|
||
# - name: Delete docker-compose.yml | ||
# file: | ||
# dest: /tmp/{{ item }} | ||
# state: absent | ||
# loop: | ||
# - "{{nacos1_compose_file}}" | ||
# - "{{nacos2_compose_file}}" | ||
# - "{{nacos3_compose_file}}" | ||
# - "{{nacos_mysql_compose_file}}" |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: "3.8" | ||
services: | ||
nacos1: | ||
hostname: nacos1 | ||
container_name: nacos1 | ||
image: "{{registry_addr}}/{{nacos_image}}" | ||
volumes: | ||
- ./cluster-logs/nacos1:/home/nacos/logs | ||
ports: | ||
- "{{nacos1_conn_port1}}:7848" | ||
- "{{nacos1_srv_port}}:8848" | ||
- "{{nacos1_conn_port2}}:9848" | ||
- "{{nacos1_conn_port3}}:9849" | ||
env_file: | ||
- ./{{config_nacos}} | ||
restart: always | ||
depends_on: | ||
mysql: | ||
condition: service_healthy |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: "3.8" | ||
services: | ||
nacos2: | ||
hostname: nacos2 | ||
image: "{{registry_addr}}/{{nacos_image}}" | ||
container_name: nacos2 | ||
volumes: | ||
- ./cluster-logs/nacos2:/home/nacos/logs | ||
ports: | ||
- "{{nacos2_conn_port1}}:7848" | ||
- "{{nacos2_srv_port}}:8848" | ||
- "{{nacos2_conn_port2}}:9848" | ||
- "{{nacos2_conn_port3}}:9849" | ||
env_file: | ||
- ./{{config_nacos}} | ||
restart: always | ||
depends_on: | ||
mysql: | ||
condition: service_healthy | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: "3.8" | ||
services: | ||
nacos2: | ||
hostname: nacos2 | ||
image: "{{registry_addr}}/{{nacos_image}}" | ||
container_name: nacos2 | ||
volumes: | ||
- ./cluster-logs/nacos2:/home/nacos/logs | ||
ports: | ||
- "{{nacos3_conn_port1}}:7848" | ||
- "{{nacos3_srv_port}}:8848" | ||
- "{{nacos3_conn_port2}}:9848" | ||
- "{{nacos3_conn_port3}}:9849" | ||
env_file: | ||
- ./{{config_nacos}} | ||
restart: always | ||
depends_on: | ||
mysql: | ||
condition: service_healthy | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: "3.8" | ||
services: | ||
mysql: | ||
container_name: mysql | ||
image: "{{registry_addr}}/{{nacos_mysql_image}}" | ||
env_file: | ||
- ./{{config_nacos_mysql}} | ||
volumes: | ||
- ./mysql:/var/lib/mysql | ||
ports: | ||
- "{{nacos_mysql_port}}:3306" | ||
healthcheck: | ||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] | ||
interval: 5s | ||
timeout: 10s | ||
retries: 10 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
FROM mysql:8.0.31 | ||
ADD https://raw.githubusercontent.com/alibaba/nacos/develop/distribution/conf/mysql-schema.sql /docker-entrypoint-initdb.d/nacos-mysql.sql | ||
FROM dockerproxy.com/library/mysql:8.0.31 | ||
ADD https://raw.staticdn.net/alibaba/nacos/develop/distribution/conf/mysql-schema.sql /docker-entrypoint-initdb.d/nacos-mysql.sql | ||
RUN chown -R mysql:mysql /docker-entrypoint-initdb.d/nacos-mysql.sql | ||
EXPOSE 3306 | ||
CMD ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"] |