Skip to content

Commit

Permalink
Update/package (butlerx#14)
Browse files Browse the repository at this point in the history
* add user to dockerfile and dockerignore

* update readme and package for new npm

* update service

* Update package.json
  • Loading branch information
butlerx authored and cbutler committed Jul 9, 2018
1 parent 987e65b commit 0a384d5
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 26 deletions.
59 changes: 47 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ in docker better.
- `cd wetty`
- `yarn`

or

`yarn add wetty.js`

## Run on HTTP

node app.js -p 3000
``` bash
node app.js -p 3000
```

If you run it as root it will launch `/bin/login` (where you can specify
the user name), else it will launch `ssh` and connect by default to
Expand All @@ -34,18 +40,26 @@ SSH user using the `--sshuser` option.

You can also specify the SSH user name in the address bar like this:

`http://yourserver:3000/wetty/ssh/<username>`
`http://yourserver:3000/wetty/ssh/<username>`

or

`http://yourserver:3000/ssh/<username>`

## Run on HTTPS

Always use HTTPS. If you don't have SSL certificates from a CA you can
create a self signed certificate using this command:

`openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 30000 -nodes`
```
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 30000 -nodes
```

And then run:

node app.js --sslkey key.pem --sslcert cert.pem -p 3000
```
node app.js --sslkey key.pem --sslcert cert.pem -p 3000
```

Again, if you run it as root it will launch `/bin/login`, else it will
launch SSH to `localhost` or a specified host as explained above.
Expand All @@ -69,11 +83,21 @@ Put the following configuration in nginx's conf:

If you are running `app.js` as `root` and have an Nginx proxy you have to use:

http://yourserver.com/wetty
```
http://yourserver.com/wetty
```

Else if you are running `app.js` as a regular user you can use:

```
http://yourserver.com/wetty/ssh/<username>
```

Else if you are running `app.js` as a regular user you have to use:
or

http://yourserver.com/wetty/ssh/<username>
```
http://yourserver.com/wetty
```

**Note that if your Nginx is configured for HTTPS you should run wetty without SSL.**

Expand All @@ -96,12 +120,23 @@ If you dont want to build the image yourself just remove the line `build; .`

## Run wetty as a service daemon

Install wetty globally with -g option:
Install wetty globally with global option:

### init.d

```bash
$ sudo yarn global add wetty.js
$ sudo cp /usr/local/lib/node_modules/wetty.js/bin/wetty.conf /etc/init
$ sudo start wetty
```

### systemd

```bash
$ sudo npm install wetty -g
$ sudo cp /usr/local/lib/node_modules/wetty/bin/wetty.conf /etc/init
$ sudo start wetty
$ yarn global add wetty.js
$ cp ~/.config/yarn/global/node_modules/wetty.js/bin/wetty.service ~/.config/systemd/user/
$ systemctl --user enable wetty
$ systemctl --user start wetty
```

This will start wetty on port 3000. If you want to change the port or redirect
Expand All @@ -113,4 +148,4 @@ exec sudo -u root wetty -p 80 >> /var/log/wetty.log 2>&1
## Clean-up

If users dont fully disconnect when finished ssh connections will actually be kept open the simplest
way to deal with this is run `/app/bin/cleanup` on a cron job.
way to deal with this is run `bin/cleanup` on a cron job.
6 changes: 2 additions & 4 deletions bin/wetty.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ Description=Wetty Web Terminal
After=network.target

[Service]
User=root
Group=root

WorkingDirectory=/home/akadmin/pack/wetty # CHANGE ME
ExecStart=/usr/bin/node app.js -p 9123 --host 127.0.0.1
WorkingDirectory=$HOME/.config/yarn/global/node_modules/wetty.js/
ExecStart=/usr/bin/node app.js -p 3000 --host 127.0.0.1

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3"
services:
wetty:
build: .
image: redbrick/wetty
image: butlerx/wetty
container_name: wetty
tty: true
working_dir: /app
Expand Down
22 changes: 13 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "wetty",
"version": "0.2.0",
"name": "wetty.js",
"version": "0.3.0",
"dependencies": {
"express": "^4.15.3",
"optimist": "^0.6",
"pty.js": "^0.3.0",
"pty.js": "^0.3.1",
"serve-favicon": "^2.4.3",
"socket.io": "^1.3.7"
},
Expand All @@ -21,24 +21,28 @@
"load-grunt-tasks": "^3.0"
},
"description": "Wetty = Web + tty. Terminal access in browser over http/https ",
"main": "app.js",
"repository": {
"type": "git",
"url": "git://github.com/krishnasrinivas/wetty.git"
"url": "git://github.com/butlerx/wetty.git"
},
"author": "Krishna Srinivas <[email protected]> (https://github.com/krishnasrinivas)",
"author": "Cian Butler <[email protected]> (https://github.com/butlerx)",
"license": "MIT",
"bugs": {
"url": "https://github.com/krishnasrinivas/wetty/issues"
"url": "https://github.com/butlerx/wetty/issues"
},
"homepage": "https://github.com/krishnasrinivas/wetty",
"homepage": "https://github.com/butlerx/wetty",
"preferGlobal": "true",
"main": "app.js",
"bin": {
"wetty": "./bin/wetty.js"
},
"files": [
"bin",
"public"
],
"scripts": {
"lint": "eslint .",
"fix": "eslint . --fix",
"lint:fix": "eslint . --fix",
"build": "grunt",
"start": "node app.js"
}
Expand Down

0 comments on commit 0a384d5

Please sign in to comment.