-
Notifications
You must be signed in to change notification settings - Fork 3
/
rockcraft.yaml
81 lines (71 loc) · 2.14 KB
/
rockcraft.yaml
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
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
name: charmed-mongodb # the name of your ROCK
base: ubuntu@22.04 # the base environment for this ROCK
version: "5.0.14-12" # just for humans. Semantic versioning is recommended
summary: MongoDB in a rock. # 79 char long summary
description: |
MongoDB is a source-available cross-platform
document-oriented database program. Classified
as a NoSQL database program, MongoDB uses JSON
-like documents with optional schemas.
license: Apache-2.0 # your application's SPDX license
services:
mongod:
summary: Start Mongod
override: replace
startup: enabled
command: "/bin/bash /bin/start.sh"
platforms: # The platforms this ROCK should be built on and run on
amd64:
parts:
mongo-snap:
plugin: nil
stage-snaps:
- charmed-mongodb/5/edge
overlay-packages:
- ca-certificates
dep-debs:
plugin: nil
stage-packages:
- libssh-4
- libbrotli1
non-root-user:
plugin: nil
after: [mongo-snap]
overlay-script: |
# Create a user in the $CRAFT_OVERLAY chroot
groupadd -R $CRAFT_OVERLAY -g 584788 mongodb
useradd -R $CRAFT_OVERLAY -M -r -g mongodb -u 584788 mongodb
override-prime: |
craftctl default
# Give permission and create the required directories
mkdir -p $CRAFT_PRIME/data/db
chmod 0755 $CRAFT_PRIME/data/db
chown -R 584788:584788 $CRAFT_PRIME/data/db
# enable security monitoring
rocks=usr/share/rocks/
mkdir -p ${rocks}
## for deb packages
declare -a arr=()
arr+=('${db:Status-Abbrev},')
arr+=('${binary:Package},')
arr+=('${Version},')
arr+=('${source:Package},')
arr+=('${Source:Version}\n')
dpkg-query -W -f "${arr[*]}" > ${rocks}/dpkg.query
## for snap packages
cp snap.charmed-mongodb/manifest.yaml ${rocks}
cp snap.charmed-mongodb/snapcraft.yaml ${rocks}
rock-license:
plugin: dump
source: licenses
organize:
LICENSE-rock: licenses/LICENSE-rock
entry:
plugin: dump
source: scripts
organize:
start.sh: bin/start.sh
stage:
- bin/start.sh