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 3
/
Copy pathAcornfile
130 lines (118 loc) · 2.57 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: "Mongo Acorn"
description: "Acorn providing MongoDB"
readme: "./README.md"
info: localData.info
icon: "./icon.png"
args: {
// Name of the default database
dbName: "mydb"
// Name of the default user
dbUser: ""
}
services: db: {
default: true
container: "mongodb"
secrets: ["admin", "user"]
ports: "27017"
data: {
dbName: args.dbName
proto: "mongodb"
}
}
containers: mongodb: {
name: "MongoDB"
description: "Container running a MongoDB server"
image: "mongo:6.0"
ports: "27017/tcp"
env: {
MONGO_INITDB_ROOT_USERNAME: "secret://admin/username"
MONGO_INITDB_ROOT_PASSWORD: "secret://admin/password"
REPLICA_SET_KEY: "secret://replica-set-key/token"
}
entrypoint: ["/acorn/scripts/start-mongodb.sh"]
dirs: {
"/acorn/scripts": "./scripts"
"/data/db": "volume://mongodb-data"
}
probes: [
{
type: "liveness"
initialDelaySeconds: 10
timeoutSeconds: 5
tcp: {
url: "tcp://localhost:27017"
}
},
]
}
jobs: {
"init-db": {
image: "mongo:6.0"
env: {
MONGO_INITDB_ROOT_USERNAME: "secret://admin/username"
MONGO_INITDB_ROOT_PASSWORD: "secret://admin/password"
MONGO_USERNAME: "secret://user/username"
MONGO_PASSWORD: "secret://user/password"
MONGO_HOST: "mongodb"
MONGO_DATABASE: args.dbName
}
dependsOn: ["mongodb"]
entrypoint: ["/acorn/scripts/render.sh"]
dirs: "/acorn/scripts": "./scripts"
files: {
"/var/run/replica-set": """
{
_id: "rs0",
version: 1,
members: [ { _id: 0, host: "mongodb:27017" } ]
}
"""
}
}
}
volumes: "mongodb-data": {}
secrets: {
"replica-set-key": type: "token"
admin: {
name: "credentials of the admin user"
type: "basic"
params: {
passwordLength: 10
passwordCharacters: "A-Za-z0-9"
}
data: {
username: "root"
password: ""
}
}
user: {
name: "credentials of the additional user"
type: "basic"
params: {
usernameLength: 7
usernameCharacters: "a-z"
passwordLength: 10
passwordCharacters: "A-Za-z0-9"
}
data: {
username: std.ifelse(args.dbUser != "", args.dbUser, "")
password: ""
}
}
}
localData: info: """
## Usage
services: db: {
image: "ghcr.io/acorn-io/mongodb:v#.#-#"
}
containers: app: {
image: "app-image"
env: {
DB_HOST: "@{@{service.}db.address}"
DB_PORT: "@{@{service.}db.port.27017}"
DB_NAME: "@{@{service.}db.data.dbName}"
DB_USER: "@{@{service.}db.secrets.user.username}"
DB_PASS: "@{@{service.}db.secrets.user.password}"
}
}
"""