Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Updated README w/lego brick directions. Added option to use docker.
Browse files Browse the repository at this point in the history
  • Loading branch information
falquaddoomi committed Sep 24, 2019
1 parent f6335db commit 8c3eb35
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/instance/sequencer.sqlite
/instance/cache
/logs
/.venv
/.git
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.5-alpine

RUN pip install pipenv

WORKDIR /app
COPY Pipfile* /app/
RUN pipenv install

COPY . /app/

EXPOSE 5000
CMD ./run_alpine_site.sh
52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,70 @@

To run this project, you'll need the following:

- Python 3.5.3 + pipenv
- Python 3.x + pipenv
- A LEGO Mindstorms ev3 unit with Minipython installed

Follow these instructions to set up your device with rpyc
- https://www.ev3dev.org/docs/tutorials/
- https://ev3dev-lang.readthedocs.io/projects/python-ev3dev/en/stable/rpyc.html

Check out the source code to a directory of your choosing, e.g.:

```
# creates a folder called lego_sequencer under the current directory.
git clone https://github.com/ETH-NEXUS/lego_sequencer.git
```

We'll refer to this folder, `lego_sequencer`, as the source directory below.

## Usage

You should already have the ev3 connected and running the rpyc daemon. First, install the Python requirements like so:
The LEGO Sequencer consists of two components:
- the Mindstorms unit, which handles moving the tray and scanning bricks, and
- the webserver, which communicates with the Mindstorms unit to get the bricks that were scanned, convert them
to a sequence, then send the sequence to NCBI's BLAST API for determining the species to which it might belong.

## LEGO Mindstorms Setup

Ensure that the device is plugged in both to power and to a USB port on your computer.

To turn the unit on, press the dark gray center button on the unit's face. You'll see some text scroll by on the display
as the brick boots up Linux. This can take up to a minute, so be patient. (In the unlikely case that it freezes, you can
hold down the left, center, and right buttons, then press the back button to reboot the unit.)

Eventually, you'll see a menu appear with a number of options. The option "File Browser" should be selected; press
the center button to activate it, at which point you'll see a list of files. The first file, `rpyc_server.sh`, should
also already be selected. To run it, press the center button again. At this point the screen will go blank, but the
unit is ready to accept commands from the webserver which you'll soon launch on your computer.

When you're done with your demo, press the back button (the top-left button on the unit's face, separate from the other
buttons). You'll again see the file browser. Hold down the back button until a popup menu appears with power options
(i.e., "Power Off", "Reboot", and "Cancel"); press the center button again to turn the unit off.

## Webserver Setup

Inside the source directory, run the following to install the required Python libraries for the project:

```pipenv install```

Run the following to start the webserver:
Finally, run the following script to start the webserver:

`./run_site.sh`

If you're using Windows, you'll probably want to run the webserver via [Waitress](https://docs.pylonsproject.org/projects/waitress/en/stable/), like so:

`run_site.bat`

The site should be accessible at [http://localhost:5000](http://localhost:5000).

### Alternate Docker Setup

If you prefer to use Docker, inside the source directory you can build the project as an image like so:

```docker build -t lego-sequencer .```

Then, you can launch the image as a container:

```docker run --rm -d -p 5000:50000 lego-sequencer```

As before, you should be able to access the site at [http://localhost:5000](http://localhost:5000).
5 changes: 5 additions & 0 deletions run_alpine_site.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

export FLASK_APP=sequencer
export FLASK_ENV=development
pipenv run python waitress_server.py

0 comments on commit 8c3eb35

Please sign in to comment.