Skip to content
This repository has been 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 3 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
3 changes: 0 additions & 3 deletions src/modules/farmpi/config
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
###############################################################################
# All our config settings must start with FARMPI_

# MongoDB
[ -n "$FARMPI_MONGODB_VERSION" ] || FARMPI_MONGODB_VERSION=4.4

Craftzman7 marked this conversation as resolved.
Show resolved Hide resolved
# 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 /data/db/octofarm_db --logpath /data/db/octofarm_db_log/db.log --port 27017

[Install]
WantedBy=multi-user.target
20 changes: 14 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 /data/db/octofarm_db
Craftzman7 marked this conversation as resolved.
Show resolved Hide resolved
mkdir -p /data/db/octofarm_db_log
Craftzman7 marked this conversation as resolved.
Show resolved Hide resolved
wget https://github.com/themattman/mongodb-raspberrypi-binaries/releases/download/r6.0.5-rpi-unofficial/mongodb.ce.pi.r6.0.5.tar.gz
mkdir tmp-mongodb
cd tmp-mongodb
mv ../mongodb.ce.pi.r6.0.5.tar.gz .
tar xzvf mongodb.ce.pi.r6.0.5.tar.gz
Craftzman7 marked this conversation as resolved.
Show resolved Hide resolved
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,8 @@ else
rm /etc/systemd/system/gencert.service
fi

systemctl_if_exists enable mongod.service

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