From b632fa50514338548a873382263ff818f0ac3cc5 Mon Sep 17 00:00:00 2001 From: Max Fowler Date: Fri, 20 Nov 2020 13:23:19 +0100 Subject: [PATCH 1/7] Add flags to quick_deployment.md --- .gitignore | 1 + src/quick_deployment.md | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 599bf1a..ce5651b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ book src/tmp notes +deploy.sh \ No newline at end of file diff --git a/src/quick_deployment.md b/src/quick_deployment.md index f6bfd71..858df20 100644 --- a/src/quick_deployment.md +++ b/src/quick_deployment.md @@ -75,13 +75,16 @@ iface wlan0 inet dhcp ## Scripts The `setup_dev_env.py` script can be executed once your Pi is internet-connected and `git` and `python` have been installed. It takes a `` argument to create a new system user. You will be prompted to enter a password for your newly created user. The script will install system requirements and copy configuration files relating to networking, I2C and RTC. +The i2c and rtc flags are optional and can be removed for installation without the peripheral hardware. -_TODO: Add flags to (de)select I2C, RTC and Rust install & config. Flags should also be added which allow the installer to choose between development environment and release environment configuration._ +_TODO: Add flags to (de)select Rust install & config. Flags should also be added which allow the installer to choose between development environment and release environment configuration._ ```bash apt update apt install git python git clone https://github.com/peachcloud/peach-config.git cd peach-config -python scripts/setup_dev_env.py +python scripts/setup_dev_env.py --i2c --rtc ds3231 ``` + + -- 2.49.0 From 9249bdc1e57350a5f3fa9dc4f375c26b9df1b9f5 Mon Sep 17 00:00:00 2001 From: Max Fowler Date: Fri, 20 Nov 2020 13:26:43 +0100 Subject: [PATCH 2/7] Mirror other README --- src/quick_deployment.md | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/quick_deployment.md b/src/quick_deployment.md index 858df20..b64adb1 100644 --- a/src/quick_deployment.md +++ b/src/quick_deployment.md @@ -74,17 +74,36 @@ iface wlan0 inet dhcp ## Scripts -The `setup_dev_env.py` script can be executed once your Pi is internet-connected and `git` and `python` have been installed. It takes a `` argument to create a new system user. You will be prompted to enter a password for your newly created user. The script will install system requirements and copy configuration files relating to networking, I2C and RTC. -The i2c and rtc flags are optional and can be removed for installation without the peripheral hardware. - -_TODO: Add flags to (de)select Rust install & config. Flags should also be added which allow the installer to choose between development environment and release environment configuration._ +The `setup_dev_env.py` script can be executed once your Pi is internet-connected and `git` and `python` have been installed. ```bash apt update apt install git python git clone https://github.com/peachcloud/peach-config.git cd peach-config -python scripts/setup_dev_env.py --i2c --rtc ds3231 +# run the script with --i2c and --rtc flags to configure +python scripts/setup_dev_env.py -i -r ds3231 ``` +Running the script with the `-h` flag shows the help menu: +```bash +usage: setup_dev_env.py [-h] [-i] [-r {ds1307,ds3231}] user + +positional arguments: + user username for the default user account + +optional arguments: + -h, --help show this help message and exit + -i, --i2c configure i2c + -r {ds1307,ds3231}, --rtc {ds1307,ds3231} + configure real-time clock +``` + +A `` argument must be supplied to create a new system user. You will be prompted to enter a password for your newly created user. + +The script also allows optional configuration of I2C and real-time clock (RTC) modules. I2C configuration is necessary for the OLED display and physical interface to work correctly. RTC configuration is required for the real-time clock to work correctly. When passing the `-r` flag, the type of real-time clock module must be included (either ds1307 or ds3231). Selecting real-time clock configuration will not work if the I2C flag is not selected (in other words, the real-time clock requires I2C). + +Run the script as follows for a full installation and configuration with I2C and the ds3231 RTC module (username in this case is `peach`): + +`python scripts/setup_dev_env.py -i -r ds3231 peach` -- 2.49.0 From 381fe98eed43110734c006cd1ca6078e44b73d58 Mon Sep 17 00:00:00 2001 From: notplants Date: Thu, 14 Jan 2021 21:29:00 +0100 Subject: [PATCH 3/7] Add documentation on setting up direct ethernet connection --- src/SUMMARY.md | 1 + src/software/direct-ethernet-setup.md | 57 +++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 src/software/direct-ethernet-setup.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index f6b9576..e31e855 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -25,6 +25,7 @@ - [Pattern Library](./software/pattern_library.md) - [Compilation](./software/compilation.md) - [Packaging](./software/packaging.md) + - [Direct Ethernet Setup](./software/direct-ethernet-setup.md) - [Configuration](./software/configuration.md) - [Contributor's Guide](./contributors_guide.md) - [Licensing](./licensing.md) diff --git a/src/software/direct-ethernet-setup.md b/src/software/direct-ethernet-setup.md new file mode 100644 index 0000000..8116825 --- /dev/null +++ b/src/software/direct-ethernet-setup.md @@ -0,0 +1,57 @@ +This file contains documentation for two different ways of working with peach cloud +using a direct ethernet connection (useful for developmetn purposes) + +Method 1: +If you are close to a router, you can plug your pi into the router via ethernet, +and you should be able to ssh into the pi from any laptop connected to the same router +via wifi or ethernet. + +Method 2: +Using a DHCP server on your laptop (instructions for a laptop running Debian). + +On your laptop, install isc-dhcp-server +`sudo apt-get install isc-dhcp-server` + +Add the following configs: + +In `/etc/dhcp/dhcpd.conf`, +add the following section: +``` +subnet 10.0.2.0 netmask 255.255.255.240 { + range 10.0.2.2 10.0.2.14; + option routers 10.0.2.1; + host peach { + hardware ethernet b8:27:eb:b1:b1:4e; + fixed-address 10.0.2.4; + } +} +``` + +In `/etc/default/isc-dhcp-server`, +add the following section with the name of your ethernet interface (in this case ens9), +``` +INTERFACESv4="ens9" +INTERFACESv6="" +``` + +In `/etc/network/interfaces`, +set a static IP for you ethernet interface, +by adding this section: + +``` +auto ens9 +iface ens9 inet static + address 10.0.2.1 +``` + +Then start the dhcp server: +```sudo systemctl start isc-dhcp-server``` + +Connect your pi to the laptop via an ethernet cable, and you should be able to ssh into the pi via +```ssh peach@10.0.2.4``` + +On the pi, internet traffic will still need to go through wlan0 interface. + + +On Mac OS, you don't need to change the network config on your laptop, +if you simply enable internet sharing over ethernet, you should be able to connect to the pi. \ No newline at end of file -- 2.49.0 From 15587e06aaedc004e4cfe6485a3815ecfb444635 Mon Sep 17 00:00:00 2001 From: notplants Date: Thu, 14 Jan 2021 21:36:33 +0100 Subject: [PATCH 4/7] Add note about fixed-address line --- src/software/direct-ethernet-setup.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/software/direct-ethernet-setup.md b/src/software/direct-ethernet-setup.md index 8116825..429e7f1 100644 --- a/src/software/direct-ethernet-setup.md +++ b/src/software/direct-ethernet-setup.md @@ -26,6 +26,11 @@ subnet 10.0.2.0 netmask 255.255.255.240 { } } ``` +Note that b8:27:eb:b1:b1:4e may need to be replaced with the address of your pi's ethernet interface, +which you can look up on the pi by running `ip a` on the pi. This address should be static. +This section of the config tells the dhcp server ot always give the specified client +the specified IP address 10.0.2.4 when that client asks for an IP address. + In `/etc/default/isc-dhcp-server`, add the following section with the name of your ethernet interface (in this case ens9), -- 2.49.0 From f741194888a684f5a2ce3644831aed008d7e232d Mon Sep 17 00:00:00 2001 From: mycognosist Date: Fri, 15 Jan 2021 09:06:03 +0000 Subject: [PATCH 5/7] Add formatting, fix typos and make minor grammar changes --- src/software/direct-ethernet-setup.md | 60 +++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/software/direct-ethernet-setup.md b/src/software/direct-ethernet-setup.md index 429e7f1..244c00a 100644 --- a/src/software/direct-ethernet-setup.md +++ b/src/software/direct-ethernet-setup.md @@ -1,22 +1,24 @@ -This file contains documentation for two different ways of working with peach cloud -using a direct ethernet connection (useful for developmetn purposes) +# Direct Ethernet Setup -Method 1: -If you are close to a router, you can plug your pi into the router via ethernet, -and you should be able to ssh into the pi from any laptop connected to the same router -via wifi or ethernet. +This file contains documentation for two different ways of working with PeachCloud using a direct ethernet connection (useful for development purposes). + +## Method 1 + +If you are close to a router, you can plug your Pi into the router via ethernet and you should be able to SSH into the Pi from any laptop connected to the same router via WiFi or ethernet. + +## Method 2 -Method 2: Using a DHCP server on your laptop (instructions for a laptop running Debian). -On your laptop, install isc-dhcp-server +**Install the DHCP server:** + `sudo apt-get install isc-dhcp-server` -Add the following configs: +**Configure the DHCP server:** -In `/etc/dhcp/dhcpd.conf`, -add the following section: -``` +In `/etc/dhcp/dhcpd.conf`, add the following section: + +```plaintext subnet 10.0.2.0 netmask 255.255.255.240 { range 10.0.2.2 10.0.2.14; option routers 10.0.2.1; @@ -26,37 +28,35 @@ subnet 10.0.2.0 netmask 255.255.255.240 { } } ``` -Note that b8:27:eb:b1:b1:4e may need to be replaced with the address of your pi's ethernet interface, -which you can look up on the pi by running `ip a` on the pi. This address should be static. -This section of the config tells the dhcp server ot always give the specified client -the specified IP address 10.0.2.4 when that client asks for an IP address. + +Note that `b8:27:eb:b1:b1:4e` may need to be replaced with the address of your Pi's ethernet interface, which you can look up by running `ip a` on the Pi. This address should be static. The `fixed-address` section of the config tells the DHCP server to always give the specified client (`peach`) the `10.0.2.4` IP address. -In `/etc/default/isc-dhcp-server`, -add the following section with the name of your ethernet interface (in this case ens9), -``` +In `/etc/default/isc-dhcp-server`, add the following section with the name of your ethernet interface (in this case `ens9`): + +```plaintext INTERFACESv4="ens9" INTERFACESv6="" ``` -In `/etc/network/interfaces`, -set a static IP for you ethernet interface, -by adding this section: +In `/etc/network/interfaces`, set a static IP for your ethernet interface by adding this section: -``` +```plaintext auto ens9 iface ens9 inet static address 10.0.2.1 ``` -Then start the dhcp server: -```sudo systemctl start isc-dhcp-server``` +**Start the DHCP server:** -Connect your pi to the laptop via an ethernet cable, and you should be able to ssh into the pi via -```ssh peach@10.0.2.4``` +`sudo systemctl start isc-dhcp-server` -On the pi, internet traffic will still need to go through wlan0 interface. +**Connect the ethernet cable:** +Connect your Pi to the laptop via an ethernet cable. You should then be able to SSH into the Pi using the following command: -On Mac OS, you don't need to change the network config on your laptop, -if you simply enable internet sharing over ethernet, you should be able to connect to the pi. \ No newline at end of file +`ssh peach@10.0.2.4` + +_Note:_ On the Pi, internet traffic will still need to go through `wlan0` interface. + +On Mac OS you don't need to change the network config on your laptop. Simply enable internet sharing over ethernet and you should be able to connect to the Pi. -- 2.49.0 From 6c0dadd510a4194a61e05cbf3fcbcd66e1d22487 Mon Sep 17 00:00:00 2001 From: notplants Date: Fri, 15 Jan 2021 11:04:34 +0100 Subject: [PATCH 6/7] Move direct ethernet setup to be a subsection of networking.md --- src/software/direct-ethernet-setup.md | 62 -------------------- src/software/operating_system/networking.md | 65 +++++++++++++++++++++ 2 files changed, 65 insertions(+), 62 deletions(-) delete mode 100644 src/software/direct-ethernet-setup.md diff --git a/src/software/direct-ethernet-setup.md b/src/software/direct-ethernet-setup.md deleted file mode 100644 index 244c00a..0000000 --- a/src/software/direct-ethernet-setup.md +++ /dev/null @@ -1,62 +0,0 @@ -# Direct Ethernet Setup - -This file contains documentation for two different ways of working with PeachCloud using a direct ethernet connection (useful for development purposes). - -## Method 1 - -If you are close to a router, you can plug your Pi into the router via ethernet and you should be able to SSH into the Pi from any laptop connected to the same router via WiFi or ethernet. - -## Method 2 - -Using a DHCP server on your laptop (instructions for a laptop running Debian). - -**Install the DHCP server:** - -`sudo apt-get install isc-dhcp-server` - -**Configure the DHCP server:** - -In `/etc/dhcp/dhcpd.conf`, add the following section: - -```plaintext -subnet 10.0.2.0 netmask 255.255.255.240 { - range 10.0.2.2 10.0.2.14; - option routers 10.0.2.1; - host peach { - hardware ethernet b8:27:eb:b1:b1:4e; - fixed-address 10.0.2.4; - } -} -``` - -Note that `b8:27:eb:b1:b1:4e` may need to be replaced with the address of your Pi's ethernet interface, which you can look up by running `ip a` on the Pi. This address should be static. The `fixed-address` section of the config tells the DHCP server to always give the specified client (`peach`) the `10.0.2.4` IP address. - - -In `/etc/default/isc-dhcp-server`, add the following section with the name of your ethernet interface (in this case `ens9`): - -```plaintext -INTERFACESv4="ens9" -INTERFACESv6="" -``` - -In `/etc/network/interfaces`, set a static IP for your ethernet interface by adding this section: - -```plaintext -auto ens9 -iface ens9 inet static - address 10.0.2.1 -``` - -**Start the DHCP server:** - -`sudo systemctl start isc-dhcp-server` - -**Connect the ethernet cable:** - -Connect your Pi to the laptop via an ethernet cable. You should then be able to SSH into the Pi using the following command: - -`ssh peach@10.0.2.4` - -_Note:_ On the Pi, internet traffic will still need to go through `wlan0` interface. - -On Mac OS you don't need to change the network config on your laptop. Simply enable internet sharing over ethernet and you should be able to connect to the Pi. diff --git a/src/software/operating_system/networking.md b/src/software/operating_system/networking.md index cd0d376..14426d4 100644 --- a/src/software/operating_system/networking.md +++ b/src/software/operating_system/networking.md @@ -7,3 +7,68 @@ In client mode, the `wlan0` interface is managed by `wpa_supplicant`. This allow In access point mode, the `ap0` interface is managed by `hostapd` - with DNS and DHCP leasing being handled by `dnsmasq`. The IP address of the `ap0` interface is set to `11.11.11.10` by default. Connected devices are leased IP addresses in the range of `11.11.11.11 - 11.11.11.30` (_for now_). While the device is running in this mode, the `wlan0` interface is set `DOWN` and the `wpa_supplicant` process is stopped. The `peach-network` microservice exposes `activate_ap()` and `activate_client()` RPC calls for simple switching of the networking mode. This functionality is also exposed by the menu system of the physical interface. + + +## Direct Ethernet Setup + +This file contains documentation for two different ways of working with PeachCloud using a direct ethernet connection (useful for development purposes). + +### Method 1 + +If you are close to a router, you can plug your Pi into the router via ethernet and you should be able to SSH into the Pi from any laptop connected to the same router via WiFi or ethernet. + +### Method 2 + +Using a DHCP server on your laptop (instructions for a laptop running Debian). + +**Install the DHCP server:** + +`sudo apt-get install isc-dhcp-server` + +**Configure the DHCP server:** + +In `/etc/dhcp/dhcpd.conf`, add the following section: + +```plaintext +subnet 10.0.2.0 netmask 255.255.255.240 { + range 10.0.2.2 10.0.2.14; + option routers 10.0.2.1; + host peach { + hardware ethernet b8:27:eb:b1:b1:4e; + fixed-address 10.0.2.4; + } +} +``` + +Note that `b8:27:eb:b1:b1:4e` may need to be replaced with the address of your Pi's ethernet interface, which you can look up by running `ip a` on the Pi. This address should be static. The `fixed-address` section of the config tells the DHCP server to always give the specified client (`peach`) the `10.0.2.4` IP address. + + +In `/etc/default/isc-dhcp-server`, add the following section with the name of your ethernet interface (in this case `ens9`): + +```plaintext +INTERFACESv4="ens9" +INTERFACESv6="" +``` + +In `/etc/network/interfaces`, set a static IP for your ethernet interface by adding this section: + +```plaintext +auto ens9 +iface ens9 inet static + address 10.0.2.1 +``` + +**Start the DHCP server:** + +`sudo systemctl start isc-dhcp-server` + +**Connect the ethernet cable:** + +Connect your Pi to the laptop via an ethernet cable. You should then be able to SSH into the Pi using the following command: + +`ssh peach@10.0.2.4` + +_Note:_ On the Pi, internet traffic will still need to go through `wlan0` interface. + +On Mac OS you don't need to change the network config on your laptop. Simply enable internet sharing over ethernet and you should be able to connect to the Pi. + -- 2.49.0 From 360817391d75f6f60c1727799092eff1d38205ec Mon Sep 17 00:00:00 2001 From: notplants Date: Fri, 15 Jan 2021 11:06:05 +0100 Subject: [PATCH 7/7] Remove direct ethernet from summary --- src/SUMMARY.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SUMMARY.md b/src/SUMMARY.md index e31e855..f6b9576 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -25,7 +25,6 @@ - [Pattern Library](./software/pattern_library.md) - [Compilation](./software/compilation.md) - [Packaging](./software/packaging.md) - - [Direct Ethernet Setup](./software/direct-ethernet-setup.md) - [Configuration](./software/configuration.md) - [Contributor's Guide](./contributors_guide.md) - [Licensing](./licensing.md) -- 2.49.0