Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change entry point to pebble #26

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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