A proof-of-concept for deploying spring-cloud solution via ansible
This demo will deploy the spring-cloud sample project at https://github.com/chen0040/spring-erp-clients at a single computer, which is specified as the development environment in the devops/ansible/erp.inventory.development. To deploy the solution across multiple computers or deploy it on a production environment, simply update the erp.inventory.development or erp.inventory.production
The ansible solution assumes that you are using linux operating system (in particular CentOS), if you are using Windows, you can cd to the project root directory and run the following environment to create a CentOS vm (at 192.168.10.13 as specified by Vagrant.config.yml) using Vagrant:
vagrant up
Once you have the CentOS system, you must ensure that the machine has Java 8 and Ansible installed. If not, you can run the following script to install these tools:
devops/sbin/env_setup.sh
Once git clone this project on the CentOS environment or started a CentOS Vagrant VM on Windows, cd to the project root folder and run the following command to start installing the spring-cloud cluster jars:
cd devops/ansible
ansible-playbook install-erp.yml -u root -i erp.inventory.development
Now to start the spring-cloud cluster, run the following command:
cd devops/ansible
ansible-playbook start-erp.yml -u root -i erp.inventory.development
At this point, the spring cluster will be running with the following micro-services:
- spring-erp-vendor: http://localhost:9024
- spring-erp-buyer: http://localhost:9020
- spring-erp-admin: http://localhost:9028
- spring-erp-scala: http://localhost:9022
- spring-erp-syslog4j-server: http://localhost:6088
- spring-eureka-server: http://localhost:8761
To test whether the system is running,run the following command:
curl http://localhost:9020/greetings
You can also test whether the system is running by starting the angular server using the following command:
sudo yum install -y nodejs
sudo npm install -g @angular/cli
cd devops/ng4-erp
npm install
ng serve --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --port 8080
This time navigate to http://localhost:8080 in your host computer's web browser
By the way, if you are using a Vagrant CentOS on Windows, then the last line of command should become:
ng serve --proxy-config proxy.conf.vagrant.json --host 192.168.10.13 --disable-host-check --port 8080
This time navigate to http://192.168.10.13:8080 in your host computer's web browser
To stop the spring-cloud cluster,run the following command:
cd devops/ansible
ansible-playbook stop-erp.yml -u root -i erp.inventory.development