Giter Club home page Giter Club logo

ed-iot's Introduction

ED-iot

Energy Drive - IoT Device - Loadout

Suggested for Ubuntu Core: https://ubuntu.com/download/raspberry-pi/thank-you?version=20&architecture=core-20-arm64+raspi

This is a setup script to automate the setup and provisioning of Ubuntu servers. It does the following:

  • Adds a new user account with sudo access
  • Adds a public ssh key for the new user account
  • Disables password authentication to the server
  • Deny root login to the server
  • Setup Uncomplicated Firewall
  • Create Swap file based on machine's installed memory
  • Setup the timezone for the server (Default to "Africa/Johannesburg")
  • Install Network
  • Download and install dependancies
  • Bind and add to Core IoT for Energy Drive
  • Creates Heartbeat System and sends device statistics to BigQuery / Fulcrum

Installation

SSH into your server and install git if it is not installed:

sudo apt-get update
sudo apt-get install git

Clone this repository into your home directory:

cd ~
git clone https://github.com/Opennetworks-com/ed-iot.git

Run the setup script

cd ed-iot-device-setup
bash setup.sh

Setup prompts

When the setup script is run, you will be prompted to enter the username and password of the new user account.

Following that, you will then be prompted to add a public ssh key (which should be from your local machine) for the new account. To generate an ssh key from your local machine:

ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub

Finally, you will be prompted to specify a timezone for the server. It will be set to 'Africa/Johannesburg' if you do not specify a value.

ed-iot's People

Contributors

chesterlprocter avatar cpro88 avatar

Forkers

tim0n3

ed-iot's Issues

function createSwap() {...}

Create the swap file based on amount of physical memory on machine (Maximum size of swap is 4GB)

function createSwap() {
local swapmem=$(($(getPhysicalMemory) * 2))

Anything over 100MB in swap is probably unnecessary as a RAM fallback for Pi's

if [ ${swapmem} -gt 4 ]; then
swapmem=100
fi

sudo fallocate -l "${swapmem}M" /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
}

Function should set swap to 100M not in GB as we shouldn't be swapping to the TF card anyway.

_modem_service_install() {} needs to be adapted for ubuntu

This is my function from my autopai git repo https://github.com/tim0n3/AutoPai and it needs to be adapted for ubuntu either by modifying the case statement or by checking the OS in the /etc/os-releases file and the correct config should apply as this doesn't use the correct service files anymore due to the rewrite of the program from v1.9 to v1.10-rc1

_modem_service_install() {
read -n1 -p "Install modem & watchdog service? (y/n):" serviceinstall
case ${serviceinstall:0:1} in
y|Y )
echo "--------------------------------------"
echo "-- SystemV service install --"
echo "--------------------------------------"
cp /home/pi/app/energydrive.service /etc/systemd/system/energydrive.service ;
cp /home/pi/app/watchdog.service /etc/systemd/system/watchdog.service ;
systemctl enable energydrive.service ;
systemctl stop energydrive.service ;
systemctl enable watchdog.service ;
systemctl stop watchdog.service ;
##ubuntu
#cp /home/ubuntu/app/energydrive.service /etc/systemd/system/energydrive.service ;
#cp /home/ubuntu/app/watchdog.service /etc/systemd/system/watchdog.service ;
#systemctl enable energydrive.service ;
#systemctl stop energydrive.service ;
#systemctl enable watchdog.service ;
#systemctl stop watchdog.service ;

;;
n|N )
	echo "You've opted to install the services later"
;;
esac

}

function _is_mik() {} only works with raspiOS

This function in the setup-script only works on raspiOS or linux distro's still using ifconfig's config file method to configure interfaces.

ubuntu uses netplan so this will have to be converted to yaml and moved into the cloud-init yaml files and invoke on initialization.

_create_crontabs() {} where's the internet script that has the functions to check internet?

check-internet.sh doesn't exist in this repo.

_create_crontabs() {
echo "--------------------------------------"
echo "-- Creating crontabs: --"
echo "--------------------------------------"
cat <<EOF | crontab -
@daily /sbin/shutdown -r +5
@hourly /bin/bash /home/pi/AutoPai/check-internet.sh
EOF
echo "--------------------------------------"
echo "-- Crontabs created --"
echo "--------------------------------------"
}

ubuntu core is entirely snap based

Can't do much in the way of configuring ubuntu core as it's entirely based on snaps (snapd) . everything including the base system runs within a snap container. This means the distro would be better suited for containerization instead of PaaS/SaaS activities like we require.

Please, update the readme accordingly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.