Skip to content

Commit

Permalink
Change entry point to pebble (#26)
Browse files Browse the repository at this point in the history
* Change entry point to peble

* Update command

* Extract start command to a separate script
  • Loading branch information
dmitry-ratushnyy authored Sep 29, 2023
1 parent 2e52a77 commit be6e870
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install dependencies
run: |
sudo snap install yq
sudo snap install rockcraft --classic --edge --revision=687
sudo snap install rockcraft --classic --edge
sudo snap install charmcraft --classic --revision 1349
- name: Build ROCK
run: |
Expand Down
21 changes: 12 additions & 9 deletions rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ description: |
as a NoSQL database program, MongoDB uses JSON
-like documents with optional schemas.
license: Apache-2.0 # your application's SPDX license
entrypoint:
- /usr/bin/setpriv
- --clear-groups
- --reuid
- mongodb
- --regid
- mongodb
- --
- /usr/bin/mongod

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:
Expand All @@ -44,13 +43,16 @@ parts:
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},')
Expand All @@ -59,6 +61,7 @@ parts:
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}
Expand Down
3 changes: 3 additions & 0 deletions scripts/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

/usr/bin/setpriv --clear-groups --reuid mongodb --regid mongodb -- /usr/bin/mongod

0 comments on commit be6e870

Please sign in to comment.