Steps deploy shopizer project with container:
1. Setup backend:
Note: account của Đăng đổi các version từ 1.0.1 -> 1.0.2
install docker for ubuntu
docker pull ht04/shopizer-service:1.0.1
docker image ls
docker run -d -p 8080:8080 --restart always ht04/shopizer-service:1.0.1
2. Setup admin:
install docker for ubuntu
sudo systemctl enable docker
docker pull ht04/shopizer-admin:1.0.1
docker image ls
docker run -d --restart always -e "APP_BASE_URL=http:///f-alb-be-1777158846.us-east-1.elb.amazonaws.com:8080/api" -p 82:80 ht04/shopizer-admin:1.0.1
docker ps
3. Setup frontend:
install docker for ubuntu
docker pull ht04/shopizer-shop:1.0.1
docker image ls
docker run -d --restart always -e "APP_MERCHANT=DEFAULT" -e "APP_BASE_URL=http://f-alb-be-1777158846.us-east-1.elb.amazonaws.com:8080" -p 80:80 ht04/shopizer-shop:1.0.1
+ Note:
database.properties:
##
## db config
##
#Need to run these commands before running shopizer - choose your username and password
#mysql>CREATE DATABASE SALESMANAGER;
#mysql>CREATE USER shopizer IDENTIFIED BY 'shopizer';
#mysql>GRANT ALL ON SALESMANAGER.* TO shopizer;
#mysql>FLUSH PRIVILEGES;
db.jdbcUrl=jdbc:mysql://172.20.7.47:3306/SALESMANAGER?autoReconnect=true&serverTimeZone=UTC&useUnicode=true&characterEncoding=UTF-8
db.user=shopizer
db.password=shopizer
db.driverClass=com.mysql.cj.jdbc.Driver
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
db.show.sql=true
db.preferredTestQuery=SELECT 1
db.schema=SALESMANAGER
hibernate.hbm2ddl.auto=update
##
## configuration pooling base de donn\uFFFDes
##
db.initialPoolSize=8
db.minPoolSize=8
db.maxPoolSize=15
Install mysql: https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-22-04
Config access remote for database:
https://www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql
Setup monitoring
1. Frontend:
sudo mkdir -p /var/log/nginx
docker run -d --restart always \
-e "APP_MERCHANT=DEFAULT" \
-e "APP_BASE_URL=http://f-alb-be-1777158846.us-east-1.elb.amazonaws.com:8080" \
-p 80:80 \
-v /var/log/nginx:/var/log/nginx \
ht04/shopizer-shop:1.0.1
sudo wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c ssm:AmazonCloudWatch-linux
2. Admin:
sudo mkdir -p /var/log/nginx
docker run -d --restart always -e "APP_BASE_URL=http:///f-alb-be-1777158846.us-east-1.elb.amazonaws.com:8080/api" -p 82:80 -v /var/log/nginx:/var/log/nginx ht04/shopizer-admin:1.0.1
sudo wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c ssm:AmazonCloudWatch-linux-admin