mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 08:06:52 +02: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,6 +1,10 @@
|
||||
# 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
|
||||
pipeline:
|
||||
@ -18,8 +22,6 @@ services:
|
||||
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
|
||||
|
||||
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:
|
||||
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 New Issue
Block a user