- UI component
- Folder structure
- Login
- Side bar
- header
- Microfrotend support
- Axios
- Redux -
npm install @reduxjs/toolkit react-redux --save - Slice
- Thunk
- Custom Theme selection
- -----
# [1]
npm create vite@latest host-app --template react-ts
cd host-app
npm install
npm run dev
npm install @originjs/vite-plugin-federation --save-dev
# [2]
npm create vite@latest micro-widget --template react-ts
cd micro-widget
npm install
npm run dev
npm install @originjs/vite-plugin-federation --save-dev
npm run build
npm run preview
# [3]
npm create vite@latest micro-ss-construction --template react-ts
cd micro-ss-construction
npm install
npm run dev
npm install @originjs/vite-plugin-federation --save-dev
npm run build
npm run preview
# [4]
npm create vite@latest micro-posterica --template react-ts
cd micro-posterica
npm install
npm run dev
npm install @originjs/vite-plugin-federation --save-dev
npm run build
npm run preview
import { defineConfig } from 'vite'
import federation from '@originjs/vite-plugin-federation'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
federation({
name: "micro-widget", // Does not matter for import as microfrontend
filename: "remoteEntry.js",
exposes: {
"./Widget": "./src/App",
},
shared: ["react", "react-dom"],
})
],
build: {
modulePreload: false,
target: "esnext",
minify: false,
cssCodeSplit: false,
},
})import { defineConfig } from 'vite'
import federation from '@originjs/vite-plugin-federation'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
federation({
name: "app",
remotes: {
// Module name is used to import app in modules
microWidget: "http://localhost:4173/assets/remoteEntry.js"
},
shared: ["react", "react-dom"]
})
],
})docker compose up --build
docker build -t micro-furniture .
docker run -p 3001:80 micro-furniture
chmod 400 /Users/alpitg/Downloads/sites-vm_key.pem
ssh -i /Users/alpitg/Downloads/sites-vm_key.pem azureuser@135.235.196.64
chmod 400 /Users/alpitg/Downloads/microservice-vm_key.pem
ssh -i /Users/alpitg/Downloads/microservice-vm_key.pem azureuser@74.225.250.126
df -h
docker system df
docker system prune -a
docker builder prune -a
df -hsudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx \
-d artisanstudio.centralindia.cloudapp.azure.com
sudo certbot renew --dry-run
- Find your active Nginx site file Run:
sudo nginx -T | grep -B2 -A5 "listen 80"or list enabled sites:
ls -l /etc/nginx/sites-enabled/- Edit your Nginx site configuration For example:
sudo nano /etc/nginx/sites-enabled/default(or whichever file you found) Make sure your HTTP server block looks like this:
server {
listen 80;
listen [::]:80;
server_name artisanstudios.in www.artisanstudios.in;
# Python API
location /api/ {
proxy_pass http://127.0.0.1:8000/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header X-Forwarded-Prefix /api;
}
# Frontend
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Save the file.
view the file
sudo cat /etc/nginx/sites-enabled/default- Test and reload Nginx
sudo nginx -t
sudo systemctl reload nginx
- Install the already-created certificate Now run:
sudo certbot install --cert-name artisanstudio.centralindia.cloudapp.azure.comCertbot should now find the matching server block and add:
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/artisanstudio.centralindia.cloudapp.azure.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/artisanstudio.centralindia.cloudapp.azure.com/privkey.pem;- Verify HTTPS
sudo ss -tulpn | grep :443Then:
curl -Ik https://artisanstudio.centralindia.cloudapp.azure.comIf you paste the output of:
sudo nginx -T | grep -E "server_name|listen"I can tell you exactly which Nginx file needs editing.
- Create certificate - Generate and install the certificate
sudo apt update
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d artisanstudios.in -d www.artisanstudios.in
- Update nginx file
sudo nano /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl reload nginx
sudo apt-get update
sudo apt-get install -y jqdocker volume create mongodb_data
docker volume ls
docker run -d \
--name mongodb \
--memory=512m \
-p 27017:27017 \
-v mongodb_data:/data/db \
-e MONGO_INITDB_ROOT_USERNAME=admin \
-e MONGO_INITDB_ROOT_PASSWORD=YourStrongPassword \
--restart always \
mongo:7
docker ps
docker logs mongodb
docker network create app-network
docker network connect app-network mongodb
docker rm mongodb
docker run -d \
--name mongodb \
-p 27017:27017 \
-v mongodb_data:/data/db \
-e MONGO_INITDB_ROOT_USERNAME=admin \
-e MONGO_INITDB_ROOT_PASSWORD=YourStrongPassword \
mongo:7
https://domain.com | | nginx |
| | /api / | | FastAPI React