Skip to content

Commit

Permalink
Merge branch 'release/v1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
matteocarnelos committed Jul 29, 2022
2 parents 8c98b38 + d8f4bd5 commit 3069aad
Show file tree
Hide file tree
Showing 5,606 changed files with 2,368 additions and 139 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
38 changes: 33 additions & 5 deletions Automation_Custom_Script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,52 @@ G_EXEC rm /etc/systemd/system/dietpi-cloudshell.service

# Install required packages
G_AGI telegraf
G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL="\e[90m" G_EXEC pip3 install gpiozero paho-mqtt smbus2 timeloop
G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL="\e[90m" G_EXEC pip3 install gpiozero paho-mqtt smbus2 timeloop numpy filterpy

# Enable services
G_EXEC systemctl enable sailtrack-x708_asd
G_EXEC systemctl enable sailtrack-x708_pwr
G_CONFIG_INJECT "+ telegraf" "+ telegraf" /boot/dietpi/.dietpi-services_include_exclude
G_CONFIG_INJECT "+ sailtrack-status" "+ sailtrack-status" /boot/dietpi/.dietpi-services_include_exclude
G_CONFIG_INJECT "+ sailtrack-timesync" "+ sailtrack-timesync" /boot/dietpi/.dietpi-services_include_exclude
G_CONFIG_INJECT "+ sailtrack-tileserver" "+ sailtrack-tileserver" /boot/dietpi/.dietpi-services_include_exclude
G_CONFIG_INJECT "+ sailtrack-filter" "+ sailtrack-filter" /boot/dietpi/.dietpi-services_include_exclude
G_EXEC /boot/dietpi/dietpi-services dietpi_controlled telegraf
G_EXEC /boot/dietpi/dietpi-services dietpi_controlled sailtrack-status
G_EXEC /boot/dietpi/dietpi-services dietpi_controlled sailtrack-timesync
G_EXEC /boot/dietpi/dietpi-services dietpi_controlled sailtrack-tileserver
G_EXEC /boot/dietpi/dietpi-services dietpi_controlled sailtrack-filter
G_EXEC /boot/dietpi/dietpi-services restart grafana-server
G_EXEC sleep 5

# Configure DietPi Banner
G_EXEC touch /boot/dietpi/.dietpi-banner
settings=(1 1 1 0 0 1 0 1 0 0 0 0 0 0 0 0)
for i in "${!settings[@]}"; do
G_CONFIG_INJECT "aENABLED\[$i]=" "aENABLED[$i]=${settings[$i]}" /boot/dietpi/.dietpi-banner
SETTINGS=(1 1 1 0 0 1 0 1 0 0 0 0 0 0 0 0)
for i in "${!SETTINGS[@]}"; do
G_CONFIG_INJECT "aENABLED\[$i]=" "aENABLED[$i]=${SETTINGS[$i]}" /boot/dietpi/.dietpi-banner
done

# TODO: Investigate failure here

# Configure passwords and keys
GLOBAL_PASSWORD=$(openssl enc -d -a -md sha256 -aes-256-cbc -iter 10000 -salt -pass pass:'DietPiRocks!' -in /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin)
GRAFANA_API_KEY=$(\
curl -s -X POST -H "Content-Type: application/json" -d '{"name":"sailtrack", "role": "Admin"}' "http://admin:$GLOBAL_PASSWORD@localhost:3001/api/auth/keys" | \
python3 -c "import sys, json; print(json.load(sys.stdin)['key'])" \
)
GCI_PASSWORD=1 G_CONFIG_INJECT "SAILTRACK_GLOBAL_PASSWORD=" "SAILTRACK_GLOBAL_PASSWORD=$GLOBAL_PASSWORD" /etc/default/sailtrack
GCI_PASSWORD=1 G_CONFIG_INJECT "SAILTRACK_GLOBAL_PASSWORD=" "SAILTRACK_GLOBAL_PASSWORD=$GLOBAL_PASSWORD" /etc/default/telegraf
GCI_PASSWORD=1 G_CONFIG_INJECT "SAILTRACK_GRAFANA_API_KEY=" "SAILTRACK_GRAFANA_API_KEY=$GRAFANA_API_KEY" /etc/default/telegraf

# Configure Telegraf
telegraf --section-filter=agent config > /etc/telegraf/telegraf.conf
G_CONFIG_INJECT "omit_hostname =" " omit_hostname = true" /etc/telegraf/telegraf.conf

# Configure Grafana
G_EXEC curl -X PUT -H "Content-Type: application/json" -d '{"name":"SailTrack"}' "http://admin:$GLOBAL_PASSWORD@localhost:3001/api/org"
G_EXEC grafana-cli --pluginUrl=https://github.com/alexandrainst/alexandra-trackmap-panel/archive/master.zip plugins install alexandra-trackmap-panel
G_CONFIG_INJECT ";allow_loading_unsigned_plugins =" "allow_loading_unsigned_plugins = alexandra-trackmap-panel" /etc/grafana/grafana.ini
G_CONFIG_INJECT ";disable_sanitize_html =" "disable_sanitize_html = true" /etc/grafana/grafana.ini
G_CONFIG_INJECT ";default_home_dashboard_path =" "default_home_dashboard_path = /boot/sailtrack/dashboards/sailtrack-home.json" /etc/grafana/grafana.ini

# Reboot after first boot is completed
(while [ -f "/root/AUTO_CustomScript.sh" ]; do sleep 1; done; /usr/sbin/reboot) > /dev/null 2>&1 &
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Follow the instructions below to get the SailTrack Core OS correctly installed.
ssh root@<raspberry-ip-address>
```

The `<raspberry-ip-address>` can be found by checking the router administration dashboard or by using a tool such as [Angry IP Scanner](https://angryip.org). The password is the default one (`dietpi`) or the one set in Step 4.
The `<raspberry-ip-address>` can be found by checking the router administration dashboard or by using a tool such as [Angry IP Scanner](https://angryip.org). The password is the default one (`sailtrack`) or the one set in Step 4.

2. Dismiss the `DietPi first run setup is currently running on another screen` message by hitting <kbd>Ctrl</kbd> + <kbd>C</kbd>.

Expand All @@ -65,7 +65,7 @@ Once the installation process has been successfully completed, you can use SailT

1. Power on the module by pressing the power push button. Once the WiFi network has been created, SailTrack Core will start collecting the measurements coming from the external modules.
2. Connect to the `SailTrack-CoreNet` WiFi network with your pc, smartphone, tablet,....
3. Visit http://192.168.42.1:3001 (user: `admin`, password: `dietpi` or the one set in Step 4 of the installation) to connect to the Grafana dashboards to see real-time data and browse the database. To learn more about using Grafana, visit the [official guide](https://grafana.com/docs/grafana/latest/getting-started/getting-started/).
3. Visit http://192.168.42.1:3001 (user: `admin`, password: `sailtrack` or the one set in Step 4 of the installation) to connect to the Grafana dashboards to see real-time data and browse the database. To learn more about using Grafana, visit the [official guide](https://grafana.com/docs/grafana/latest/getting-started/getting-started/).

## Contributing

Expand Down
83 changes: 46 additions & 37 deletions dietpi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,26 @@
#------------------------------------------------------------------------------------------------------
##### DietPi-Automation settings, applied on first boot of DietPi only, ONCE! #####
#------------------------------------------------------------------------------------------------------
# By setting this to "1" you accept the DietPi GPLv2 license and skip the related interactive dialog.
# - Full license text: /boot/dietpi-LICENSE.txt
# - This setting is ignored (and assumed to be affirmative) if AUTO_SETUP_AUTOMATED=1
AUTO_SETUP_ACCEPT_LICENSE=1

##### Language/Regional Options #####
# Locale: eg: "en_GB.UTF-8" / "de_DE.UTF-8" | One entry and UTF-8 ONLY!
##### Language/Regional options #####
# Locale: e.g.: "en_GB.UTF-8" / "de_DE.UTF-8" | One entry and UTF-8 ONLY!
AUTO_SETUP_LOCALE=C.UTF-8

# Keyboard Layout eg: "gb" / "us" / "de" / "fr"
# Keyboard layout e.g.: "gb" / "us" / "de" / "fr"
AUTO_SETUP_KEYBOARD_LAYOUT=it

# Timezone eg: "Europe/London" / "America/New_York" | Full list (TZ*): https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# Time zone e.g.: "Europe/London" / "America/New_York" | Full list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
AUTO_SETUP_TIMEZONE=Europe/Rome

##### Network Options #####
##### Network options #####
# Enable Ethernet or WiFi adapter: 1=enable | 0=disable
# - If both Ethernet and WiFi are enabled, WiFi will take priority and Ethernet will be disabled.
# - If using WiFi, please edit dietpi-wifi.txt to pre-enter credentials.
AUTO_SETUP_NET_ETHERNET_ENABLED=1
AUTO_SETUP_NET_WIFI_ENABLED=0

# Force Ethernet speeds: 0=automatic speed | 10 = 10Mbit | 100 = 100Mbit etc
# - This is mainly aimed at PINE A64 which may have an HW issue that causes unstable 1Gbit link.
# Force Ethernet speeds: 0=automatic speed | 10 = 10 Mbit/s | 100 = 100 Mbit/s etc.
# - Use this when your Ethernet adapter has an unstable 1 Gbit/s link.
AUTO_SETUP_NET_ETH_FORCE_SPEED=0

# WiFi country code: 2 uppercase character value (e.g. GB US DE JP): https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
Expand All @@ -50,7 +46,7 @@ AUTO_SETUP_NET_HOSTNAME=sailtrack-core
# Delay service starts at boot until network is established: 0=disabled | 1=enabled
AUTO_SETUP_BOOT_WAIT_FOR_NETWORK=1

##### Misc Options #####
##### Misc options #####
# Swap space size to generate: 0 => disable | 1 => auto | 2 and up => size in MiB
AUTO_SETUP_SWAPFILE_SIZE=1
# Swap space location: "zram" => swap space on /dev/zram0 (auto-size = 50% of RAM size) | /path/to/file => swap file at location (auto-size = 2 GiB minus RAM size)
Expand Down Expand Up @@ -78,40 +74,42 @@ AUTO_SETUP_CUSTOM_SCRIPT_EXEC=0
# - Simply attach the drive/disk/stick with contains the backup. All attached drives will be mounted temporarily and searched automatically.
AUTO_SETUP_BACKUP_RESTORE=0

##### Software Options #####
##### Software options #####
# SSH server choice: 0=none/custom | -1=Dropbear | -2=OpenSSH
AUTO_SETUP_SSH_SERVER_INDEX=-1

# Logging mode choice: 0=none/custom | -1=RAMlog 1h clear | -2=RAMlog 1h save clear | -3=rsyslog + logrotate
# SSH server pubkey
# - Public key(s) for "root" and "dietpi" users, which will be added to ~/.ssh/authorized_keys
# - Use the same setting multiple times for adding multiple keys.
# - See SOFTWARE_DISABLE_SSH_PASSWORD_LOGINS below for disabling SSH password logins.
#AUTO_SETUP_SSH_PUBKEY=ssh-ed25519 AAAAAAAA111111111111BBBBBBBBBBBB222222222222cccccccccccc333333333333 mySSHkey

# Logging mode choice: 0=none/custom | -1=RAMlog hourly clear | -2=RAMlog hourly save to disk + clear | -3=Rsyslog + Logrotate
AUTO_SETUP_LOGGING_INDEX=-1
# RAMlog max tmpfs size (MB). 50MB should be fine for single use. 200MB+ for heavy webserver and access log etc.
# RAMlog max tmpfs size (MiB). 50 MiB should be fine for single use. 200+ MiB for heavy webserver access log etc.
AUTO_SETUP_RAMLOG_MAXSIZE=50

# Webserver preference: 0=Apache | -1=Nginx | -2=Lighttpd
# - This defines the webserver to install (only) when another selected software requires one.
# - It won't be installed if no other software requires a webserver and a manual webserver stack selection will override it.
AUTO_SETUP_WEB_SERVER_INDEX=-2

# Desktop preference: 0=LXDE | -1=Xfce | -2=MATE | -3=LXQt | -4=GNUstep
# - This defines the desktop to install (only) when another selected software requires one.
# - It won't be installed if no other software requires a desktop and a manual desktop selection will override it.
# Dependency preferences
# - DietPi-Software installs all dependencies for selected software options automatically, which can include a webserver for web applications, a desktop for GUI applications and one usually wants a web browser on desktops.
# - Especially for non-interactive first run installs (see AUTO_SETUP_AUTOMATED below), you may want to define which webserver, desktop and/or browser you want to have installed in such case. For interactive installs you will be always asked to pick one.
# - With below settings you can define your preference for non-interactive installs. However, it will only installed if any other selected software requires it, and an explicit webserver/desktop/browser selection overrides those settings:
# - Webserver preference: 0=Apache | -1=Nginx | -2=Lighttpd
AUTO_SETUP_WEB_SERVER_INDEX=0
# - Desktop preference: 0=LXDE | -1=Xfce | -2=MATE | -3=LXQt | -4=GNUstep
AUTO_SETUP_DESKTOP_INDEX=0

# Browser preference: 0=None | -1=Firefox | -2=Chromium
# - This defines the browser to install (only) when a desktop is installed.
# - It won't be installed if no desktop is installed and a manual browser selection will override it.
# - Browser preference: 0=None | -1=Firefox | -2=Chromium
AUTO_SETUP_BROWSER_INDEX=-1

# DietPi-Autostart: 0=Console | 7=Console autologin | 1=Kodi | 2=Desktop autologin | 16=Desktop | 4=OpenTyrian | 5=DietPi-CloudShell | 6=Amiberry fast boot | 8=Amiberry standard boot | 9=DDX-Rebirth | 10=CAVA Spectrum | 11=Chromium kiosk | 14=Custom script (background) | 17=Custom script (foreground)
# - This will be effective on 2nd boot, after firstrun update and installs have been done.
# - Related software titles must be installed either on firstrun installs or via AUTO_SETUP_AUTOMATED=1 + AUTO_SETUP_INSTALL_SOFTWARE_ID (see below).
# - This will be effective on 2nd boot, after first run update and installs have been done.
# - Related software titles must be installed either on first run installs or via AUTO_SETUP_AUTOMATED=1 + AUTO_SETUP_INSTALL_SOFTWARE_ID (see below).
AUTO_SETUP_AUTOSTART_TARGET_INDEX=0
# Autologin user name
# - This user must exist before firstrun installs, otherwise it will be reverted to root.
# - This user must exist before first run installs, otherwise it will be reverted to root.
# - Applies to all autostart options but: 0, 6, 14 and 16
AUTO_SETUP_AUTOSTART_LOGIN_USER=root

##### Non-interactive Firstrun Setup #####
##### Non-interactive first run setup #####
# On first login, run update, initial setup and software installs without any user input
# - Setting this to "1" is required for AUTO_SETUP_GLOBAL_PASSWORD and AUTO_SETUP_INSTALL_SOFTWARE_ID.
# - Setting this to "1" indicates that you accept the DietPi GPLv2 license, available at /boot/dietpi-LICENSE.txt, superseding AUTO_SETUP_ACCEPT_LICENSE.
Expand All @@ -120,9 +118,9 @@ AUTO_SETUP_AUTOMATED=1
# Global Password to be applied for the system
# - Requires AUTO_SETUP_AUTOMATED=1
# - Affects "root" and "dietpi" users login passwords and is used by dietpi-software as default for software installs which require a password.
# - On first dietpi-software execution, the password is removed from this file and instead encrypted and saved to rootfs.
# - On first dietpi-software execution, the password is removed from this file and instead encrypted and saved to root filesystem.
# - WARN: We cannot guarantee that all software options can handle special characters like \"$.
AUTO_SETUP_GLOBAL_PASSWORD=dietpi
AUTO_SETUP_GLOBAL_PASSWORD=sailtrack

# Software to automatically install
# - Requires AUTO_SETUP_AUTOMATED=1
Expand Down Expand Up @@ -150,16 +148,16 @@ SURVEY_OPTED_IN=0
#------------------------------------------------------------------------------------------------------
# CPU Governor: schedutil | ondemand | interactive | conservative | powersave | performance
CONFIG_CPU_GOVERNOR=schedutil
# Ondemand Sampling Rate | Min value: 10000 microseconds (10ms)
# Ondemand Sampling Rate | Min value: 10000 microseconds (10 ms)
CONFIG_CPU_ONDEMAND_SAMPLE_RATE=25000
# Ondemand Sampling Down Factor: Sampling Rate * Down Factor / 1000 = ms (40 = 1000ms when sampling rate is 25000)
# Ondemand Sampling Down Factor: Sampling Rate * Down Factor / 1000 = ms (40 = 1000 ms when sampling rate is 25000)
CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=40
# Throttle Up Percentage: Percentage of average CPU usage during sampling rate at which CPU will be throttled up/down
CONFIG_CPU_USAGE_THROTTLE_UP=50

# CPU Frequency Limits: Disabled=disabled
# - Intel CPUs use a percentage value (%) from 0-100, eg: 55
# - All other devices must use a specific MHz value, eg: 1600
# - Intel CPUs use a percentage value (%) from 0-100, e.g.: 55
# - All other devices must use a specific MHz value, e.g.: 1600
# - Has no effect on RPi, please set "arm_freq" and "arm_freq_min" in config.txt instead.
CONFIG_CPU_MAX_FREQ=Disabled
CONFIG_CPU_MIN_FREQ=Disabled
Expand Down Expand Up @@ -225,6 +223,13 @@ CONFIG_NTP_MIRROR=debian.pool.ntp.org
#------------------------------------------------------------------------------------------------------
##### DietPi-Software settings #####
#------------------------------------------------------------------------------------------------------
# SSH Server
# - Disable SSH password logins, e.g. when using pubkey authentication
# 0=Allow password logins for all users, including root
# root=Disable password login for root user only
# 1=Disable password logins for all users, assure that you have a valid SSH key applied!
SOFTWARE_DISABLE_SSH_PASSWORD_LOGINS=0

# VNC Server
SOFTWARE_VNCSERVER_WIDTH=1280
SOFTWARE_VNCSERVER_HEIGHT=720
Expand Down Expand Up @@ -281,6 +286,10 @@ SOFTWARE_DIETPI_DASHBOARD_VERSION=Stable
# Whether to only install backend or not
SOFTWARE_DIETPI_DASHBOARD_BACKEND=0

# PiVPN
# - For an unattended install, place a config file named "unattended_pivpn.conf" into the boot partition/directory.
# - For example configs, have a look at: https://github.com/pivpn/pivpn/tree/master/examples

#------------------------------------------------------------------------------------------------------
##### Dev settings #####
#------------------------------------------------------------------------------------------------------
Expand Down
Binary file modified hardware/STL/Case Bottom.stl
Binary file not shown.
Binary file modified hardware/STL/Case Top.stl
Binary file not shown.
2 changes: 2 additions & 0 deletions rootfs/etc/default/sailtrack
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SAILTRACK_GLOBAL_PASSWORD=sailtrack
SAILTRACK_GRAFANA_API_KEY=
6 changes: 0 additions & 6 deletions rootfs/etc/default/telegraf

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: 1

providers:
- name: "SailTrack"
options:
path: /boot/sailtrack/dashboards
foldersFromFilesStructure: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: 1

datasources:
- name: "SailTrack Data"
type: influxdb
access: proxy
url: http://localhost:8086
database: sailtrack-data
7 changes: 0 additions & 7 deletions rootfs/etc/sailtrack/sailtrack.conf

This file was deleted.

10 changes: 10 additions & 0 deletions rootfs/etc/systemd/system/sailtrack-filter.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=SailTrack-Filter

[Service]
EnvironmentFile=-/etc/default/sailtrack
Restart=on-failure
ExecStart=/boot/sailtrack/sailtrack-filter

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions rootfs/etc/systemd/system/sailtrack-status.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Description=SailTrack-Status

[Service]
EnvironmentFile=-/etc/default/sailtrack
Restart=on-failure
ExecStart=/boot/sailtrack/sailtrack-status

Expand Down
10 changes: 10 additions & 0 deletions rootfs/etc/systemd/system/sailtrack-tileserver.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=SailTrack-TileServer

[Service]
Restart=on-failure
WorkingDirectory=/boot/sailtrack/maps
ExecStart=/usr/bin/python3 -m http.server

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions rootfs/etc/systemd/system/sailtrack-timesync.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Description=SailTrack-TimeSync

[Service]
EnvironmentFile=-/etc/default/sailtrack
Restart=on-failure
ExecStart=/boot/sailtrack/sailtrack-timesync

Expand Down
11 changes: 0 additions & 11 deletions rootfs/etc/systemd/system/sailtrack-x708_asd.service

This file was deleted.

2 changes: 1 addition & 1 deletion rootfs/etc/systemd/system/sailtrack-x708_pwr.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Before=dietpi-preboot.service

[Service]
Restart=on-failure
ExecStart=/boot/sailtrack-x708_pwr
ExecStart=/boot/sailtrack/sailtrack-x708_pwr

[Install]
WantedBy=multi-user.target
37 changes: 0 additions & 37 deletions rootfs/etc/telegraf/telegraf.conf

This file was deleted.

Loading

0 comments on commit 3069aad

Please sign in to comment.