mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 08:56:29 +00:00
Improve services docs (#927)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
This commit is contained in:
parent
a8c23e9771
commit
328eb98109
1 changed files with 23 additions and 3 deletions
|
@ -1,6 +1,10 @@
|
||||||
# Services
|
# Services
|
||||||
|
|
||||||
Woodpecker provides a services section in the YAML file used for defining service containers. The below configuration composes database and cache containers.
|
Woodpecker provides a services section in the YAML file used for defining service containers.
|
||||||
|
The below configuration composes database and cache containers.
|
||||||
|
|
||||||
|
Services are accessed using custom hostnames.
|
||||||
|
In the example below, the MySQL service is assigned the hostname `database` and is available at `database:3306`.
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
pipeline:
|
pipeline:
|
||||||
|
@ -18,8 +22,6 @@ services:
|
||||||
image: redis
|
image: redis
|
||||||
```
|
```
|
||||||
|
|
||||||
Services are accessed using custom hostnames. In the above example the mysql service is assigned the hostname `database` and is available at `database:3306`.
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Service containers generally expose environment variables to customize service startup such as default usernames, passwords and ports. Please see the official image documentation to learn more.
|
Service containers generally expose environment variables to customize service startup such as default usernames, passwords and ports. Please see the official image documentation to learn more.
|
||||||
|
@ -77,3 +79,21 @@ services:
|
||||||
database:
|
database:
|
||||||
image: mysql
|
image: mysql
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Complete Pipeline Example
|
||||||
|
|
||||||
|
```yml
|
||||||
|
services:
|
||||||
|
database:
|
||||||
|
image: mysql
|
||||||
|
environment:
|
||||||
|
- MYSQL_DATABASE=test
|
||||||
|
- MYSQL_ROOT_PASSWORD=example
|
||||||
|
pipeline:
|
||||||
|
get-version:
|
||||||
|
image: ubuntu
|
||||||
|
commands:
|
||||||
|
- ( apt update && apt dist-upgrade -y && apt install -y mysql-client 2>&1 )> /dev/null
|
||||||
|
- sleep 30s # need to wait for mysql-server init
|
||||||
|
- echo 'SHOW VARIABLES LIKE "version"' | mysql -uroot -hdatabase test -pexample
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue