anselal / antminer-monitor

Cryptocurrency ASIC mining hardware monitor using a simple web interface
GNU General Public License v3.0
230 stars 146 forks source link

Running as a daemon, or similar #28

Closed gnanet closed 4 years ago

gnanet commented 7 years ago

After running this in a gnu screen session several days, i was wondering if there is a nice way to run the app as a daemon, and sending its log to a file.

I know i could create a separate session for it and start already detached with screen -dmS but i wanted a bit more clean solution.

To create the supervisor-conf and prepare the folder for logfiles i made a small shell script (this time already tested with Raspbian Stretch): gen-supervisor-conf.sh.txt

after created the supervisor-conf a supervisorctl update has to be run to start antminer-monitor

anselal commented 7 years ago

Nice script you got there @gnanet. In my raspberry pi I use gunicorn and systemd to create a service for antminer-monitor. I didn't had the time to write down the instruction but most of the users had a hard time to get the app running in the first place and I think adding those instructions would only make things harder for them (and me).

Windows users can try out this little app https://nssm.cc/ with which they can easily create a windows service.

I am not sure about mac users how they can create a service. I own an old macbook but I never tried to create a service there.

Gunicorn and systemd work very well together and I didn't have any problems so far.

stangri commented 6 years ago

@anselal can you maybe post your script as a jist and link it from this issue for a time being? Thanks!

anselal commented 6 years ago

I was running the app using gunicorn, which runs only on Linux machines and I proxy it through nginx.

Now I just run it with gunicorn but you can't use my config because I am currently refactoring the codebase and haven't pushed the changes yet. I was gonna update the readme but yesterday I read that gunicorn is not available on Windows which I was not aware of.

So I will add this option only for Linux/UNI*/Mac users..

stangri commented 6 years ago

The reason I asked is that having never dealt with python before I wanted to see how it's done on other systems to write an init wrapper for OpenWrt. But it wasn't very hard and I've created an easy to install package for OpenWrt: https://github.com/stangri/openwrt_packages/blob/master/antminer-monitor/files/README.md.

Because of dependencies, it requires router with large flash (definitely more than 16Mb).

anselal commented 6 years ago

@stangri WoW. I will definitely rweet about. I didn't knew that my monitor was such lite that it could run on a router !!! If you have a twitter account a can tag you

shotaatosh commented 6 years ago

this means I can run it on cheap router with openwrt???

anselal commented 6 years ago

@shotaatosh better buy a raspberry pi.

@gnanet my app already creates a log in the log folder since the very first version !!!

stangri commented 6 years ago

@anselal don't really use twitter, but I'm also @stangri there. There's a known issue now that the service cannot be stopped which I'd like to resolve in the near future and I'd like to get some feedback from others before you tweet about it tho.

@shotaatosh a cheap one -- no (well, GL-Inet used to make cheap 128Mb NAND routers, not sure if they still make them and if they're supported in the vanilla OpenWrt tree anymore). I've been running it on a WRT3200ACM, but any OpenWrt-supported WRTxx00 will do, as well as many other 128Mb devices listed here: https://openwrt.org/toh/views/toh_available_864?dataflt%5BFlash+MB*~%5D=128&chrome_dont_add_custom_search_engines_srsly=

Some of the required python mods are huge (~8mb), so it might work on a 32Mb router, especially if you build python-light and python-pip with dependencies into the image rather than install them afterwards, but I don't have one to test.

anselal commented 6 years ago

@stangri Well than maybe you can tweet about it when you fix the issue and tag so i can retweet. This will promote us both. I am famikiar with linux but not with openwrt. I will install openwrt on virtualbox and try to fix your issue ;)

stangri commented 6 years ago

@anselal it's a PROCD issue (or an issue of how I'm using PROCD ;)), I'll seek help from people who know more about PROCD and hopefully find a way to fix it. I'll be in touch.