From 51fa29f7c4418bf94099e93c029e4d631a4d0875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9line=20Pelletier?= <82821620+celinepelletier@users.noreply.github.com> Date: Wed, 12 Jan 2022 10:55:58 -0500 Subject: [PATCH] feat: #3328 add nginx in docker (#3329) * feat: #3328 add nginx in docker * feat: #3328 fix file names and update readme * feat: #3328 fix file names --- docker/nginx/README.md | 51 +++++++++++++++++++++++++++++++++++++ docker/nginx/nginx-prd.conf | 13 ++++++++++ docker/nginx/nginx-qa.conf | 13 ++++++++++ docker/nginx/prd.Dockerfile | 5 ++++ docker/nginx/prd.crt | 22 ++++++++++++++++ docker/nginx/prd.key | 28 ++++++++++++++++++++ docker/nginx/qa.Dockerfile | 5 ++++ docker/nginx/qa.crt | 22 ++++++++++++++++ docker/nginx/qa.key | 28 ++++++++++++++++++++ 9 files changed, 187 insertions(+) create mode 100644 docker/nginx/README.md create mode 100644 docker/nginx/nginx-prd.conf create mode 100644 docker/nginx/nginx-qa.conf create mode 100644 docker/nginx/prd.Dockerfile create mode 100644 docker/nginx/prd.crt create mode 100644 docker/nginx/prd.key create mode 100644 docker/nginx/qa.Dockerfile create mode 100644 docker/nginx/qa.crt create mode 100644 docker/nginx/qa.key diff --git a/docker/nginx/README.md b/docker/nginx/README.md new file mode 100644 index 000000000..b01debab3 --- /dev/null +++ b/docker/nginx/README.md @@ -0,0 +1,51 @@ +# Run NGINX in Docker + +## Requirements + +- Docker (18.03+ for Mac/Windows, 20.04+ for Linux) +- KF-portal-UI is running locally on port 3000 +- `portal-qa.kidsfirstdrc.org` and/or `portal.kidsfirstdrc.org` added to hosts file + +## QA + +### Build image: + +``` +docker build -f qa.Dockerfile -t kf-nginx-qa . +``` + +### Run image: + +For Mac/Windows: + +``` +docker run -p 443:443 -p 80:80 -d kf-nginx-qa +``` + +For Linux: + +``` +docker run -p 443:443 -p 80:80 --add-host=host.docker.internal:host-gateway -d kf-nginx-qa +``` + +## PRD + +### Build image: + +``` +docker build -f prd.Dockerfile -t kf-nginx-prd . +``` + +### Run image: + +For Mac/Windows: + +``` +docker run -p 443:443 -p 80:80 -d kf-nginx-prd +``` + +For Linux: + +``` +docker run -p 443:443 -p 80:80 --add-host=host.docker.internal:host-gateway -d kf-nginx-prd +``` diff --git a/docker/nginx/nginx-prd.conf b/docker/nginx/nginx-prd.conf new file mode 100644 index 000000000..a2d301730 --- /dev/null +++ b/docker/nginx/nginx-prd.conf @@ -0,0 +1,13 @@ +# PRD + server { + listen 443 ssl; + ssl_certificate /etc/nginx/prd.crt; + ssl_certificate_key /etc/nginx/prd.key; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_prefer_server_ciphers on; + ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; + server_name portal.kidsfirstdrc.org; + location / { + proxy_pass https://host.docker.internal:3000; + } + } \ No newline at end of file diff --git a/docker/nginx/nginx-qa.conf b/docker/nginx/nginx-qa.conf new file mode 100644 index 000000000..aedb375e3 --- /dev/null +++ b/docker/nginx/nginx-qa.conf @@ -0,0 +1,13 @@ +# PRD + server { + listen 443 ssl; + ssl_certificate /etc/nginx/qa.crt; + ssl_certificate_key /etc/nginx/qa.key; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_prefer_server_ciphers on; + ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; + server_name portal-qa.kidsfirstdrc.org; + location / { + proxy_pass https://host.docker.internal:3000; + } + } \ No newline at end of file diff --git a/docker/nginx/prd.Dockerfile b/docker/nginx/prd.Dockerfile new file mode 100644 index 000000000..9ddc73da6 --- /dev/null +++ b/docker/nginx/prd.Dockerfile @@ -0,0 +1,5 @@ +FROM nginx +RUN rm /etc/nginx/conf.d/default.conf +COPY prd.crt /etc/nginx/prd.crt +COPY prd.key /etc/nginx/prd.key +COPY nginx-prd.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/docker/nginx/prd.crt b/docker/nginx/prd.crt new file mode 100644 index 000000000..8a1537e1a --- /dev/null +++ b/docker/nginx/prd.crt @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDtjCCAp4CCQD6Jui1KJKmTjANBgkqhkiG9w0BAQsFADCBnDELMAkGA1UEBhMC +Q0ExDzANBgNVBAgMBlF1ZWJlYzETMBEGA1UEBwwKVGVycmVib25uZTEOMAwGA1UE +CgwFQ0hVU0oxDzANBgNVBAsMBkZlcmxhYjEgMB4GA1UEAwwXcG9ydGFsLmtpZHNm +aXJzdGRyYy5vcmcxJDAiBgkqhkiG9w0BCQEWFWNwZWxsZXRpZXJAZmVybGFiLmJp +bzAeFw0yMTA0MjcxODQ2MTVaFw0yMjA0MjcxODQ2MTVaMIGcMQswCQYDVQQGEwJD +QTEPMA0GA1UECAwGUXVlYmVjMRMwEQYDVQQHDApUZXJyZWJvbm5lMQ4wDAYDVQQK +DAVDSFVTSjEPMA0GA1UECwwGRmVybGFiMSAwHgYDVQQDDBdwb3J0YWwua2lkc2Zp +cnN0ZHJjLm9yZzEkMCIGCSqGSIb3DQEJARYVY3BlbGxldGllckBmZXJsYWIuYmlv +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs6SLVx10ZZ02EjPvc4qz +2PtKzlb4/Yjg/jvDL1WGZXikUpU/uFxLZ4SwyZwLWBVUhNXyr6SloP+Dy1Ka0Vgh +HDEiE8DZIjTeYUVakXRxfDiBHxFYvOU5PVv9dKiI17xLQxvPye9VRRB4FcoW/3Jm +7A2GTxmIRExElcrmk4zmqpxRWVrk20tRNgwzOJJUnAGhjDGUbS3v79Wqyl1QwT12 +ap+0n5kpXn1DI5h0MbnueBrCY/e36ks5hd7+w5kGgVcU0Yq7bEzrzLkL182uzrFI +6tcUMA/enOE03SMJwi3qRQX0VKtn4KA3TRa86B1WjIMWM0Wk0UoT/PzBBwinjqZ4 +6QIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQChed0QiRPq/w9zjLVprDKTlScp+FpK +RWLAtMZFLNoow4+VVIZH4ylAxgAPblomX3/wHLCbYZ+DFu2AULMKfgaqwEa/bMdg +vVrBBItbW30qdHmCW8md9o1O6zhRmX4KQHH6T7Jnul9f1+XYnp2/p4XnJML0/Oef +D0JFZa6/ec+VTatSmbpOttzZO47Xfp0BEfEn5CaRo1dnfeUfnB1yE60aVyo6ebLb +PWlKyaWH3CXxHkywJOo3TedwME7vkM6sw/lGoCuhC40lBBIEu+s1KA21336ATrz9 +MnCIZF/tBtsWQKyeaOV/acpY5ZXUrkrrhSgY+RNugCs0HJg9pKoxiMPl +-----END CERTIFICATE----- diff --git a/docker/nginx/prd.key b/docker/nginx/prd.key new file mode 100644 index 000000000..fdb034b6d --- /dev/null +++ b/docker/nginx/prd.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCzpItXHXRlnTYS +M+9zirPY+0rOVvj9iOD+O8MvVYZleKRSlT+4XEtnhLDJnAtYFVSE1fKvpKWg/4PL +UprRWCEcMSITwNkiNN5hRVqRdHF8OIEfEVi85Tk9W/10qIjXvEtDG8/J71VFEHgV +yhb/cmbsDYZPGYhETESVyuaTjOaqnFFZWuTbS1E2DDM4klScAaGMMZRtLe/v1arK +XVDBPXZqn7SfmSlefUMjmHQxue54GsJj97fqSzmF3v7DmQaBVxTRirtsTOvMuQvX +za7OsUjq1xQwD96c4TTdIwnCLepFBfRUq2fgoDdNFrzoHVaMgxYzRaTRShP8/MEH +CKeOpnjpAgMBAAECggEBAIiq/0MoanxADXntvxc1B7xk+bVfX5BrSVjBmK3zMAsU +rFcTquWUed1oiqLnL440tBdXOYm9BjElE1xlHNl1ZcMv8g/7IHYwqJpyDAQrBYeO +6VT8enlDHrf6uym8aldOrieBCiVECqg/bkyNcc+ndnvRkkOtVgk3yNn5AlBw2rAi +c+pHEN22BiLunXQcMG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- diff --git a/docker/nginx/qa.Dockerfile b/docker/nginx/qa.Dockerfile new file mode 100644 index 000000000..9c24b2d2c --- /dev/null +++ b/docker/nginx/qa.Dockerfile @@ -0,0 +1,5 @@ +FROM nginx +RUN rm /etc/nginx/conf.d/default.conf +COPY qa.crt /etc/nginx/qa.crt +COPY qa.key /etc/nginx/qa.key +COPY nginx-qa.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/docker/nginx/qa.crt b/docker/nginx/qa.crt new file mode 100644 index 000000000..2c2071e18 --- /dev/null +++ b/docker/nginx/qa.crt @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDvDCCAqQCCQDLxgt4T1m5cTANBgkqhkiG9w0BAQsFADCBnzELMAkGA1UEBhMC +Q0ExDzANBgNVBAgMBlF1ZWJlYzETMBEGA1UEBwwKVGVycmVib25uZTEOMAwGA1UE +CgwFQ0hVU0oxDzANBgNVBAsMBkZlcmxhYjEjMCEGA1UEAwwacG9ydGFsLXFhLmtp +ZHNmaXJzdGRyYy5vcmcxJDAiBgkqhkiG9w0BCQEWFWNwZWxsZXRpZXJAZmVybGFi +LmJpbzAeFw0yMTA0MjcxNzAxMDFaFw0yMjA0MjcxNzAxMDFaMIGfMQswCQYDVQQG +EwJDQTEPMA0GA1UECAwGUXVlYmVjMRMwEQYDVQQHDApUZXJyZWJvbm5lMQ4wDAYD +VQQKDAVDSFVTSjEPMA0GA1UECwwGRmVybGFiMSMwIQYDVQQDDBpwb3J0YWwtcWEu +a2lkc2ZpcnN0ZHJjLm9yZzEkMCIGCSqGSIb3DQEJARYVY3BlbGxldGllckBmZXJs +YWIuYmlvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA61mzYbc3cjqG +AjOHFukT0swhblaWPG4pv+mnffiTgXRB8gmS8hUD1fbJw3DonpKxbvjp6i6V3vYG +3qimec4bi9/Wa4e2TCaTr+l4CO0dZzkIZMPGCySDDfy+mRj03AzcsJodrOdwqoog +FiRXWqke2vhwh9hmFNmWbBxaBP0mNav44xKZQDbz/5WO01+W3da5G5CvmfFgwb7h +b/17PBOvrCW3YICV0dYoADDNlukc4Yk6GS+3wUjK5JVBoDWjGO3hTUE3KitcZddu +oXgp6Q3J/efz9yzyglewUGyKksFAGTifuLZme73gG2u+1CXp9URpS300u42oZ2zM +TbjySGkgFwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAuS6ty/qvqVfO7E+2A8Cfg +jGKLIeVB++OD+Fcl4BQYSUnkORf85cWjdPjgLuHc2EgBsgKY9dtD1lKUCYEfpNzJ +DN0UpmjJoM+ujY+zmCfInp2XIyRM5HnU25tu9k5fzFXRbBUGh7+NxBXhavJ0aOQh +g6WN1Ao0ln6Ulj54MNcJkzHBxKm9giwVlKhGIw0eqCnyRrHJnpmSDccsVnNY96Vi +cbTGeF9Bkg5wLnCHg5fvNdlifx953Wfkrp2RuHxB98Pve1WuXRuk8A7MJEiGqtGP +i1hEtK7mUDLFrb2kbZ63+7g6WEQsoDzN8g2fa4FVgf1K7RKOaKsTegtUqBun1+bP +-----END CERTIFICATE----- diff --git a/docker/nginx/qa.key b/docker/nginx/qa.key new file mode 100644 index 000000000..d0d697d69 --- /dev/null +++ b/docker/nginx/qa.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDrWbNhtzdyOoYC +M4cW6RPSzCFuVpY8bim/6ad9+JOBdEHyCZLyFQPV9snDcOiekrFu+OnqLpXe9gbe +qKZ5zhuL39Zrh7ZMJpOv6XgI7R1nOQhkw8YLJIMN/L6ZGPTcDNywmh2s53CqiiAW +JFdaqR7a+HCH2GYU2ZZsHFoE/SY1q/jjEplANvP/lY7TX5bd1rkbkK+Z8WDBvuFv +/Xs8E6+sJbdggJXR1igAMM2W6RzhiToZL7fBSMrklUGgNaMY7eFNQTcqK1xl126h +eCnpDcn95/P3LPKCV7BQbIqSwUAZOJ+4t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