🌱🏠🖥️ Cross-platform desktop application for greenhouse -- share your local servers or files on the internet in seconds! https://greenhouse.server.garden/ https://greenhouse.server.garden/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

217 lines
8.5 KiB

# greenhouse-desktop
![Pitney the Pineapple waving at you from behind a laptop](readme/mascot-laptop.png)
This is the desktop application for the Greenhouse cloud service (in development).
greenhouse-desktop is a cross-platform [fbs (fman build system)](https://github.com/mherrmann/fbs) python/QT application with an accompanying daemon (background service) written in Go. The python app will display status to the user and allow them to configure their tunnels, while the daemon will manage the embedded [threshold](https://git.sequentialread.com/forest/threshold) and [caddy](https://caddyserver.com/v2) processes.
3 years ago
## Screenshots
![screenshot of splash screen](readme/screenshot.png)
![screenshot of tunnel configuration screen highlighting listening port chooser](readme/screenshot-windows.png)
3 years ago
## Getting Started (run from source)
In general, to run from source you will have to:
1. Aquire Python 3.6 (fbs require this old python version)
1. Download the source code
1. Create the python virtual environment `venv` in the root of the source code directory
1. enter the virtual environment by sourcing the `activate` script
1. install the requirements using `pip` and the requirements file `requirements/linux.txt`
1. run `fbs run`
Please note that the greenhouse-desktop application can't do anything on its own, it needs the [🌱🏠😈 greenhouse-daemon](https://git.sequentialread.com/forest/greenhouse-daemon/) installed first. The Mac version is the only one that bundles the daemon installer inside the application itself.
On Windows, the `greenhouse-daemon` installer is a part of the NSIS (Nullsoft Scriptable Installation System) installer that the release process builds.
On Linux, the `greenhouse-daemon` installer is a [separate shell script that gets served by the greenhouse web application](https://git.sequentialread.com/forest/greenhouse/src/commit/537a14cdc2e4303f08c19e24c1de8d6c894a61c9/frontend/static/install.sh)
### Run from Source on Linux
```
# Download python 3.6 with security updates from https://www.python.org/downloads/release/python-3613/
cd Python-3.6.13/
./configure --enable-shared
make test
# note some tests will fail because of openssl being newer since python 3.6 is very old. https://bugs.python.org/issue32947
# for now i ignored this 😬
sudo make install
```
```
3 years ago
git clone https://git.sequentialread.com/forest/greenhouse-desktop.git
cd greenhouse-desktop
python3.6 -m venv venv
source venv/bin/activate
pip install -r requirements/linux.txt
fbs run
```
### Run from Source on MacOS
Install Python 3.6 from https://www.python.org/downloads/release/python-368/
Note that the first-run daemon installer feature doesn't work under `fbs run`.
So if you want that, you will have to run `fbs freeze` and then run the resulting application:
```
git clone https://git.sequentialread.com/forest/greenhouse-desktop.git
cd greenhouse-desktop
python3.6 -m venv venv
source venv/bin/activate
pip install -r requirements/linux.txt
3 years ago
fbs freeze
target/Greenhouse.app/Contents/MacOS/Greenhouse
```
### Run from Source on Windows
* Install Python 3.6 from https://www.python.org/downloads/release/python-368/
* (you might have to manually add it to your %PATH%)
* install [git for windows](https://git-scm.com/download/windows)
First make sure that your python version is correct:
```
C:\Users\my-user>python --version
Python 3.6.8
```
```
git clone https://git.sequentialread.com/forest/greenhouse-desktop.git
cd greenhouse-desktop
python -m venv venv
./venv/Scripts/activate.bat
pip install -r requirements/linux.txt
fbs run
```
3 years ago
## Architecture Diagrams for Install and Setup Process
3 years ago
These diagrams were created with https://app.diagrams.net/.
To edit them, download the png file edit it with the https://app.diagrams.net/ web application, or you may run the application from [source](https://github.com/jgraph/drawio) if you wish.
### Linux Architecture
3 years ago
![](readme/architecture-linux.png)
3 years ago
### Windows Architecture
3 years ago
![](readme/architecture-windows.png)
3 years ago
### MacOS Architecture
3 years ago
![](readme/architecture-mac.png)
3 years ago
## Building a Release
See https://build-system.fman.io/manual/#releasing
### Building Linux Package
Note:
* `venv/lib/python3.6/site-packages/fbs/`
* `venv/lib/python3.6/site-packages/fbs/_defaults`
```
sudo su
source venv/bin/activate
fbs buildvm ubuntu
fbs runvm ubuntu
# you should be inside the docker container now.
# note there is a bug where the fbs .bashrc fails to source the venv properly.
# so you have to do it yourself:
source venv/bin/activate && pip install -r requirements/linux.txt && fbs freeze && fbs release 0.0.1
exit
# now target/ubuntu/greenhouse-desktop.deb should exist!
# since right now root owns all this stuff, lets give it to the normal login user
# for me, that's user #1000 (forest)
mkdir -p my_dist
chown 1000:1000 my_dist
cp target/ubuntu/greenhouse-desktop.deb my_dist/greenhouse-desktop.deb
chown 1000:1000 my_dist/greenhouse-desktop.deb
```
3 years ago
### Building a Windows Installer
* build the install-helper.exe if its not already built
* `GOOS=windows go build -o src/installer/windows/install-helper.exe src/installer/windows/install-helper.go`
* [create a windows virtual machine](https://dennisnotes.com/note/20180614-ubuntu-18.04-qemu-setup/)
* [get python 3.8.6](https://www.python.org/downloads/release/python-368/)
* install the [Microsoft Visual C++ 2010 Service Pack 1 Redistributable Package MFC Security Update ](https://www.microsoft.com/en-us/download/details.aspx?id=26999)
* install the [Visual C++ Redistributable for Visual Studio 2012](https://www.microsoft.com/en-us/download/details.aspx?id=30679)
* install the [Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019](https://aka.ms/vs/16/release/vc_redist.x64.exe)
<!-- * install [visual studio 2019](https://visualstudio.microsoft.com/downloads/) (Choose "Desktop development with C++" (not sure if this is needed???)) -->
* open file explorer and search `C:\` for `api-ms-win-crt-multibyte-l1-1-0.dll`
* Start Menu > search for "Edit the System Environment Variables"
- Environment Variables... > System Variables > Path > Edit...
- Choose "New" and enter `C:\Program Files (x86)\Windows Kits\10\Redist\10.0.19041.0\ucrt\DLLs\x64`
- (or some other path where this dll appears... ????)
* install [Nullsoft Scriptable Install System (NSIS)](https://nsis.sourceforge.io/Download)
* download the [NSIS Simple Service Plugin](https://nsis.sourceforge.io/NSIS_Simple_Service_Plugin)
* copy `SimpleSC.dll` into `C:\Program Files (x86)\NSIS\Plugins\x86-unicode`
* download the [NSIS User Manager Plugin](https://nsis.sourceforge.io/UserMgr_plug-in)
* copy `UserMgr.dll` into `C:\Program Files (x86)\NSIS\Plugins\x86-unicode`
* Start Menu > search for "Edit the System Environment Variables"
- Environment Variables... > System Variables > Path > Edit...
- Choose "New" and enter `C:\Users\venie\AppData\Local\Programs\Python\Python36`
- Choose "New" and enter `C:\Users\venie\AppData\Local\Programs\Python\Python36\Scripts`
- Choose "New" and enter `C:\Program Files (x86)\NSIS`
* install [git for windows](https://git-scm.com/download/windows)
* `git clone https://git.sequentialread.com/forest/greenhouse-desktop.git`
* `cd greenhouse-desktop`
* download / set up the greenhouse-background-service files if its not done already
* `cd src/installer/windows`
* `./get-background-service-installer-files.sh`
<!-- * this script will:
* make the `src/installer/windows/background-service` folder (this folder is gitignored)
* download/place the required greenhouse-daemon installation files into it:
* `greenhouse-background-service.exe` (greenhouse-daemon)
* `greenhouse-threshold.exe`
* `greenhouse-caddy.exe`
* `caddy-config.json` -->
* enter the windows cmd.exe shell instead of git bash
* `python --version`
* `python -m venv venv`
* `./venv/Scripts/activate.bat`
* `pip install -r requirements/linux.txt`
* `fbs run`
* `fbs freeze`
* `fbs release 0.0.0`
TODO it throws the logs away https://stackoverflow.com/questions/20523480/windows-service-output
3 years ago
### Building a MacOS Application
* [create a MacOS virtual machine](https://snapcraft.io/install/sosumi/ubuntu)
* [get python 3.8.6](https://www.python.org/downloads/release/python-368/)
* `git clone https://git.sequentialread.com/forest/greenhouse-desktop.git`
* `cd greenhouse-desktop`
* `python3.6 -m venv venv`
* `source venv/bin/activate`
* `pip3.6 install -r requirements/linux.txt`
* `fbs run`
* `fbs freeze`
* `fbs release 0.0.0`