The scripted install is recommended, but on the chance you need to perform some of the install manually, the following are effectively the steps involved and are in fact what are accomplished via the script.
Hardware | Operating System | Display | Node.js | Database | App Installation | Autostart
- Raspberry Pi Model 3 B or B+
- 7" Raspberry Pi LCD
- SD card (32 GB or more recommended)
- USB keyboard and mouse (at least for initial setup)
- (Optional) Pimoroni Speaker pHAT
The app has been tested on Raspbian Stretch version 4.14. Use either image "with desktop".
- Initial startup - follow prompts
- update country, language, and timezone
- set up a password (take note of this password)
- join wifi
- (Optional) Install updates when prompted
- restart
Auto-hide the taskbar (reference)
This is necessary for the timeclock app to be able to use the full screen. This currently has to be done manually.
- Right-click on the taskbar and select "Panel Settings"
- Click on the "Advanced" tab
- Check "Minimize panel when not in use"
- Set "Size when minimized" to 0
This is only necessary if the case mounts with the microUSB ports on top.
printf "\nlcd_rotate=2" | sudo tee -a /boot/config.txtsudo chmod o+w /sys/class/backlight/rpi_backlight/brightnessA cursor looks out of place on a touchscreen, but you might want to wait to do this until you're done with the rest of the setup.
sudo sed -i 's/#xserver-command=X/xserver-command=X -core -nocursor -s 0 -dpms/g' /etc/lightdm/lightdm.confAs the runtime engine for the app, Node.js needs to be installed.
sudo apt-get update
curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
sudo apt-get install -y nodejsConfirm node and npm are working by checking their versions
node -v
npm -vThe app uses MySQL for the database, so we need to install MySQL, create the database user and tables, and manually add at least one mentor team member to allow administration.
sudo apt-get install -y mysql-serverTo make your life a little easier, recommend you configure case insensitivity.
printf "[mysqld]\nlower_case_table_names=1" | sudo tee -a /etc/mysql/my.cnf
sudo /etc/init.d/mysql restartBelow is practically a script, but you'll need to replace <user> and <password> with those you choose to use, so don't just copy/paste.
sudo mysql -p -u rootCREATE USER '<user>'@'localhost' IDENTIFIED BY '<password>';
CREATE DATABASE timeclock;
GRANT ALL PRIVILEGES ON timeclock.* TO '<user>'@'localhost' IDENTIFIED BY '<password>';
FLUSH PRIVILEGES;
USE timeclock;
CREATE TABLE teammembers (
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
lastname VARCHAR(25) NOT NULL,
firstname VARCHAR(25) NOT NULL,
email VARCHAR(255) DEFAULT '',
role VARCHAR(10) DEFAULT 'Student',
passcode VARCHAR(256) DEFAULT '',
active BOOLEAN DEFAULT TRUE,
deleted BOOLEAN DEFAULT FALSE,
created DATETIME DEFAULT CURRENT_TIMESTAMP,
updated DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);
create table punches (
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
memberid SMALLINT UNSIGNED NOT NULL,
punchtype TINYINT(1) NOT NULL,
created DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);INSERT INTO teammembers (firstname, lastname, role, passcode)
VALUES ('Default', 'Mentor', 'Mentor', SHA2('15555','256'));Once additional mentors have been added, deactivate the default mentor entry.
Initially, the MySQL installation is somewhat unsecure. Take the following steps to secure the installation.
sudo mysql_secure_installationAnswer 'y' to all prompts:
- Set root password to something of your choosing
- Remove anonymous users
- Disable root login remotely
- Remove test database and access to it
- Reload privilege tables
The following instructions walk you through installation using the latest release from the repo. Alternatively, you can build the app on the RPi - see Build and Deployment Workflow.
- Download the latest .AppImage file from releases
- Copy the .AppImage file to the pi user's root folder (~/)
- Rename the .AppImage file to "iptimeclock"
- Make the "iptimeclock" file executable:
chmod +x ~/iptimeclock
-
Download all files from the 'config' folder in the repo
-
Make a new directory in the pi user's .config folder:
mkdir ~/.config/iptimeclock -
Copy all config files to ~/.config/iptimeclock
-
Create a file named 'key.txt' in this directory containing your decryption key (see below)
Database credentials, email server details, and scheduled task details are stored in this file. Most values are encrypted (see below).
This script helps encrypt values that will be placed in config.json. Read comments in the script file for usage instructions.
The file key.txt contains the private key needed to decrypt config.json entries. In order to maintain security of the information mentioned above, this file is purposefully not included in the repo. You'll need to get this key through some other means (talk to your mentors). If you fork and modify this project DO NOT STORE KEY.TXT IN YOUR REPO.
Start the app by opening a terminal window and typing:
./iptimeclockThe first time you start the app, the Raspberry Pi will display a prompt, the buttons for which will not likely be visible - just hit Enter.
We want the timeclock to start up at boot time.
mkdir ~/.config/autostart
printf "[Desktop Entry]\nType=Application\nName=iptimeclock autostart\nComment=Iron Plaid Timeclock\nNoDisplay=false\nExec=/home/pi/iptimeclock" > ~/.config/autostart/iptimeclock.desktopprintf "sudo chmod o+w /sys/class/backlight/rpi_backlight/brightness" >> ~/.bashrc
printf "alias dir='ls -alF'" >> .bash_aliases
sudo raspi-config nonint do_ssh 0
sudo raspi-config nonint do_vnc 0
sudo raspi-config nonint do_hostname iptimeclock