-
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.
Merge pull request #28 from DynamicGravitySystems/develop
Merge ansible updates from develop into master
- Loading branch information
Showing
24 changed files
with
102 additions
and
824 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,3 @@ | ||
include README.md | ||
include tools/send.py | ||
include atgmlogger/install/* | ||
include atgmlogger/atgmlogger.json |
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,5 +1,5 @@ | ||
Dynamic Gravity Systems - Serial Data Recorder | ||
============================================== | ||
Dynamic Gravity Systems - Serial Data Recorder v0.6.0 | ||
===================================================== | ||
|
||
1. Dependencies: | ||
- Python v3.5 or 3.6 or later, and the following modules: | ||
|
@@ -9,96 +9,29 @@ Dynamic Gravity Systems - Serial Data Recorder | |
- ntfs-3g | ||
- exfat-fuse | ||
- exfat-utils | ||
2. Preparing the Raspberry Pi: | ||
1. Installing Python3.6 from source: | ||
- Download Python3.6 source tarball from https://www.python.org | ||
- Install the required development libraries to build the source: | ||
- make | ||
- build-essential | ||
- libssl-dev | ||
- zliblg-dev | ||
- libbz2-dev | ||
- libreadline-dev | ||
- libsqlite3-dev | ||
- wget | ||
- curl | ||
- llvm | ||
- libncurses5-dev | ||
- libncursesw5-dev | ||
- xz-utils | ||
- tk-dev | ||
```commandline | ||
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev | ||
sudo apt-get install -y libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm | ||
sudo apt-get install -y libncurses5-dev libncursesw5-dev xz-utils tk-dev | ||
``` | ||
- Extract, Configure and Build: | ||
```commandline | ||
tar -xzf python-3.6.2.tgz | ||
cd python-3.6.2 | ||
./configure | ||
make | ||
sudo make altinstall | ||
``` | ||
|
||
2. Install Python3.6 from Debian SID (experimental) repository: | ||
- add the following line to /etc/apt/sources.list: | ||
```commandline | ||
deb http://http.us.debian.org/debian sid main | ||
``` | ||
|
||
- configure apt-pinning to prevent the system from using experimental repo for system-wide updates | ||
```commandline | ||
vim /etc/apt/preferences.d/pinning | ||
Package: * | ||
Pin: release a=stable | ||
Pin-Priority: 700 | ||
``` | ||
4. **Configure Raspberry Pi GPIO Console:** | ||
- By default the Raspberry Pi GPIO console is enabled as a TTY terminal, this needs to be disabled to allow it | ||
to be used as a Serial Data input. | ||
- Modify /boot/cmdline.txt removing the section similar to: 'console=serial0,115200' | ||
```commandline(bash) | ||
# All Commands executed as Root (sudo) | ||
sed -i -e s/console=serial0,115200//g /boot/cmdline.txt | ||
echo 'enable_uart=1' >> /boot/config.txt | ||
systemctl stop [email protected] | ||
systemctl disable [email protected] | ||
``` | ||
|
||
3. Installation: | ||
- The atgmlogger utility is now packaged as a Python Wheel and can be installed via pip: | ||
```commandline | ||
sudo pip3 install atgmlogger-0.3.1-py3-none-any.whl | ||
``` | ||
This method will create a commandline script in /usr/bin/atgmlogger, which can be invoked to run the logger. | ||
Manual Installation: | ||
-------------------- | ||
Installation Directories (copy the following files to the specified destinations): | ||
- 90-removable-usb.rules -> /etc/udev/rules.d/90-removable-usb.rules | ||
- media-removable.mount -> /etc/systemd/system/media-removable.mount | ||
- SerialLogger.service -> /etc/systemd/system/SerialLogger.service | ||
2. Installation: | ||
|
||
- The installation of atgmlogger on a Raspberry Pi requires several supporting configuration changes and updates; | ||
to automate the process an ansible playbook is provided: [ATGMLogger Ansible Playbook](https://github.com/DynamicGravitySystems/atgmlogger-ansible) | ||
|
||
- In general the following steps are taken to prepare the system: | ||
1. Configure values in /boot/cmdline.txt and /boot/config.txt to enable UART and disable the TTY on the serial GPIO | ||
2. Install dependencies that enable the use of NTFS/FAT/EXFAT formatted external devices (for data retrieval) | ||
3. Add a UDEV rule and systemd mount unit to auto-mount any removable block device (e.g. USB drive) in order to allow copying of logged data for retrieval | ||
4. Add a logrotate configuration to automatically rotate data and application logs | ||
5. Install python3 and the ATGMLogger python application | ||
6. Install a systemd service unit file to control the automatic startup of the ATGMLogger application | ||
7. Secure the raspberry Pi by changing the default 'pi' user password, and adding an authorized key for factory maintenance usage | ||
|
||
|
||
After installing .mount and .service files run the following commands: | ||
```commandline | ||
sudo systemctl daemon-reload | ||
sudo systemctl enable media-removable.mount | ||
sudo systemctl enable SerialLogger.service | ||
``` | ||
3. Execution: | ||
|
||
Explanation: | ||
- 90-removable-usb.rules creates a UDEV rule that adds a symbolic link to /dev/usbstick when a usb block device (hdd) | ||
is inserted. This symlink is used by the following mount file to mount the filesystem. | ||
- media-removable.mount is a systemd mount unit which instructs systemd to mount /dev/usbstick to /media/removable when | ||
it detects the device 'dev-usbstick.device'. The unit will also dismount the device when it becomes unavailable. | ||
- SerialLogger.service is a systemd service unit which executes the Serial Logging python script. When this unit is | ||
enabled (see above command - systemctl enable SerialLogger.service) the program will be executed upon system startup. | ||
- Once installed with the ansible deploy playbook, ATGMLogger will automatically start every time the system is booted | ||
via a systemd service unit. | ||
|
||
- ATGMLogger can otherwise be manually executed (e.g. for debugging purposes) with the following command | ||
|
||
```commandline | ||
/usr/bin/python3 -m atgmlogger -vvv | ||
``` |
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
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
File renamed without changes.
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.