Upload / Up1

Client-side encrypted image host web server
MIT License
813 stars 97 forks source link

How Do I start Up1 on boot? #35

Closed msemple1111 closed 8 years ago

msemple1111 commented 8 years ago

I was wondering on how to properly start Up1 on boot or on ssh. When I start the server on ssh

ubuntu@apacheServer:~/upload$ ./server
2015/08/26 21:43:01 Starting HTTP server on :8000

It displays a cursor that never goes away. When I exit ssh to leave the server running but not having to leave open ssh, the server stops. I wrote this script to start the server http://pastebin.com/QqvAUSNq Is this enough to start it up or will it stop boot by running forever? I was then going to user mod_proxy to reverse proxy it in apache. Will that work?

The main question is, How to start Up1 from ssh properly, without having to leave it open?

ultramancool commented 8 years ago

Your init script will need to daemonize the process and store the PID somewhere, please don't use killall in an init script. mod_proxy or similar should work fine.

Many people simply use tmux or screen and put a script to start it in /etc/rc.local. I'm a runit fan personally.

However, this out of the scope of Up1 as a project as it's mostly a distro and init-system specific thing, as such I'm closing this issue. If you'd like to discuss this further I'll still respond though.

msemple1111 commented 8 years ago

I think I phrased the question improperly out of haste.

What I meant was: How to start Up1 from ssh properly? Because when I start it from ssh

ubuntu@apacheServer:~/upload$ ./server
2015/08/27 17:24:44 Starting HTTP server on :8000
▭ 

./server process stays open and I cannot type anything. How do I start Up1 without ./server staying open all of the time?

ultramancool commented 8 years ago

Yeah, to do that you'll need to write a script for your init system of choice or if you'd like an even simpler solution, to use tmux or screen to run it and then detach. On Aug 27, 2015 12:26, "msemple1111" notifications@github.com wrote:

I think I phrased the question improperly out of haste.

What I meant was: How to start Up1 from ssh properly? Because when I start it from ssh

ubuntu@apacheServer:~/upload$ ./server 2015/08/27 17:24:44 Starting HTTP server on :8000 ▭

./server process stays open and I cannot type anything. How do I start Up1 without ./server staying open all of the time?

— Reply to this email directly or view it on GitHub https://github.com/Upload/Up1/issues/35#issuecomment-135484649.

k3d3 commented 8 years ago

If you want the server to stay open in the background, you can run it as

./server &

However this won't redirect output (you'll still see output from it, over top of whatever you're running). To solve this, you can run it as

./server >/dev/null 2>&1 &

Which will redirect both stdout and stderr. That's probably the line you want to put into your init script.

msemple1111 commented 8 years ago

Thanks UMC and Keith both the screen method and redirection method worked for me.

Now when I try to used mod_proxy to redirect domain.com:8000 to domain.com/upload/ everything falls apart.

What I get is a black page with just the contact address on the bottom. I think this is the JS not working, but it could be something else.

in my httpd-vhost.conf

ProxyVia On
ProxyRequests Off
ProxyPass /upload/ http://localhost:8000/
ProxyPassReverse /upload/ http://localhost:8000/
ProxyPreserveHost on

The problem, I think, is with the relative URLs. I edited the end of index.html from this

    <script src="/static/deps/jquery-2.1.4.min.js"></script>
    <script src="/static/js/shims.js"></script>
    <script src="/static/js/loadencryption.js"></script>
    <script src="/static/js/main.js"></script>
    <script src="/static/js/home.js"></script>
    <script src="/static/js/updown.js"></script>
    <script src="/static/js/download.js"></script>
    <script src="/static/js/textpaste.js"></script>
    <script src="/config.js"></script>
    <script src="/static/js/dragresize.js"></script>

To this

    <script src="static/deps/jquery-2.1.4.min.js"></script>
    <script src="static/js/shims.js"></script>
    <script src="static/js/loadencryption.js"></script>
    <script src="static/js/main.js"></script>
    <script src="static/js/home.js"></script>
    <script src="static/js/updown.js"></script>
    <script src="static/js/download.js"></script>
    <script src="static/js/textpaste.js"></script>
    <script src="config.js"></script>
    <script src="static/js/dragresize.js"></script>

What else do I need to edit in order to make Up1 work from www.domain.com/upload/ ? Or do I need to make it upload.domain.com, although id prefer to avoid this.

ultramancool commented 8 years ago

@msemple1111 Up1 currently only supports hosting on the root of a domain or subdomain. This will change in a future release, but for now I'd suggest using a subdomain. A vhost should work fine.

msemple1111 commented 8 years ago

okay that will do for now but ill keep up to date with your releases Thanks again @ultramancool