# svsbank-cli
> Services di Bukalapak udah banyak, kalau mau develop lama di installingnya.
> Kalau ada tools yang bisa buat ng-install services dengan mudah kan enak.

# requirement!
* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)  - Harus sudah install git dan setup ssh di github;
* [Node](https://github.com/creationix/nvm)  - Harus sudah install node & npm (v8.11.3 & 5.6.0). Install Node with [NVM](https://github.com/creationix/nvm) is recomended:
( if node was not installed with NVM, we need to use sudo everytime -g install )

Setup git configs:
- Run `git config --global user.name "Your Name Here"`
- Run `git config --global user.email "your-github-email@example.com"`

Setup SSH:
- Run `ssh-keygen`
- Run `gedit ~/.ssh/id_rsa.pub`
- add ssh to github

# how to use!

To install (add) service:
  - Run `npm install -g svsbank-cli`
  - Run `svsbank-cli add`
  - Select services to be installed

# note on installing:
  - You may need to enter password for sudo command (might need to input multiple times)
  - ...

NB: On Mothership Installer
  - If asked mysql password, the answer is `rootpw` (might need to input multiple times)
  - ...

# infos:
Install directories:
```bash

~/.svsbank_profile [for all paths setting used in the process]

~/ [for go services]
.
+-- /go/
|   +-- bin/
|   +-- pkg/
|   +-- src/
|       +-- github.com/
|           +-- bukalapak/
|               +-- /aleppo/[PROJECT]
|               +-- /attache/[PROJECT]
|               +-- /imagery-s3/[PROJECT]

~/ [for non go services]
.
+-- /svsbank/
|   +-- mothership/[PROJECT]
|   +-- grimoire/[PROJECT]
|   +-- olympus/[PROJECT]
|   +-- pogchamp/[PROJECT]
|   +-- shinkansen/[PROJECT]
|   +-- docker-compose.yml
|   +-- .env
```

Automated Flows:
  1. check if git installed, if none (quit process)
  2. check & install docker on local machine (if none)
  3. check & install docker compose on local machine (if none)
  4. check & create svsbank directory (if none)
        1. do svsbank directory
        2. check & install go (if none) (run only if go service needed)
        3. need to prepare go workspace beforehand here (run only if go service needed)
  5. remove svsbank/docker-compose.yml
  6. run installation for selected services
        1. check & remove directory (svsbank/[service]) (if any)
        2. clone repo from github (ssh will be used, go services will be cloned to go-workspace)
        3. building docker image
        4. append docker compose & env config
        5. overwrite compose and env config to svsbank path
        6. run installation shell script (if any)

Shell Scripts Rules:
  - ...

Composes Rules:
  - ...


# on dev pipeline (TODOs):
- Mothership mac installer
- Aleppo linux installer
- Aleppo mac installer

# tested on:
- Ubuntu 16.04.5 LTS (xenial)
