-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
122 changed files
with
6,443 additions
and
422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
# NODE_ENV options: development | production | ||
NODE_ENV=dev | ||
# address and port this server will listen on | ||
LISTEN_ADDRESS=0.0.0.0 | ||
LISTEN_PORT=8081 | ||
|
||
DEV_PORT=8081 | ||
PROD_PORT=8080 | ||
# this address will be given to, and used by, IoT devices to connect to this server | ||
# use public address for devices to connect over the internet (will require port forwarding) | ||
# use private address for devices on your LAN | ||
SERVER_ADDRESS=192.168.0.3 | ||
|
||
JWT_SECRET="TOP_SECRET" | ||
# this address will be given to, and used by, IoT devices to connect to your MQTT server | ||
MQTT_ADDRESS=192.168.0.3 | ||
MQTT_PORT=1883 | ||
|
||
# string starts with: mongodb+srv:// | ||
# mongodb connection string - starts with: mongodb+srv:// | ||
MONGODB_CONNECTION_STRING= | ||
|
||
MQTT_ADDRESS= | ||
MQTT_PORT= | ||
# JWT secret | ||
JWT_SECRET="TOP_SECRET" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
**/node_modules | ||
node_modules | ||
.env | ||
.vscode | ||
.vscode | ||
.vagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.box = "ubuntu/focal64" | ||
config.vm.provider "virtualbox" do |v| | ||
v.memory = 2048 | ||
v.cpus = 2 | ||
v.name = "MongoDB" | ||
end | ||
|
||
config.vm.network "forwarded_port", guest: 27017, host: 27017 | ||
config.vm.network "private_network", ip: "192.168.56.10" | ||
|
||
config.vm.provision "shell", path: "mongo-bootstrap.sh" | ||
config.vm.synced_folder "./shared", "/vagrant" | ||
|
||
config.vm.provider :virtualbox do |v| | ||
v.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"] | ||
v.customize ["modifyvm", :id, "--uartmode1", "file", File::NULL] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Adding Repo | ||
echo "-------------------------- ADDING REPO -------------------------------------" | ||
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - | ||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list | ||
|
||
# Updating Package Index and Installing MongoDB-5 | ||
echo "-------------------------- UPDATING PACKAGE INDEX -------------------------------------" | ||
sudo apt update | ||
|
||
echo "-------------------------- INSTALL PACKAGES --------------------------" | ||
sudo apt install -y mongodb-org net-tools | ||
|
||
# Start and Enable Mongod | ||
echo "-------------------------- START & ENABLE MONGOD --------------------------" | ||
sudo systemctl enable --now mongod | ||
|
||
sleep 20 | ||
|
||
# Create user | ||
echo "-------------------------- CREATE VAGRANT USER --------------------------" | ||
mongosh << BLK | ||
use admin | ||
db.createUser( | ||
{ | ||
user: "iothub", | ||
pwd: "pass123", | ||
roles: [ | ||
{ role: "userAdminAnyDatabase", db: "iothub" }, | ||
{ role: "readWriteAnyDatabase", db: "iothub" }, | ||
{ role: "dbAdminAnyDatabase", db: "iothub" }, | ||
{ role: "clusterAdmin", db: "iothub" } | ||
] | ||
}) | ||
exit | ||
BLK | ||
|
||
|
||
## Enable Authorization | ||
|
||
sudo cat << EOB >> /etc/mongod.conf | ||
#security: | ||
security: | ||
authorization: "enabled" | ||
EOB | ||
|
||
echo "-------------------------- RESTARTED MONGOD --------------------------" | ||
sudo systemctl restart mongod |
Oops, something went wrong.