Server/Backend Setup
Note: Make sure Java and Maven are already installed. Only install java 8. There's still an issue with java 9 and Spring Boot if I'm not mistaken.
List of microservices repos needed / Prod branch / Port / URL
auth-client
Branch: master
Port: 7040
URL: https://api.devkinetics.com/v1/auth
auth-server
Branch: feature
Port: 7050
cdn-ticketdeals
Branch: master
Port: 9050
URL: https://dl.enablr.co
cloud-config
Branch: master
This repo only contains the application yml files being used by config-server. There's no need to clone this on the server.
config-server
Branch: master
Port: 7000
ticket-client
Branch: feature-multiprice
Port: 6050
URL: https://api.devkinetics.com/v1/tickets
ticket-webservice
Branch: feature-multiprice
Port: 8050
webservice-gateway
Branch: feature
Port: 7001
URL: https://api.devkinetics.com
webservice-registry
Branch: feature
Port: 7002
zipkin-server
Branch: feature
Port: 9411
Clone all repos to a single directory. E.g. /repositories
sudo mkdir /repositories
cd /repositories
git clone -b <branch> <repo_address>
E.g. git clone -b feature git@bitbucket.org:devkinetics/<repo_name>.git
Create and update the needed folders
mkdir -p /var/www/images/testing/qrcode
For testing??
mkdir -p /var/www/images/qrcode
mkdir -p /var/www/filemgr/tickets
mkdir -p /var/log/spring/microservices
mkdir -p /var/microservices
chmod 777 /var/log/spring
chmod 777 /var/www/filemgr/tickets
chmod 777 /var/www/images/qrcode
chmod 777 /var/microservices
Note: You may need to use sudo to apply these changes.
Change config-server path in repo's bootstrap yml file and build the jar files.
Go to the repo's directory.
cd /repositories/<repo_name>
sed -i 's/config-server:7000/localhost:7000/g' src/main/resources/bootstrap.yml
mvn clean package -DskipTests=true
This will build the jar file that will be located in target foler.
sudo cp target/<repo_name>-2.0.0.jar /var/microservices/
All of our microservices jar files will be in /var/microservices
Note:
You will need to do this on every repo listed above except cloud-config.
This is needed since we're not using docker at the moment.
Now, we're going to use init.d to start/deploy our microservice/app.
cd /etc/init.d
sudo touch <service_name>
sudo chmod 755 <service_name>
sudo nano <service_name>
See the init.d sample content.
https://bitbucket.org/devkinetics/dk-microservices-init.d
You can copy and paste the init.d scripts from the repo above and change it if necessary.
sudo update-rc.d <service_name> defaults
E.g. sudo update-rc.d ticket-webservice defaults
sudo service <service_name> start
E.g. sudo service ticket-webservice start
Microservices start sequence
config-server
zipkin-server
webservice-registry
webservice-gateway
auth-client
auth-server
cdn-ticketdeals
ticket-client
ticket-webservice
Note: The first 4 services are the most important start/restart sequence.
Don't forget to setup and configure the DNS and Let's Encrypt for the microservices.
https://api.devkinetics.com
https://dl.enablr.co
Dragonpay Postback Setup
Note: Login using root account to deploy the commands below.
Install the following:
Node.js v8.x
See https://sites.google.com/site/devkinetics/knowledge-base/node-js .
Yarn
Run sudo npm i -g yarn
PM2
Run sudo npm i -g pm2
Clone the repo to /repositories
git clone git@bitbucket.org:devkinetics/dragonpay-postback.git
cd dragonpay-postback
sed -i 's/localhost/23.92.53.115/g' .env
sed -i 's/postgres/devkinetics/g' .env
sed -i 's/admin123/<put_db_password_here>/g' .env
sed -i 's/local/prod/g' .env
npm install
npm run webpack:min
sudo mkdir -p /opt/.pm2/dragonpay-postback/logs/
sudo chmod 777 /opt/.pm2/**/*
pm2 start deploy/pm2-unix-non-docker.json --only dragonpay-postback --env production
This will run the app on port 8055.
Configure DNS and Let's Encrypt
https://api.enablr.co
Note: Only set to DNS only since the app needs to check the IP of the caller.
Frontend Setup
Note: Login using root account to deploy the commands below.
Install the following:
Node.js v8.x
See https://sites.google.com/site/devkinetics/knowledge-base/node-js .
Yarn
Run sudo npm i -g yarn
PM2
Run sudo npm i -g pm2
Clone the repo to /repositories
git clone -b feature git@bitbucket.org:mikaelvg/ticketing-system.git
Create the log folders
sudo mkdir -p /opt/.pm2/ticketing-client-web/logs/
sudo mkdir -p /opt/.pm2/ticketing-admin-web/logs/
sudo chmod 777 /opt/.pm2/**/*
There are two frontend apps/folders inside this repo
client-web - the public site
admin-web - the admin site
Run the following with both:
cd <app_name>
chmod +x deploy_prod_linux.sh
./deploy_prod_linux.sh
Configure DNS and Let's Encrypt
https://tickets.splashisland.ph
Port: 5010
This is for the client-web
https://admin.splashisland.ph
Port: 5020
This is for the admin-web