(Grav GitSync) Automatic Commit from tanshu

This commit is contained in:
tanshu 2017-11-23 05:57:41 +00:00 committed by GitSync
parent eb7b837d10
commit c8b71264e7

View File

@ -3,12 +3,16 @@ title: Bitwarden
--- ---
### 1. Prepare the environment ### 1. Prepare the environment
#### Create custom webapp called `warden` in the control panel 1.1 Create custom webapp called `warden` in the control panel
#### Configure Ruby 2.4 by editing `~/.bash_aliases` and adding these aliases 1.2 Configure Ruby 2.4 by editing `~/.bash_aliases` and adding these aliases
```sh ```sh
alias ruby=ruby2.4 alias ruby=ruby2.4
alias gem=gem2.4 alias gem=gem2.4
``` ```
1.3 Install the bundle gem
```sh
gem install bundle
```
### 2. Install Bitwarden Ruby into the directory ### 2. Install Bitwarden Ruby into the directory
```sh ```sh
cd ~/webapps cd ~/webapps
@ -16,4 +20,14 @@ clone https://github.com/jcs/bitwarden-ruby.git warden
cd warden cd warden
bundle install bundle install
``` ```
### 3. Start / Stop / Restart and Cron scripts ### 3. Start / Stop / Restart and Cron scripts
3.1 `Start` script where `$PORT` is the port of the custom webapp
```sh
#!/bin/sh
pgrep -f "ruby2.4 /home/tanshu/gems/bin/rackup -p $PORT config.ru" > /dev/null 2>&1 && exit 0
mkdir -p /home/tanshu/webapps/warden/run
cd /home/tanshu/webapps/warden
nohup env RACK_ENV=production bundle exec rackup -p $PORT config.ru > /dev/null 2>&1 &
sleep 3
pgrep -f "ruby2.4 /home/tanshu/gems/bin/rackup -p $PORT config.ru" > /home/tanshu/webapps/warden/run/ruby.pid
```