# Kelvin Devops ## The example Woocommerce website for generating installer - Domain: https://gopig.xyz - Admin user: admin/123456 ## How to export the current runing Woocommerce website to installer 1. Go to installer `/root/repository` 2. Run `bash wpexample-code.sh` 3. The new installer already for download: https://gopig.xyz/downloads/wordpress-allinone.zip, you can see all versions before at: https://gopig.xyz/downloads ## How to install a new Woocommerce website 1. SSH to the new vps 2. Install dependencies: - centos: `yum install unzip zip curl` - ubuntu: `sudo apt-get install -y unzip zip curl` 3. ```curl -O -k https://gopig.xyz/downloads/wordpress-allinone.zip && unzip wordpress-allinone.zip -d installer``` 4. `cd installer` 5. Copy `config.example.ini` to `config.ini` 6. Modify `config.ini`: - Database information: `WP_DB` `WP_USER` `WP_PW` - Website domain: `WP_DOMAIN` - Proxy ports: `NGINX_HTTP_PORT`, `NGINX_HTTPS_PORT` (default value will be fine) - Deploy directory: `DEPLOY_DIR` 6.1: Configurations for `setup-letsencrypt.sh` Using Let's Encrypt Certificate Authority - `SSL_MODE`: * `1`: Staging mode, recommend at the first time run script for testing purpose * `0`: Production mode. After staging mode succesffully using this value 6.2: Configurations for `setup-pre-ssl.sh` Use this script if you has SSL certificate files, or runing without SSL - `SSL_CERT`: the SSL certificate file (.cert or fullchain.pem) - `SSL_KEY`: the SSL private key file (.key or privkey.pem) 7. Run one of setup script file base on the configurations above - `./setup-letsencrypt.sh` - `./setup-pre-ssl.sh` ## Update code for stores 1. `ssh root@gopig.xyz` 2. `cd repository` 3. Add new vps `url` (or `ip`) to `vps.txt` file, one line for one vps, make sure SSH public key was added to vps. To get SSH public key from example site, run `cat ~/.ssh/id_rsa.pub`, copy it then ssh to new vps via `ssh root@[vps]` and run `nano ~/.ssh/authorized_keys` (if `.ssh` directory does not exist, just run `mkdir .ssh`) and paste copied ssh public key to it 4. Run `bash update-code.sh` ## Deploy Hub 1. `ssh root@marvel-hub.com` 2. `su - kelvin` 3. `cd scripts` ### Backend - `./deploy-backend.sh` ### Frontend - `./deploy-dashboard.sh`