Deployment on IIS
อัพเดทคอนฟิกให้เป็นของ Production
เพื่อให้เห็นภาพมากยิ่งขึ้น ขอกำหนดตัวอย่าง Url สำหรับเว็บแอพฯ และเว็บเซอร์วิสดังนี้
- เว็บแอพฯ: https://appserver2.cdg.co.th/demo
- เว็บเซอร์วิส: https://appserver2.cdg.co.th/demo-service
- API Gateway: https://appserver2.cdg.co.th/demo-gateway
การตั้งค่า Front-end
ปรับแก้ค่าของ webServiceUrl และ callbackUri ตามตัวอย่างคอนฟิกด้านล่างนี้
File: environments/environment.prod.ts
import { AxAuthenticationConfig } from '@atlasx/core/authentication'
import { ApplicationConfig } from '../app/core/config/application.config'
export const environment: ApplicationConfig & AxAuthenticationConfig = {
production: true,
webServiceUrl: 'https://appserver2.cdg.co.th/demo-service', // <<< Edit url
// OAuth client information.
clientId: 'random-some-text-ajskdlf;',
clientSecret: '02FZf68/Xff0hrSQgc7Je5CNgdjaSgltNU4gb3AbJ9A=',
// When use full secure authentication, application are required
// the callbackUri property.
fullSecureAuthentication: true,
callbackUri: 'https://appserver2.cdg.co.th/demo/callback', // <<< Edit url
// If not use full secure authentication, application are required
// the loginUri property.
// fullSecureAuthentication: false,
// loginUri: 'https://atlasx.cdg.co.th/axwa-demo/login'
}บิวต์แอพฯ และนำไปติดตั้งบน IIS
ก่อนที่เราจะทำการ Build และนำไป Deploy ต้องการการ ติดตั้ง .NET Core Hosting Bundle บนเครื่องเว็บเซิร์ฟเวอร์ก่อน กรณีติดตั้งบนเครื่องเซิร์ฟเวอร์กลางจะติดตั้งมาให้เรียบร้อย ไม่จำเป็นต้องดำเนินการขั้นตอนนี้ จากนั้นทำการสร้างแอพบน IIS ให้เรียบร้อย แล้วทำการ Build โค้ดเพื่อนำไป Deploy ตามขั้นตอนดังต่อไปนี้
- Build front-end ด้วยคำสั่ง
npx ng build --prod --base-href="/demo/" --output-path="..\dist"- นำโค้ดที่ได้จากการ Build ในโฟล์เดอร์
distทั้งหมดไปวางไว้ในโฟล์เดอร์ที่เราเตรียมไว้บนเว็บเซิร์ฟเวอร์ - เปิดเว็บบราวเซอร์แล้วเข้าไปที่ https://appserver2.cdg.co.th/demo จากนั้นทดลองเล่นเว็บแอพฯ ของเราว่าสามารถทำงานได้ตามปกติหรือไม่