cicd #4
124
env-file/appsettings.json
Normal file
124
env-file/appsettings.json
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
{
|
||||||
|
"ApplicationSetting": {
|
||||||
|
"SlowRunningThresholdMilliseconds": 3000,
|
||||||
|
"UploadTempPath": "data/upload/temp",
|
||||||
|
"UploadTemplatePath": "data/upload/templates",
|
||||||
|
"UploadMailMagazinePath": "data/upload/resources",
|
||||||
|
"ClientAppUrl": "https://example.com",
|
||||||
|
"UnsubscribePath": "unsubscribe"
|
||||||
|
},
|
||||||
|
"AuthSetting": {
|
||||||
|
"DefaultPassword": "AAAAAAAA",
|
||||||
|
"JwtPublicKey": "-----BEGIN PUBLIC KEY-----\nJwtPublicKey\n-----END PUBLIC KEY-----",
|
||||||
|
"JwtPrivateKey": "-----BEGIN PRIVATE KEY -----\nJwtPrivateKey\n-----END PRIVATE KEY-----",
|
||||||
|
"JwtIssuer": "https://identity.sothink.vn",
|
||||||
|
"JwtAudience": "cosmos-plan-crm,cosmos-plan-crm-api",
|
||||||
|
"JwtExpirationInMinutes": 3,
|
||||||
|
"JwtKeyId": "cosmos-plan-crm-api",
|
||||||
|
"RefreshTokenExpirationInMinutes": 60,
|
||||||
|
"RefreshTokenMaxUsage": 5,
|
||||||
|
"RefreshTokenCookieName": "RefreshTokenCookieName"
|
||||||
|
},
|
||||||
|
"AWS": {
|
||||||
|
"AccessKeyId": "",
|
||||||
|
"SecretAccessKey": "",
|
||||||
|
"Region": "",
|
||||||
|
"SESMailFrom": "noreply@example.com",
|
||||||
|
"SESMailServiceFrom": "noreply@example.com"
|
||||||
|
},
|
||||||
|
"DataProtection": {
|
||||||
|
"EncryptionKey": ""
|
||||||
|
},
|
||||||
|
"EventBus": {
|
||||||
|
"SesTopicName": "",
|
||||||
|
"TopicNamePrefix": ""
|
||||||
|
},
|
||||||
|
"CachingSetting": {
|
||||||
|
"Mode": "Memory",
|
||||||
|
"ModeDescription": "Support modes: [\"Memory\", \"Distributed\", \"Hybrid\"]",
|
||||||
|
"DefaultTtlInSeconds": 60,
|
||||||
|
"CachingDataTtlInSeconds": 300,
|
||||||
|
"DistributedConnectionString": "",
|
||||||
|
"DistributedDatabaseName": 0
|
||||||
|
},
|
||||||
|
"DatabaseSetting": {
|
||||||
|
"ConnectionString": "Host=${IP};Port=${PORT};Database=${DB_NAME};Username=${DB_USER};Password=${DATA_PASSWORD};Include Error Detail=true",
|
||||||
|
"BackgroundJobConnectionString": "Host=${IP};Port=${PORT};Database=${DB_NAME};Username=${DB_USER};Password=${DATA_PASSWORD};Include Error Detail=true",
|
||||||
|
"Schema": "${SCHEMA}",
|
||||||
|
"UseMigrations": false,
|
||||||
|
"UseSeedData": true
|
||||||
|
},
|
||||||
|
"OutboxMessageOptions": {
|
||||||
|
"IntervalInSeconds": 3,
|
||||||
|
"BatchSize": 10,
|
||||||
|
"RetryCount": 3
|
||||||
|
},
|
||||||
|
"Serilog": {
|
||||||
|
"Using": [
|
||||||
|
"Serilog.Sinks.Console",
|
||||||
|
"Serilog.Sinks.File",
|
||||||
|
"Serilog.Enrichers.ClientInfo"
|
||||||
|
],
|
||||||
|
"MinimumLevel": {
|
||||||
|
"Default": "Warning",
|
||||||
|
"Override": {
|
||||||
|
"MassTransit": "Information",
|
||||||
|
"Microsoft": "Information",
|
||||||
|
"Microsoft.EntityFrameworkCore": "Warning",
|
||||||
|
"Microsoft.EntityFrameworkCore.Database.Command": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "Console",
|
||||||
|
"Args": {
|
||||||
|
"formatter": "Serilog.Formatting.Compact.RenderedCompactJsonFormatter, Serilog.Formatting.Compact"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
|
"Args": {
|
||||||
|
"path": "logs/log-.json",
|
||||||
|
"rollingInterval": "Day",
|
||||||
|
"retainedFileCountLimit": 30,
|
||||||
|
"formatter": "Serilog.Formatting.Compact.RenderedCompactJsonFormatter, Serilog.Formatting.Compact"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Seq",
|
||||||
|
"Args": {
|
||||||
|
"ServerUrl": "http://localhost:5341"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Properties": {
|
||||||
|
"Application": "Cosmos Plan CRM API",
|
||||||
|
"Environment": "Production"
|
||||||
|
},
|
||||||
|
"Enrich": [
|
||||||
|
"FromLogContext",
|
||||||
|
"WithMachineName",
|
||||||
|
"WithThreadId",
|
||||||
|
"WithClientIp",
|
||||||
|
"WithCorrelationId",
|
||||||
|
{
|
||||||
|
"Name": "WithRequestHeader",
|
||||||
|
"Args": {
|
||||||
|
"headerName": "User-Agent"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Smtp": {
|
||||||
|
"Host": "",
|
||||||
|
"Port": 0,
|
||||||
|
"From": "",
|
||||||
|
"Username": "",
|
||||||
|
"Password": "",
|
||||||
|
"UseSsl": false
|
||||||
|
},
|
||||||
|
"Network": {
|
||||||
|
"KnownProxies": "103.205.208.186"
|
||||||
|
,"ForwardLimit": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
4
pods/crm-server.pod
Normal file
4
pods/crm-server.pod
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[Pod]
|
||||||
|
PublishPort=5000:8080
|
||||||
|
PublishPort=5431:8081
|
||||||
|
PublishPort=8081:80
|
||||||
@@ -5,25 +5,45 @@
|
|||||||
- name: Pull image from ECR for crm-client
|
- name: Pull image from ECR for crm-client
|
||||||
shell: >
|
shell: >
|
||||||
podman pull {{ aws_account_id }}.dkr.ecr.{{ aws_region }}.amazonaws.com/prod/crm-client:latest
|
podman pull {{ aws_account_id }}.dkr.ecr.{{ aws_region }}.amazonaws.com/prod/crm-client:latest
|
||||||
|
register: pulled_image_crm_client_result
|
||||||
|
|
||||||
- name: Pull image from ECR for crm-server
|
- name: Pull image from ECR for crm-server
|
||||||
containers.podman.podman_image:
|
shell: >
|
||||||
name: "{{ aws_account_id }}.dkr.ecr.{{ aws_region }}.amazonaws.com/prod/crm-server"
|
podman pull {{ aws_account_id }}.dkr.ecr.{{ aws_region }}.amazonaws.com/prod/crm-server:latest
|
||||||
state: present
|
|
||||||
register: pulled_image_crm_server_result
|
register: pulled_image_crm_server_result
|
||||||
|
|
||||||
- name: Copy crm-server.container file if image was pulled
|
|
||||||
|
- name: Copy crm-client.container file
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: containers/crm-client.container
|
||||||
|
dest: "{{ ansible_env.HOME }}/.config/containers/systemd/crm-client.container"
|
||||||
|
|
||||||
|
- name: Copy crm-server.container
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: containers/crm-server.container
|
src: containers/crm-server.container
|
||||||
dest: "{{ ansible_env.HOME }}/.config/containers/systemd/crm-server.container"
|
dest: "{{ ansible_env.HOME }}/.config/containers/systemd/crm-server.container"
|
||||||
when: pulled_image_crm_server_result.changed
|
|
||||||
register: copy_crm_server_container_file_result
|
|
||||||
|
|
||||||
- name: Restart crm-server systemd service if container file was copied
|
- name: Copy seq.container
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: containers/seq.container
|
||||||
|
dest: "{{ ansible_env.HOME }}/.config/containers/systemd/seq.container"
|
||||||
|
|
||||||
|
- name: Copy crm-server.pod
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: pods/crm-server.pod
|
||||||
|
dest: "{{ ansible_env.HOME }}/.config/containers/systemd/crm-server.pod"
|
||||||
|
|
||||||
|
- name: Restart crm-client systemd service
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: crm-server
|
name: crm-client
|
||||||
|
state: restarted
|
||||||
|
scope: user
|
||||||
|
daemon_reload: yes
|
||||||
|
|
||||||
|
- name: Restart crm-server systemd service
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: crm-server-pod
|
||||||
state: restarted
|
state: restarted
|
||||||
scope: user
|
scope: user
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
when: copy_crm_server_container_file_result.changed
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user