Skip to content
Dominic Létourneau edited this page Jan 28, 2022 · 23 revisions

MongoDB backup

# This will create a dump/MovIt directory with all documents.
mongodump --db MovIt
# This will create an archive of the dump
tar cvzf movit_db_backup.tar.gz dump

MongoDB restore

# Extract the archive (will create the dump directory)
tar xvzf movit_db_backup.tar.gz
# Make sure backend if disabled when updating (it is using the database)
sudo systemctl stop movit_backend.service
# Drop current content of database
mongo MovIt --eval "db.dropDatabase();"
# Restore the DB (from the dump directory)
mongorestore
# Re-Start backend
sudo systemctl start movit_backend.service 

MongoDB (Re) Install from scratch

# Remove MongoDB from system
sudo apt-get remove mongodb
# Cleanup database files 
sudo rm -rf /var/lib/mongodb
# Re-Install MongoDB
sudo apt-get install mongodb
# Enable MongoDB
sudo systemctl enable mongodb
# Start MongoDB
sudo systemctl start mongodb
# Init MOvIT database
cd ~/MOvITPlus/MOvIT-Detect-Backend/
sudo node initDatabase.js

WiFi Debug

Step 1: Change Hotspot to 5GHz

sudo nano /etc/hostapd/hostapd.conf

Use this config:

ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
country_code=CA
interface=wlan0
driver=nl80211
ssid=Movit-NOCONF
hw_mode=a
channel=36
ieee80211d=1
ieee80211n=1
ieee80211ac=1
wmm_enabled=0
macaddr_acl=0
auth_algs=1
wpa=2
wpa_passphrase=movitplus
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP

Save file with CTRL-X, answer yes to save file

Then reboot:

sudo reboot

Option 2 : Remove hotspot (hostapd) and configure wlan0 as a client

You need a keyboard / monitor for these steps.

Step 1: Disable hostapd

sudo systemctl stop hostapd.service 
sudo systemctl disable hostapd.service

Step 2: Update network interface configuration

sudo nano /etc/dhcpcd.conf

Change the last lines (wpa0 to wpa1):

interface wlan1
static ip_address=192.168.10.1/24
nohook wpa_supplicant

Save file with CTRL-X, answer yes to save file

Step 3: Configure the client to connect to the local network

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Configure with:

country=CA
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ap_scan=1

update_config=1
network={
	ssid="<ENTER SSID NAME HERE>"
	psk=<ENTER PASSWORD HERE>
}

Step 4: Reboot

sudo reboot

Step 5: You can remove the USB WiFi dongle.

Once rebooted, open a terminal and type:

sudo ifconfig

To get the IP address.

You can now connect to this IP address to connect to the frontend.

Clone this wiki locally