Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Fix MongoDB #54

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion src/modules/farmpi/config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# All our config settings must start with FARMPI_

# MongoDB
[ -n "$FARMPI_MONGODB_VERSION" ] || FARMPI_MONGODB_VERSION=4.4
# Version list here:
# https://github.com/themattman/mongodb-raspberrypi-binaries/releases
[ -n "$FARMPI_MONGODB_VERSION" ] || FARMPI_MONGODB_VERSION=r6.0.5

# NodeJS
[ -n "$FARMPI_NODEJS_VERSION" ] || FARMPI_NODEJS_VERSION=14.x
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Mongo DB
After=multi-user.target

[Service]
Type=idle
ExecStart=/root/bin/mdb/mongod --dbpath /var/lib/mongodb --logpath /var/log/mongodb/mongod.log --port 27017

[Install]
WantedBy=multi-user.target
21 changes: 15 additions & 6 deletions src/modules/farmpi/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,18 @@ echo " - Reinstall iputils-ping"
apt-get install --reinstall iputils-ping

# MongoDB
wget -qO - https://www.mongodb.org/static/pgp/server-$FARMPI_MONGODB_VERSION.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/`cat /etc/os-release | grep "^ID=" | cut -d "=" -f2` `cat /etc/os-release | grep "^VERSION_CODENAME=" | cut -d "=" -f2`/mongodb-org/$FARMPI_MONGODB_VERSION multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-$FARMPI_MONGODB_VERSION.list
apt-get update
apt-get install -y --force-yes mongodb-org
systemctl enable mongod
systemctl start mongod
cd /root
mkdir -p /var/lib/mongodb
mkdir -p /var/log/mongodb
wget https://github.com/themattman/mongodb-raspberrypi-binaries/releases/download/$FARMPI_MONGODB_VERSION-rpi-unofficial/mongodb.ce.pi.$FARMPI_MONGODB_VERSION.tar.gz
mkdir tmp-mongodb
cd tmp-mongodb
mv ../mongodb.ce.pi.$FARMPI_MONGODB_VERSION.tar.gz .
tar xzvf mongodb.ce.pi.$FARMPI_MONGODB_VERSION.tar.gz
cp mongod /root/bin/mongod
cd ..
rm -rf tmp-mongodb


# NodeJS
curl -sL https://deb.nodesource.com/setup_$FARMPI_NODEJS_VERSION | bash -
Expand Down Expand Up @@ -150,6 +156,9 @@ else
rm /etc/systemd/system/gencert.service
fi

systemctl_if_exists enable mongod.service
systemctl_if_exists start mongod.service

#cleanup
apt-get clean
apt-get autoremove -y
Expand Down