File tree 3 files changed +57
-3
lines changed
3 files changed +57
-3
lines changed Original file line number Diff line number Diff line change 1
1
bin /
2
2
obj /
3
3
* .db
4
+ Publish /
4
5
/packages /
5
6
riderModule.iml
6
7
/_ReSharper.Caches /
Original file line number Diff line number Diff line change @@ -190,6 +190,8 @@ This blog also offers an RSS feed ([RSS 2.0 specification](https://validator.w3.
190
190
191
191
## Host Web in Docker containers
192
192
193
+ ### https http port and CA certificate
194
+
193
195
To deploy with docker, you need to modify the variables in the docker-compose.yml file.
194
196
``` yml
195
197
volumes :
@@ -203,4 +205,30 @@ volumes:
203
205
- ASPNETCORE_Kestrel__Certificates__Default__Path=/app/aspnetapp.pfx
204
206
- ASPNETCORE_ENVIRONMENT=Production
205
207
` ` `
206
- After modifying the settings, you can use the docker command ` docker compose up -d`.
208
+ After modifying the settings, you can use the docker command ` docker compose up -d`
209
+ Deploy the web.
210
+ If you don't use HTTPS, you can remove the related options.
211
+
212
+ # ## Sql Server
213
+
214
+ If you use Sql Server, you can add a sql server in `docker-compose.yml`.
215
+ ` ` ` yml
216
+ sql:
217
+ image: mcr.microsoft.com/mssql/server:2022-latest
218
+ container_name: sql
219
+ expose:
220
+ - 1433 #you can use other ports
221
+ volumes:
222
+ - sqlvolume:/var/opt/mssql
223
+ environment:
224
+ - ACCEPT_EULA=Y
225
+ - MSSQL_SA_PASSWORD= #your sql password
226
+ networks:
227
+ - web_net
228
+ volumes: # creates a shared data volume named sqlvolume if you use sqlserver
229
+ sqlvolume:
230
+ ` ` `
231
+ Note the ConnectionString format of Sql Server needs to be consistent :
232
+ ` ` `
233
+ "ConnectionString": "Data Source=sql;Initial Catalog =master;User ID =sa;Password=<YOURPASSWORD>;TrustServerCertificate=True;MultiSubnetFailover=True"
234
+ ` ` `
Original file line number Diff line number Diff line change @@ -6,13 +6,38 @@ services:
6
6
ports :
7
7
- 80:80
8
8
- 443:443
9
+ restart : always
9
10
volumes :
11
+ - ./src/LinkDotNet.Blog.Web/appsettings.json:/app/appsettings.json
10
12
- /root/.aspnet/DataProtection-Keys:/root/.aspnet/DataProtection-Keys
11
13
- ./Blog.db:/app/Blog.db # Sqlite datebase
12
14
- /root/aspnetapp.pfx:/app/aspnetapp.pfx # ssl certificate
13
15
environment :
14
16
- ASPNETCORE_URLS=http://+:80;https://+:443
15
- - ASPNETCORE_HTTPS_PORT=80
17
+ - ASPNETCORE_HTTPS_PORT=443
16
18
- ASPNETCORE_Kestrel__Certificates__Default__Password= # Your certificate password
17
19
- ASPNETCORE_Kestrel__Certificates__Default__Path=/app/aspnetapp.pfx
18
- - ASPNETCORE_ENVIRONMENT=Production
20
+ - ASPNETCORE_ENVIRONMENT=Production
21
+ networks :
22
+ - web_net
23
+ # #####################################
24
+ depends_on :
25
+ - sql
26
+ sql : # if you use SqlServer
27
+ image : mcr.microsoft.com/mssql/server:2022-latest
28
+ container_name : sql
29
+ expose :
30
+ - 1433
31
+ restart : always
32
+ volumes :
33
+ - sqlvolume:/var/opt/mssql
34
+ environment :
35
+ - ACCEPT_EULA=Y
36
+ - MSSQL_SA_PASSWORD= # your sql password
37
+ networks :
38
+ - web_net
39
+ volumes : # creates a shared data volume named sqlvolume if you use sqlserver
40
+ sqlvolume :
41
+ # ##########################################
42
+ networks :
43
+ web_net :
You can’t perform that action at this time.
0 commit comments