Browse Source

Update/package (#14)

* add user to dockerfile and dockerignore

* update readme and package for new npm

* update service

* Update package.json
pull/123/head
Cian Butler 8 years ago
committed by cbutler
parent
commit
0a384d56be
No known key found for this signature in database GPG Key ID: 9EB3D625BD14DDEC
  1. 59
      README.md
  2. 6
      bin/wetty.service
  3. 2
      docker-compose.yml
  4. 22
      package.json

59
README.md

@ -20,9 +20,15 @@ in docker better.
- `cd wetty` - `cd wetty`
- `yarn` - `yarn`
or
`yarn add wetty.js`
## Run on HTTP ## 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 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 the user name), else it will launch `ssh` and connect by default to
@ -34,18 +40,26 @@ SSH user using the `--sshuser` option.
You can also specify the SSH user name in the address bar like this: 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 ## Run on HTTPS
Always use HTTPS. If you don't have SSL certificates from a CA you can Always use HTTPS. If you don't have SSL certificates from a CA you can
create a self signed certificate using this command: 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: 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 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. launch SSH to `localhost` or a specified host as explained above.
@ -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: 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.** **Note that if your Nginx is configured for HTTPS you should run wetty without SSL.**
@ -96,12 +120,23 @@ If you dont want to build the image yourself just remove the line `build; .`
## Run wetty as a service daemon ## 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 ```bash
$ sudo npm install wetty -g $ yarn global add wetty.js
$ sudo cp /usr/local/lib/node_modules/wetty/bin/wetty.conf /etc/init $ cp ~/.config/yarn/global/node_modules/wetty.js/bin/wetty.service ~/.config/systemd/user/
$ sudo start wetty $ systemctl --user enable wetty
$ systemctl --user start wetty
``` ```
This will start wetty on port 3000. If you want to change the port or redirect This will start wetty on port 3000. If you want to change the port or redirect
@ -113,4 +148,4 @@ exec sudo -u root wetty -p 80 >> /var/log/wetty.log 2>&1
## Clean-up ## Clean-up
If users dont fully disconnect when finished ssh connections will actually be kept open the simplest 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
bin/wetty.service

@ -9,11 +9,9 @@ Description=Wetty Web Terminal
After=network.target After=network.target
[Service] [Service]
User=root
Group=root
WorkingDirectory=/home/akadmin/pack/wetty # CHANGE ME WorkingDirectory=$HOME/.config/yarn/global/node_modules/wetty.js/
ExecStart=/usr/bin/node app.js -p 9123 --host 127.0.0.1 ExecStart=/usr/bin/node app.js -p 3000 --host 127.0.0.1
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

2
docker-compose.yml

@ -3,7 +3,7 @@ version: "3"
services: services:
wetty: wetty:
build: . build: .
image: redbrick/wetty image: butlerx/wetty
container_name: wetty container_name: wetty
tty: true tty: true
working_dir: /app working_dir: /app

22
package.json

@ -1,10 +1,10 @@
{ {
"name": "wetty", "name": "wetty.js",
"version": "0.2.0", "version": "0.3.0",
"dependencies": { "dependencies": {
"express": "^4.15.3", "express": "^4.15.3",
"optimist": "^0.6", "optimist": "^0.6",
"pty.js": "^0.3.0", "pty.js": "^0.3.1",
"serve-favicon": "^2.4.3", "serve-favicon": "^2.4.3",
"socket.io": "^1.3.7" "socket.io": "^1.3.7"
}, },
@ -21,24 +21,28 @@
"load-grunt-tasks": "^3.0" "load-grunt-tasks": "^3.0"
}, },
"description": "Wetty = Web + tty. Terminal access in browser over http/https ", "description": "Wetty = Web + tty. Terminal access in browser over http/https ",
"main": "app.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/krishnasrinivas/wetty.git" "url": "git://github.com/butlerx/wetty.git"
}, },
"author": "Krishna Srinivas <krishna.srinivas@gmail.com> (https://github.com/krishnasrinivas)", "author": "Cian Butler <butlerx@notthe.cloud> (https://github.com/butlerx)",
"license": "MIT", "license": "MIT",
"bugs": { "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", "preferGlobal": "true",
"main": "app.js",
"bin": { "bin": {
"wetty": "./bin/wetty.js" "wetty": "./bin/wetty.js"
}, },
"files": [
"bin",
"public"
],
"scripts": { "scripts": {
"lint": "eslint .", "lint": "eslint .",
"fix": "eslint . --fix", "lint:fix": "eslint . --fix",
"build": "grunt", "build": "grunt",
"start": "node app.js" "start": "node app.js"
} }

Loading…
Cancel
Save