Commit 6285fdaa authored by Ai-Sasit's avatar Ai-Sasit

fix

parent 8031c7cd
...@@ -8,7 +8,4 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt ...@@ -8,7 +8,4 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY ./server /code/server COPY ./server /code/server
# COPY key.pem /code CMD ["uvicorn", "server.core:app", "--host", "0.0.0.0"]
# COPY cert.pem /code
CMD ["uvicorn", "server.core:app", "--host", "0.0.0.0", "--port", "80"]
-----BEGIN CERTIFICATE-----
MIIEZjCCAs6gAwIBAgIRAOkAp8lYhzHfxivVTgxnUNswDQYJKoZIhvcNAQELBQAw
gZExHjAcBgNVBAoTFW1rY2VydCBkZXZlbG9wbWVudCBDQTEzMDEGA1UECwwqQUkt
U0FTSVRcc2FzaXRAQWktU2FzaXQgKFNhc2l0IFdpcmF0amluZGEpMTowOAYDVQQD
DDFta2NlcnQgQUktU0FTSVRcc2FzaXRAQWktU2FzaXQgKFNhc2l0IFdpcmF0amlu
ZGEpMB4XDTIyMTEyNDExMzczNloXDTI1MDIyNDExMzczNlowXjEnMCUGA1UEChMe
bWtjZXJ0IGRldmVsb3BtZW50IGNlcnRpZmljYXRlMTMwMQYDVQQLDCpBSS1TQVNJ
VFxzYXNpdEBBaS1TYXNpdCAoU2FzaXQgV2lyYXRqaW5kYSkwggEiMA0GCSqGSIb3
DQEBAQUAA4IBDwAwggEKAoIBAQC5AJdecevyMdXtNFPBxl6koNO+hItfQbjDwRIR
fjSFWBiDDpfZHmQUe3a0EBCq4FLz+M/boPU2JtrBNJFWag7KOvD4Si2UlY7jTECa
05i2CybNWNej+qUc3o1t4nNnTFYpRJNf1kD0erJFHfha3RRLIaTBqItU8SuSeBSF
x0YGLrxfiAEl8CcsCxq+Mo3KjZwUcq7wJIEfHzrK8+Vgr9nzNChljmMaIBtU1b3l
rTvvCEdNRcCzmtVSgdcLs8s0e14q9ciJx4lIumjw8lfbTb1v/HozbmjsomabB0AD
MdLBIxTUd7vc8BgadkHguxH3rxcnMI3SU+GJe3NjV4jQgVgBAgMBAAGjazBpMA4G
A1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAfBgNVHSMEGDAWgBRz
iUD93sMUYLDn4j4sDGbfaaQVejAhBgNVHREEGjAYhwQN1HUUhxAAAAAAAAAAAAAA
AAAAAAABMA0GCSqGSIb3DQEBCwUAA4IBgQDA7B+UijCha3eK8GKIhSp/4rNFGh2V
BCX0TVIZdNPYiGJJzVepKEfypWhQF6G6mAqtaXtpYLQaUQJnivb3UNLqx4BI0S+r
hJyTzQO8Ave0YEgc7QYZ/5l+JQYAKX6AyLreYr3FO5NGV0vYUM/reg1f0nls/YZE
NcqjKSDgJWqbdlcLNJWtcquEXuS4kPtbs5pAyW4bqm0RlK4ENw7cE+hevuFAo0Sx
C6CSMNsGNbZPrQAZimSlL7NxbTKKDDce4k+ao5dsCxJxklfUgaDSc2Mp2SVnaW3z
k+lRosFjjnasfGx6Z0UwT8rNpcNx+zLW6kFmNzG2Tg/lF5AnuUGagN2syxDm9Apo
BE1JT1Rhg9yu1uIluqkkDoX+iHR5+v1Kp1CGtTmXy4yAfzSprFYVrxIw7Mbf9rI2
uJ7qBIxmaI+APGwTVBONsHvNUj6Qh9TmnRgFUURnOtCMy42hX6fMcmHmhHVLkwYX
t/4mw2UiYJbHlmdoT96DeV2rMQyaq6PJFlQ=
-----END CERTIFICATE-----
version: '3' version: "3"
services: services:
server: server:
container_name: easybistro-api container_name: easybistro-api
restart: always
build: . build: .
ports: labels:
- "5000:80" - traefik.enable=true
- traefik.http.routers.app-http.rule=Host(`ec2-13-212-117-20.ap-southeast-1.compute.amazonaws.com`)
- traefik.http.routers.app-http.tls=true
- traefik.http.routers.app-http.tls.certresolver=letsencrypt
depends_on: depends_on:
- mongodb - mongodb
...@@ -18,3 +22,15 @@ services: ...@@ -18,3 +22,15 @@ services:
MONGO_INITDB_ROOT_USERNAME: easybistro MONGO_INITDB_ROOT_USERNAME: easybistro
MONGO_INITDB_ROOT_PASSWORD: xejP3257 MONGO_INITDB_ROOT_PASSWORD: xejP3257
traefik:
image: traefik:latest
ports:
- 80:80
- 443:443
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- $PWD/traefik.toml:/etc/traefik/traefik.toml
- traefik-public-certificates:/certificates
volumes:
traefik-public-certificates:
-----BEGIN PRIVATE KEY-----
MIIEuwIBADANBgkqhkiG9w0BAQEFAASCBKUwggShAgEAAoIBAQC5AJdecevyMdXt
NFPBxl6koNO+hItfQbjDwRIRfjSFWBiDDpfZHmQUe3a0EBCq4FLz+M/boPU2JtrB
NJFWag7KOvD4Si2UlY7jTECa05i2CybNWNej+qUc3o1t4nNnTFYpRJNf1kD0erJF
Hfha3RRLIaTBqItU8SuSeBSFx0YGLrxfiAEl8CcsCxq+Mo3KjZwUcq7wJIEfHzrK
8+Vgr9nzNChljmMaIBtU1b3lrTvvCEdNRcCzmtVSgdcLs8s0e14q9ciJx4lIumjw
8lfbTb1v/HozbmjsomabB0ADMdLBIxTUd7vc8BgadkHguxH3rxcnMI3SU+GJe3Nj
V4jQgVgBAgMBAAECggEAH8v6OEFcTEREgIB95NAzdBgwTI57ZePl3b9RW7BVVpXN
oLjhYG/Yw6x0un4IX1Yu67/X+eewPZ5v+sUONcwEvr1irUoSi3cpF+gDMpkrph5E
jQa4CXcK6etWY4yISTjVlkIzEkXA5EQyX67HANb+pesiZiaRzAendYUuAdA+ONGE
nfAN3rQH3h8FxnnlQ45MaPKppYk4RuyxUkXAATBnxlyze6ccyMhGaV1F6XqZp3MK
Vyi6okRJNnDnIs51s/8YQmYR8oTWvwKxTxTSQGguzUam4rYvdeHYMS/hmPXpI5PI
kbw0QzaN2dXOYvHvA5Z6Bg0DxGkwVkbnMQbjuSQAAQKBgQDm+sEQbu0MJdykaTJm
z9toQVQwsoTzvzGdih0czl//Pe76cLsWv2AJf5+cO/5/mOnILT349cQ8FxixtoAn
bQxqJ1zxRhN5M1gbuDp3FaYt29Gnqf9T9VPKum0KGgaKBGHL7PBF9LCx7Nyv8hq7
P5GIGdaf/f8Gd30VgIyQU7l4GQKBgQDNCtpO7MmAbgZfqV8ofeNLS94SDev3MIrh
o/N1gTYyMM4L8sQyiehznSCxgmXv7Rp0tiR3fdziFEWQhXAsc1MJzFy9+nVOip+/
ugiTMt83F1Do3pdla0cELA4ltbnIKHYZgZo7vRe9FA/tu7W/r0NuZ1+GKSC/cjFV
V5BRNsl8KQJ/XAeM5P9Nc4miX9+KNWyb/u4InV6DmpqTKjHdZ5zSouAKV76SzH1z
xlUTQyykOjKy8w8Toh5KEaciL6yHYy4PxDvqzDcfiyrp8CF3Kft2Os9auXMCSHF2
8U9WIrA76sHUNWwyT60uubWmOHQ+Ml0hnxisaxLIicsSC38sglTZkQKBgCvhG7Dy
OXkTkqecLnIS5rZxaPfCJPJEYCRDmtFVsoxxJ1clP9l069r6EEoMltYOjq/VXt53
f/Kd1flEpSnOEEIzitFZLQt+3QsBu94Mb/pxMe5z3EBnAc6hwvFM/5IXHpb8xk3s
fI0JIxOELTP1RN/2nVmvqYNu46HY2FiY+etpAoGBAKEh1VscLC+MK+81zZfr+nws
Wx/mf455HIFdlJhJQH5FQfz/tArDiVH5U1HNmggL9OkyzDW6VwdQbpittJBQCdQ2
OK86MsCfPjpfz1bv8B/w35jMFy0nLZcF2/WQ33aEI8vvSXCMKVpdS4C0BdgawYQi
JUicRgJ7O0S7FlQwqGic
-----END PRIVATE KEY-----
import uvicorn import uvicorn
if __name__ == "__main__": if __name__ == "__main__":
uvicorn.run("server.core:app", host="0.0.0.0", port=8000, reload=True) uvicorn.run("server.core:app", host="0.0.0.0", reload=True)
\ No newline at end of file \ No newline at end of file
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http]
[entryPoints.web.http.redirections]
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"
[entryPoints.websecure]
address = ":443"
[accessLog]
[providers]
[providers.docker]
exposedByDefault = false
[certificatesResolvers.letsencrypt.acme]
email = "sasit.wi.62@ubu.ac.th"
storage= "acme.json"
[certificatesResolvers.letsencrypt.acme.httpChallenge]
entryPoint = "web"
\ No newline at end of file
{
"builds": [
{"src": "/server/core.py", "use": "@vercel/python"}
],
"routes": [
{"src": "/(.*)", "dest": "server/core.py"}
]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment