Go to file
2020-07-14 20:27:07 +10:00
app Fixed database_stg.php 2020-07-14 17:31:23 +10:00
cake Revert "Try to fix auth with secure cookie" 2019-03-14 16:19:41 +11:00
conf Increase execution time on php.ini 2019-07-11 16:59:59 +10:00
sql Added signature_required migration to oa 2016-04-30 16:51:30 +10:00
vendors Reworked repo structure. added cake 1.2 2013-03-23 16:25:52 +11:00
.gitignore Added database.php config to help with auto deploys 2015-05-31 23:40:13 +10:00
.gitlab-ci.yml Add staging passwords 2020-07-14 20:27:07 +10:00
.htaccess Turned off error reporting 2013-03-25 22:26:48 +11:00
backup.sh Trying to make staging a thing 2020-07-14 16:00:05 +10:00
build_docker.sh Add scripts to make docker easier 2018-12-16 14:23:18 +11:00
build_docker_stg.sh More staging fun 2020-07-14 17:24:53 +10:00
deploy.sh Add scripts to make docker easier 2018-12-16 14:23:18 +11:00
Dockerfile Update README.md and some other changes 2019-12-18 15:06:53 +11:00
Dockerfile_stg Trying to make staging a thing 2020-07-14 16:00:05 +10:00
enter_docker.sh Add scripts to make docker easier 2018-12-16 14:23:18 +11:00
fetch_latest_sql.sh Add fetch_latest_sql.sh 2019-01-26 13:14:18 +11:00
index.php Reworked repo structure. added cake 1.2 2013-03-23 16:25:52 +11:00
MIGRATION.md Bump PHP memory_limit to fix Quote edit page 2019-07-02 13:25:09 +10:00
README.md Update README.md and some other changes 2019-12-18 15:06:53 +11:00
run_docker_local.sh Staging 2020-07-14 16:19:21 +10:00
run_docker_prd.sh Staging 2020-07-14 16:19:21 +10:00
run_docker_stg.sh Staging 2020-07-14 16:19:21 +10:00
run_vault.sh run vault as www-data user to fix permission problems 2019-07-04 21:13:28 +10:00
stagingpasswd Add staging passwords 2020-07-14 20:27:07 +10:00
userpasswd Add generated passwords 2019-06-29 17:56:13 +10:00
vault_cron.sh Make vault_cron.sh executable 2019-07-08 15:16:04 +10:00

cmc-sales

Install

Requirements

Debian or Ubuntu OS. These instructions written for Debian 9.9

Assumed pre-work:

Create a new VM with hostname newserver.cmctechnologies.com.au Configure DNS appropriately. cmctechnologies.com.au zones is currently managed in Google Cloud DNS on Karl's account: https://console.cloud.google.com/net-services/dns/zones/cmctechnologies?project=cmc-technologies&authuser=1&folder&organizationId

Will need to migrate that to CMC's GSuite account at some point.

  1. Install ansible on your workstation
apt-get install ansible
  1. Clone the playbooks
git clone git@gitlab.com:minimalist.software/cmc-playbooks.git
  1. Execute the playbooks

The nginx config expects the site to be available at sales.cmctechnologies.com.au.

You'll need to add the hostname to config/nginx-site, if this isn't sales.cmctechnologies.com.au

cd cmc-playbooks
# Add the hostname of your new server to the inventory.txt
ansible-playbook -i inventory.txt setup.yml
  1. SSH to the new server and configure gitlab-runner
ssh newserver.cmctechnologies.com.au
sudo gitlab-runner register
  1. SSH to the new server as cmc user
ssh cmc@newserver.cmctechnologies.com.au
  1. Add the SSH key to the cmc-sales repo on gitlab as a deploy key https://gitlab.com/minimalist.software/cmc-sales/-/settings/repository
cmc@cmc:~$ cat .ssh/id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFIdoWVp2pGDb46ubW6jkfIpREMa/veD6xZVAtnj3WG1sX7NEUlQYq3RKbZ5CThlw6GKMSYoIsIqk7p6zSoJHGlJSLxoJ0edKflciMUFMTQrdm4T1USXsK+gd0C4DUCyVkYFOs37sy+JtziymnBTm7iOeVI3aMxwfoCOs6mNiD0ettjJT6WtVyy0ZTb6yU4uz7CHj1IGsvwsoKJWPGwJrZ/MfByNl6aJ8R/8zDwbtP06owKD4b3ZPgakM3nYRRoKzHZ/SClz50SXMKC4/nmFY9wLuuMhCWK+9x4/4VPSnxXESOlENMfUoa1IY4osAnZCtaFrWDyenJ+spZrNfgcscD ansible-generated on cmc
  1. Clone the cmc-sales repo
git clone git@gitlab.com:minimalist.software/cmc-sales.git
  1. As root on new server configure mySQL user cmc Note: get password from app/config/database.php (or set a new one and change it)
# mysql -u root
CREATE USER 'cmc'@'localhost' IDENTIFIED BY 'password';
CREATE USER 'cmc'@'172.17.0.2' IDENTIFIED BY 'password';
CREATE database cmc;
GRANT ALL PRIVILEGES ON cmc.* TO 'cmc'@'localhost';
GRANT ALL PRIVILEGES ON cmc.* TO 'cmc'@'172.17.0.2';
  1. Get the latest backup from Google Drive

In the shared google drive: eg. backups/database/backup_20191217_21001.sql.gz

Copy up to the new server:

rsync backup_*.gz root@newserver:~/

  1. Restore backup to cmc database
zcat backup_* | mysql -u cmc -p
  1. Redeploy from Gitlab https://gitlab.com/minimalist.software/cmc-sales/pipelines/new

  2. You should have a new installation of cmc-sales.