feat(database): support mysql
This commit is contained in:
parent
673dad651a
commit
c493431915
|
@ -16,8 +16,12 @@ drone_runner_capacity: "3"
|
||||||
drone_host_port: "8080"
|
drone_host_port: "8080"
|
||||||
drone_database_driver: "sqlite"
|
drone_database_driver: "sqlite"
|
||||||
drone_sqlite_dir: "/var/lib/drone"
|
drone_sqlite_dir: "/var/lib/drone"
|
||||||
drone_postgress_data_dir: "/var/lib/postgresql/data"
|
drone_postgres_data_dir: "/var/lib/postgresql/data"
|
||||||
drone_postgress_password: "drone"
|
drone_postgres_password: "drone"
|
||||||
drone_postgress_user: "drone"
|
drone_postgres_user: "drone"
|
||||||
drone_postgress_db: "drone"
|
drone_postgres_db: "drone"
|
||||||
drone_database_datasource: ""
|
drone_database_datasource: ""
|
||||||
|
drone_mysql_data_dir: "/var/lib/mysql/data"
|
||||||
|
drone_mysql_password: "drone"
|
||||||
|
drone_mysql_user: "drone"
|
||||||
|
drone_mysql_db: "drone"
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
---
|
---
|
||||||
- name: Creates postgres directory
|
- name: Creates postgres directory
|
||||||
file:
|
file:
|
||||||
path: "{{ drone_postgress_data_dir }}"
|
path: "{{ drone_postgres_data_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
register: drone_postgress_data_dir
|
register: drone_postgres_data_dir
|
||||||
|
when: drone_database_driver == "postgres"
|
||||||
tags:
|
tags:
|
||||||
- postgres
|
- postgres
|
||||||
|
- database
|
||||||
|
|
||||||
- name: start postgres for drone ci
|
- name: start postgres for drone ci
|
||||||
docker_container:
|
docker_container:
|
||||||
|
@ -17,11 +19,45 @@
|
||||||
ports:
|
ports:
|
||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- "{{ drone_postgress_data_dir }}:/var/lib/postgresql/data"
|
- "{{ drone_postgres_data_dir }}:/var/lib/postgresql/data"
|
||||||
env:
|
env:
|
||||||
POSTGRES_PASSWORD: "{{ drone_postgress_password }}"
|
POSTGRES_PASSWORD: "{{ drone_postgres_password }}"
|
||||||
POSTGRES_USER: "{{ drone_postgress_user }}"
|
POSTGRES_USER: "{{ drone_postgres_user }}"
|
||||||
POSTGRES_DB: "{{ drone_postgress_db }}"
|
POSTGRES_DB: "{{ drone_postgres_db }}"
|
||||||
when: drone_postgress_data_dir is defined and drone_postgress_data_dir.changed
|
when: drone_postgres_data_dir is defined and drone_postgres_data_dir.changed or
|
||||||
|
drone_database_driver == "postgres"
|
||||||
tags:
|
tags:
|
||||||
- postgres
|
- postgres
|
||||||
|
- database
|
||||||
|
|
||||||
|
- name: Creates mysql directory
|
||||||
|
file:
|
||||||
|
path: "{{ drone_mysql_data_dir }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
register: drone_mysql_data_dir
|
||||||
|
when: drone_database_driver == "mysql"
|
||||||
|
tags:
|
||||||
|
- mysql
|
||||||
|
- database
|
||||||
|
|
||||||
|
- name: start mysql for drone ci
|
||||||
|
docker_container:
|
||||||
|
name: mysql
|
||||||
|
image: mysql:5.7
|
||||||
|
state: started
|
||||||
|
restart_policy: always
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
volumes:
|
||||||
|
- "{{ drone_mysql_data_dir }}:/var/lib/mysqlql/data"
|
||||||
|
env:
|
||||||
|
MYSQL_PASSWORD: "{{ drone_mysql_password }}"
|
||||||
|
MYSQL_USER: "{{ drone_mysql_user }}"
|
||||||
|
MYSQL_DATABASE: "{{ drone_mysql_db }}"
|
||||||
|
MYSQL_ROOT_PASSWORD: "{{ drone_mysql_password }}"
|
||||||
|
when: drone_mysql_data_dir is defined and drone_mysql_data_dir.changed or
|
||||||
|
drone_database_driver == "mysql"
|
||||||
|
tags:
|
||||||
|
- mysql
|
||||||
|
- database
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
- "{{ drone_sqlite_dir }}:/data"
|
- "{{ drone_sqlite_dir }}:/data"
|
||||||
env_file: /etc/drone/drone-server.env
|
env_file: /etc/drone/drone-server.env
|
||||||
when: ((drone_server_config is defined and drone_server_config.changed) or
|
when: ((drone_server_config is defined and drone_server_config.changed) or
|
||||||
(drone_postgress_data_dir is defined and drone_postgress_data_dir.changed)) and
|
(drone_postgres_data_dir is defined and drone_postgres_data_dir.changed)) or
|
||||||
drone_database_driver != "sqlite"
|
drone_database_driver != "sqlite"
|
||||||
tags:
|
tags:
|
||||||
- drone-server
|
- drone-server
|
||||||
|
|
Loading…
Reference in New Issue
Block a user