-
Notifications
You must be signed in to change notification settings - Fork 3
/
rockcraft.yaml
78 lines (70 loc) · 2.17 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
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
name: charmed-mongodb # the name of your rock
base: [email protected] # the base environment for this rock
version: "6.0.6-2" # 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/6/edge
overlay-packages:
- ca-certificates
- libssh-4
- libbrotli1
- logrotate
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
usr/share/doc/logrotate/copyright: licenses/COPYRIGHT-logrotate
entry:
plugin: dump
source: scripts
organize:
start.sh: bin/start.sh
stage:
- bin/start.sh