janitor icon indicating copy to clipboard operation
janitor copied to clipboard

Installing on Debian 8

Open dns2utf8 opened this issue 8 years ago • 12 comments

I tried to install it on Debian 8, but I failed. First I had to symlink /usr/bin/node to /usr/bin/nodejs

Then I started a ubuntu container, leading to the same result. I noticed in the error messages, service not found so I am running a container with ubuntu:16.10 now.

However, am I assuming correctly the readme should state Debian 7 or Ubuntu 16.10?

dns2utf8 avatar Oct 11 '16 16:10 dns2utf8

Hi @dns2utf8, thanks for reporting these problems!

The node: command not found error we can easily fix by detecting node vs nodejs.

The service not found error is less easy. Service scripts are a bit messy nowadays, with the transition to systemd across all distros, so I don't actually use these anymore for now (i.e. the stuff in init.d/ or make daemon). Maybe I should remove them.

Also, you're right, make install makes a few Debian 7 / Ubuntu 15 assumptions, notably for the Docker configuration step.

As a workaround, you can just use node app (or nodejs app) to start the server, or make start to make it run in the background (make stop to kill it). You might need to do a few things manually, e.g. npm install, make https to generate self-signed HTTPS certs (this is currently being replaced by Let's Encrypt), and make client.crt docker.crt to generate TLS certs for Docker (and then you need to configure Docker by manually doing make docker for your platform).

TL;DR workaround:

npm install
make https
make client.crt docker.crt
# TODO: configure docker daemon to use ca.crt, docker.key and docker.crt
node app # start the server in the foreground to test it
^C
make start # start the server in the background
tailf janitor.log # to watch the server logs

jankeromnes avatar Oct 12 '16 06:10 jankeromnes

Note to self, to fix this the following needs to happen:

  • [ ] Detect nodejs vs node
  • [x] Remove deprecated platform-specific service stuff (EDIT: fixed by fa9aa7b76f71c810c04eba8a90dae3c526ed14af)
  • [x] Replace self-signed HTTPS certificate generation with Let's Encrypt (#33)
  • [x] ~~Mention in Readme that make install only works on Debian 7 / Ubuntu 15~~ (Edit: make install was deprecated in favor of npm install)
  • [ ] Provide more cross-platform install instructions

jankeromnes avatar Oct 12 '16 06:10 jankeromnes

Have you already been able to test it on Ubuntu 16.10?

dns2utf8 avatar Oct 20 '16 13:10 dns2utf8

I believe Ubuntu 16.10 uses systemd, so the make daemon probably won't work, but apart from that I believe make install should work. Please report any specific problems so we can fix or work around them. Thanks!

jankeromnes avatar Oct 20 '16 13:10 jankeromnes

I had to install nodejs 6 for janitor:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

but now it is just showing me a aborted page and logs:

dropping request for localhost:1443

dns2utf8 avatar Oct 31 '16 23:10 dns2utf8

@dns2utf8 I am happy to see things are coming along. Looks like @jankeromnes's new security features are getting in your way, try commenting out this security middleware: https://github.com/jankeromnes/janitor/blob/master/app.js#L65-L86

Coder206 avatar Oct 31 '16 23:10 Coder206

@dns2utf8 Feel free to ping me in IRC for more questions. :)

Coder206 avatar Oct 31 '16 23:10 Coder206

Ah, I solved it with a entry in ./db.json:

{ "hostname": "localhost:1443" }

which IRC?

dns2utf8 avatar Oct 31 '16 23:10 dns2utf8

#janitor on freenode

Coder206 avatar Oct 31 '16 23:10 Coder206

I had to install nodejs 6 for janitor

Yes, I believe we need node < 6, but I'd advise using 7 or 8 (or whichever version is the latest stable) because while we try to keep our web app front-end largely compatible with older browsers, our server code often uses brand-new Node.js features.

dropping request for localhost:1443

This log now looks like this:

[2017-07-25T22:32:50.419Z] [warning] dropped 1 request for invalid hostname: localhost:1443

It can be fixed by disabling all security policies (for development only!) like so:

In db.json:

"security": {
  "forceInsecure": true
}

You might also want to add "forceHttp": true in order to disable Let's Encrypt certificate requests (which usually don't work in a development setup anyway).

#janitor on freenode

There is a quick link to join our IRC channel at the bottom of the website: #janitor (IRC)

jankeromnes avatar Jul 26 '17 07:07 jankeromnes

So 1e15ab3a513a86ed26a40cafd5ef9888902d503d refactored the make docker configuration to systemd.

Now we just need to detect nodejs vs node, and update README.md's install instructions to something like:

  1. install node (and docker if you're planning to host containers)
  2. do sudo make ports
  3. add the correct "hostname": "myhostname.com" and "letsencrypt": { "email": "[email protected]" } to db.json (well actually you might need Janitor OAuth2 credentials as well... we should add a "Add new host" flow to the website that generates a working db.json you can install)
  4. then npm start (choose "app" to run a new Janitor web app + cluster, or "join" to join the existing Janitor cluster, and then tailf -n100 janitor.log to see if everything works)
  5. and finally, if you want to host containers, sudo make docker to configure Docker to use the auto-generated TLS certificates to expose the Docker Remote API

jankeromnes avatar Nov 14 '17 17:11 jankeromnes

FWIW, installing latest node can be done using nodeenv, which in turn may be usede inside a Python virtualenv. Something along these lines worked for me:

$ virtualenv --system-site-packages venv
$ . ./venv/bin/activate
(venv) $ pip install nodeenv
(venv) $ nodeenv -p
(venv) $ deactivate

$ git clone ...
$ git submodule init
$ git submodule update

$ . ./venv/bin/activate
(venv) $ cd janitor
(venv) $ npm install 
....

Hope this helps.

olberger avatar Feb 07 '19 11:02 olberger