This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAcornfile
107 lines (97 loc) · 2.5 KB
/
Acornfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: "MariaDB Acorn"
description: "Acorn providing MariaDB"
readme: "./README.md"
icon: "./mariadb.svg"
info: localData.info
args: {
// Name of the database to create. Defaults to "instance"
// Changing this value will have no effect on an existing instance
dbName: "instance"
// Name of the user to create. If a username is not set, one is randomly generated
// Changing this value will have no effect on an existing instance
username: ""
}
services: db: {
default: true
container: "mariadb"
secrets: ["admin", "user"]
ports: "3306"
data: dbName: args.dbName
}
containers: mariadb: {
name: "MariaDB"
description: "Containerized MariaDB database server"
image: "mariadb:10.11.6" // Current LTS Version
ports: "3306/tcp"
env: {
MARIADB_ROOT_PASSWORD: "@{secrets.admin.password}"
MARIADB_USER: "@{secrets.user.username}"
MARIADB_PASSWORD: "@{secrets.user.password}"
MARIADB_DATABASE: args.dbName
}
dirs: "/var/lib/mysql": "volume://db-data?subPath=data"
probes: [
{
type: "liveness"
initialDelaySeconds: 10
exec: command: localData.probeExecCommand
},
{
type: "readiness"
initialDelaySeconds: 5
exec: command: localData.probeExecCommand
},
]
}
secrets: admin: {
name: "Admin user credentials"
description: "Credentials for the admin user with full control over the database server"
type: "basic"
params: {
usernameLength: 11
usernameCharacters: "a-z"
passwordCharacters: "A-Za-z0-9^_-"
}
data: username: "root"
}
secrets: user: {
name: "DB User Credentials"
description: "Credentials for the user with full access to the created database instance"
type: "basic"
params: {
usernameLength: 11
usernameCharacters: "a-z"
passwordCharacters: "A-Za-z0-9^_-"
}
data: username: args.username
}
localData: probeExecCommand: [
"bash",
"-ec",
"exec",
"mysqladmin",
"status",
"-uroot",
"-p\"${MARIADB_ROOT_PASSWORD}\"",
]
localData: info: """
## Usage
```aml
services: db: {
external: "@{acorn.name}"
}
containers: app: {
image: "app-image"
consumes: ["db"]
env: {
DB_HOST: "@{@{service.}db.address}"
DB_PORT: "@{@{service.}db.port.3306}"
DB_NAME: "@{@{service.}db.data.dbName}"
DB_ADMIN_USER: "@{@{service.}db.secrets.admin.username}"
DB_ADMIN_PASS: "@{@{service.}db.secrets.admin.password}"
DB_USER: "@{@{service.}db.secrets.user.username}"
DB_PASS: "@{@{service.}db.secrets.user.password}"
}
}
```
"""