diff --git a/easyinstall.sh b/easyinstall.sh index 66728bdc..d2688e23 100755 --- a/easyinstall.sh +++ b/easyinstall.sh @@ -134,7 +134,7 @@ function updateRaScsiWebInterface() { } function showRaScsiStatus() { - sudo systemctl status rascsi + sudo systemctl status rascsi | tee } function createDrive600MB() { @@ -221,7 +221,7 @@ function createDrive() { if [ ! -f $drivePath ]; then echo "Creating a ${driveSize}MB Drive" - dd if=/dev/zero of=$drivePath bs=1M count=$driveSize + truncate --size ${driveSize}m $drivePath echo "Formatting drive with HFS" formatDrive "$drivePath" "$driveName" diff --git a/src/web/README.md b/src/web/README.md index 82088ba2..352e5ce3 100644 --- a/src/web/README.md +++ b/src/web/README.md @@ -1,12 +1,35 @@ # RaSCSI Web -## Mocking for local development +## Setup local dev env -Set a few env vars to point to the mock scripts and base dir - -``` -BASE_DIR=/tmp/images/ -PATH=$PATH:`pwd`/mock/bin/ +```bash +# Make a virtual env named venv +$ python3 -m venv venv +# Use that virtual env in this shell +$ source venv/bin/activate +# Install requirements +$ pip install -r requirements.txt +# Use mocks and a temp dir - start the web server +$ BASE_DIR=/tmp/images/ PATH=$PATH:`pwd`/mock/bin/ python3 web.py ``` -Edit response to commands in `mock/bin/*` +### Mocks for local development + +You may edit the files under `mock/bin` to simulate rascsi command responses. + +## Pushing to the Pi via git + +Setup a bare repo on the rascsi +``` +$ ssh pi@rascsi +$ mkdir /home/pi/dev.git && cd /home/pi/dev.git +$ git --bare init +Initialized empty Git repository in /home/pi/dev.git +``` + +Locally +``` +$ cd ~/source/RASCSI +$ git remote add pi ssh://pi@rascsi/home/pi/dev.git +$ git push pi master +``` diff --git a/src/web/file_cmds.py b/src/web/file_cmds.py index c424f82f..7ca5d19e 100644 --- a/src/web/file_cmds.py +++ b/src/web/file_cmds.py @@ -17,7 +17,7 @@ def create_new_image(file_name, type, size): file_name = file_name + "." + type return subprocess.run( - ["dd", "if=/dev/zero", "of=" + base_dir + file_name, "bs=1M", "count=" + size], + ["truncate", "--size", f"{size}m", f"{base_dir}{file_name}"], capture_output=True, ) diff --git a/src/web/requirements.txt b/src/web/requirements.txt index 64d25bb4..ab184b10 100644 --- a/src/web/requirements.txt +++ b/src/web/requirements.txt @@ -1,12 +1,12 @@ click==7.1.2 -Flask==1.1.2 -itsdangerous==1.1.0 -Jinja2==2.11.2 +Flask==2.0.0 +itsdangerous==2.0.0 +Jinja2==3.0.0 machfs==1.2.4 macresources==1.2 -MarkupSafe==1.1.1 +MarkupSafe==2.0.0 rsrcfork==1.8.0 waitress==1.4.4 -Werkzeug==1.0.1 +Werkzeug==2.0.0 zope.event==4.5.0 zope.interface==5.1.2 diff --git a/src/web/service-infra/nginx-default.conf b/src/web/service-infra/nginx-default.conf index bffa96cc..fc73e44e 100644 --- a/src/web/service-infra/nginx-default.conf +++ b/src/web/service-infra/nginx-default.conf @@ -5,6 +5,12 @@ server { proxy_pass http://localhost:8080; } + # Large files + client_max_body_size 0; + proxy_read_timeout 1000; + proxy_connect_timeout 1000; + proxy_send_timeout 1000; + error_page 502 /502.html; location = /502.html { root /var/www/html/; diff --git a/src/web/web.py b/src/web/web.py index 2268d43d..0699443c 100644 --- a/src/web/web.py +++ b/src/web/web.py @@ -55,7 +55,7 @@ def config_save(): with open(file_name, "w") as csv_file: writer = csv.writer(csv_file) for device in list_devices(): - if device["type"] is not "-": + if device["type"] != "-": writer.writerow(device.values()) flash(f"Saved config to {file_name}!") return redirect(url_for("index"))