Skip to content

Commit

Permalink
select worker version before downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Oct 19, 2024
1 parent b60d88d commit 04b3d37
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20.x
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16.x
Expand Down
52 changes: 52 additions & 0 deletions src/components/ButtonDownloadVersionedImage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react';


export default function ButtonDownloadVersionedImage({type}){
const [selectedVersion, setSelectedVersion] = React.useState("");
const [versions, setVersions] = React.useState([]);

React.useEffect(() => {
const fetchReleases = async () => {
try {
const response = await fetch("https://api.github.com/repos/pioreactor/custopizer/releases");
if (!response.ok) {
throw new Error("Failed to fetch releases");
}

const data = await response.json();
// Filter out prereleases and drafts
const filteredVersions = data
.filter(release => !release.prerelease && !release.draft)
.map(release => ({ version: release.tag_name }));

setVersions(filteredVersions);
} catch (error) {
console.error("Error fetching releases:", error);
}
};

fetchReleases();
}, []);

const handleDownload = () => {
if (selectedVersion) {
const downloadUrl = `https://github.com/Pioreactor/CustoPiZer/releases/download/${selectedVersion}/pioreactor_${type}.zip`;
window.open(downloadUrl, '_blank');
}
};

return (
<div>
<span> Select software version: </span>
<select name="version" onChange={e => setSelectedVersion(e.target.value)} style={{ width: "100px" }}>
<option value="">version</option>
{versions.map((blob, index) => (
<option key={index} value={blob.version}>{blob.version}</option>
))}
</select>
<button onClick={handleDownload} disabled={selectedVersion === ''} style={{"marginLeft": "10px"}}>
Download {type} image
</button>
</div>
);
}
26 changes: 23 additions & 3 deletions user-guide/01-getting-started/02-software-set-up.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ slug: /software-set-up
---

import TOCInline from '@theme/TOCInline';
import ButtonDownloadVersionedImage from '@site/src/components/ButtonDownloadVersionedImage';


### Before you begin
Expand All @@ -29,7 +30,7 @@ Before you get started, you'll need to have the following:

We'll start your blank microSD card.

1. Download the [Pioreactor leader & worker image file](https://github.com/pioreactor/custopizer/releases/latest/download/pioreactor_leader_worker.zip).
1. Download the [Pioreactor leader and worker image file](https://github.com/pioreactor/custopizer/releases/latest/download/pioreactor_leader_worker.zip).

:::info
What is an image file? It's a file that contains all the required software preinstalled on it, including an operating system and our custom Pioreactor software. The image will be installed on the microSD card.
Expand Down Expand Up @@ -110,9 +111,17 @@ Workers are additional Pioreactors that you can control from a single UI. Togeth

#### Step 1. Install the worker software

1. Follow the same instructions above, but use a [Pioreactor Worker image](https://github.com/pioreactor/custopizer/releases/latest/download/pioreactor_worker.zip) instead. All the settings are the same, including *username* and *password*, **but choose a new hostname**. See note below:
1. Download a *Pioreactor worker image*:

:::note
:::tip
Check the software version of your leader first (you can find that on the Updates page, or the Inventory Page, or use `pio version` on the command line). It's recommended to download the associated worker image for that same version.
:::

<ButtonDownloadVersionedImage type={'worker'}/>

2. Follow the same instructions above to write the image to an SD card. All the settings are the same, including *username* and *password*, **but choose a new hostname**. See note below:

:::tip
Choose a hostname that isn't currently being used in your cluster, ex: `worker01`, `worker02`, etc. Re-using old names is fine, so long as that worker isn't present in your cluster.

**Tip**: if you plan to have many Pioreactors, use a leading zero in any numbers, like `pio01`, or `worker01`, etc.
Expand Down Expand Up @@ -185,3 +194,14 @@ Easiest solution is to start over. You can edit the name in the RPi Imager, and
#### Can I plug a monitor into the Raspberry Pi's HDMI port?

Our current software turns off all external displays (for power and compute reasons), so any external monitor attached to the Pi won't work.

#### I want a different leader-worker software version.

<ButtonDownloadVersionedImage type={'leader_worker'}/>


#### I'd like to have the leader _not be a worker_, and only a standalone leader. Can I do that?

Sure, we have a custom image that only has the leader software on it. See below:

<ButtonDownloadVersionedImage type={'leader'}/>
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ Managing on/off and settings are done just like any other job, in the Manage dia

You can uninstall plugins from the same page, too. These will remove the action on the Pioreactor's card, but won't delete the section in your config.ini. Also, if a SQL table was installed with the plugin, the table will not be deleted.

## I don't have internet access - how can I install the plugin?

1. First, get the latest .whl file [here](https://pypi.org/) onto any computer that can SSH into the Pioreactor.
2. To get this .whl file onto a Pioreactor, use either `scp`, WinSCP, or FileZilla. Note: if you upload the .whl file to your leader Pioreactor first, you can distribute the .whl file to all your workers with `pios cp <location of .whl file>`
3. Once the .whl file is on the Pioreactor, use the following to install the plugin:
```
pio plugin install <name-of-plugin> --source <location of .whl file>
```
For example:
```
pio plugins install pioreactor-air-bubbler --source ~/pioreactor_air_bubbler-0.3.1-py3-none-any.whl
```

## Alternative: putting Python files in the the `plugins` folder

An alternative way to install a plugin is to place a Python file in the `/home/pioreactor/.pioreactor/plugins` directory on the Raspberry Pi. This is good for one-off scripts or plugins you are demoing or testing. See more [about writing and distributing plugins](/developer-guide/intro-plugins).
4 changes: 2 additions & 2 deletions user-guide/30-Advanced/01-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Interacting with the Pioreactor on the command line are through the `pio` tool.
* `pio plugins list` will list the currently installed plugins
* `pio blink` will blink the Pioreactor's onboard LED.
* `pio log -m <message>` will log a message
* `pio view-cache <cache>` will print out the contents of the specified cache.
* `pio clear-cache <cache> <key>` will remove `<key>` from cache `<cache>`.
* `pio cache view <cache>` will print out the contents of the specified cache.
* `pio cache clear <cache> <key>` will remove `<key>` from cache `<cache>`.


### Leader-only commands
Expand Down
4 changes: 2 additions & 2 deletions user-guide/30-Advanced/02-networking/01-internet-sharing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ title: Internet sharing between a PC and a Pioreactor
slug: /internet-sharing
---

Below is a way to physically connect your PC to your Pioreactor and be able to control the Pioreactor from your PC, without needing any wifi or external router. This is called _internet sharing_. Note that this method _does_ scale to larger clusters, but below is only how to connect a single Pioreactor.
Below is a way to physically connect your PC to your Pioreactor and be able to control the Pioreactor from your PC, without needing any wifi or external router. This is called _internet sharing_. Note that this method _does_ scale to larger clusters (see below).


Below is a simple diagram of how this might look (these are faked IPs).
Below is a simple diagram of how this might look (these are random IPs, yours may be different).
```
+---------------------+
Expand Down

0 comments on commit 04b3d37

Please sign in to comment.