diff --git a/.docker/docker-compose.dcproj b/.docker/docker-compose.dcproj index b0333b09..6cacc837 100644 --- a/.docker/docker-compose.dcproj +++ b/.docker/docker-compose.dcproj @@ -22,11 +22,9 @@ - + - - - - + + \ No newline at end of file diff --git a/.docker/hostsadd.sh b/.docker/hostsadd.sh deleted file mode 100755 index 5b630879..00000000 --- a/.docker/hostsadd.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -cat << EOF >> /etc/hosts -# To allow the same website for Wallet SPA/IdentityServer and AccountsAPI -127.0.0.1 wallet.local -# End of section -EOF -exit \ No newline at end of file diff --git a/.docker/https/localhost.crt b/.docker/https/localhost.crt deleted file mode 100644 index 86585ade..00000000 --- a/.docker/https/localhost.crt +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDHzCCAgegAwIBAgIJAOIxgeyqdwODMA0GCSqGSIb3DQEBCwUAMDsxFTATBgNV -BAMTDHdhbGxldC5sb2NhbDEVMBMGA1UEChMMd2FsbGV0LmxvY2FsMQswCQYDVQQG -EwJVUzAeFw0yMDExMDQxOTA2MjFaFw0yMTExMDQxOTA2MjFaMDsxFTATBgNVBAMT -DHdhbGxldC5sb2NhbDEVMBMGA1UEChMMd2FsbGV0LmxvY2FsMQswCQYDVQQGEwJV -UzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ6bLoCWRMmgIOxwEFc6 -b3eblbixOvohTTqwfgjwOYfIWgrNad9shcVa8vpI+GIETtuTUvlSUoIE/ZhhbtbA -tPOPWvH/10ss9LX4HXcm/vPzw2CIka0uT9gnvuTmNF21+c/jVaUmKjkiOMwEBbd8 -5SyyX4m+N6swePjiSnZMEdEx5raQZ1Ubcqh2OmXkJJPG5O1jP3IzqcZA7rDP8Pd1 -jJHvej7LqX8U8EYj+v3laqBZcnHgDn4/rcf+c+FwLEErqPoFsahsGUiyMW6n1kHg -eG8ihO57FJff4QJKWpethZlEHcqa5MNIJn6Vs0irBlQfErWcsQ78YZM3uSWBI2rR -bHcCAwEAAaMmMCQwIgYDVR0RBBswGYIMd2FsbGV0LmxvY2Fsgglsb2NhbGhvc3Qw -DQYJKoZIhvcNAQELBQADggEBAJdNAuDjkna4kuCSsbMBT8xWlxTN5lbDVfUIzgW4 -Iv0qb3YVqYLEbE6o/9AaE70XMMWraSnqs4j2aa5TunbQJlrTQLU45hGci1yZKeuq -JoJtk8lUseWPzGATX7YSeQVLBUQVEmkO1UbQPr/xr0VdgkXffMNJdfDJvqykDbZn -vGMTLvptOuj+sA1JthJo5zjwAOzf85znxFWsRYQjYO8pmK795pxN6jpeWYtBZOXA -pva0kdRugSujjsr9XleB+T/lBWNy5b0QTFbwSc/6SKO3nV02m18ezrWtFiQ/nxYf -Ha6ToutxjhP2YmfTGRaHvnyXMyxr1/Jkg3hVVP8xcwbcYZs= ------END CERTIFICATE----- diff --git a/.docker/https/localhost.key b/.docker/https/localhost.key deleted file mode 100644 index e05f1f95..00000000 --- a/.docker/https/localhost.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCemy6AlkTJoCDs -cBBXOm93m5W4sTr6IU06sH4I8DmHyFoKzWnfbIXFWvL6SPhiBE7bk1L5UlKCBP2Y -YW7WwLTzj1rx/9dLLPS1+B13Jv7z88NgiJGtLk/YJ77k5jRdtfnP41WlJio5IjjM -BAW3fOUssl+JvjerMHj44kp2TBHRMea2kGdVG3Kodjpl5CSTxuTtYz9yM6nGQO6w -z/D3dYyR73o+y6l/FPBGI/r95WqgWXJx4A5+P63H/nPhcCxBK6j6BbGobBlIsjFu -p9ZB4HhvIoTuexSX3+ECSlqXrYWZRB3KmuTDSCZ+lbNIqwZUHxK1nLEO/GGTN7kl -gSNq0Wx3AgMBAAECggEAZbHwhihToMgYdCGCiLuCHznWLR8ORrU1lIz3svl8mdBf -049T9BrcRueC5fIFuKs0eNuklxIurwlOJPdMH0xeedCQKpy1SZFgspCNLAoH7Rl+ -S5Yledo4/cq2PoRQTUnSDHaiQosPBaUor79gfv8I3rjcQzCA9zXUSxilT+aEghGv -dCgCmnldOTl4vRkVhMVe8b6+O+WDOPSlLVNGffXTUUTTlt7yLytp3CY5J+0wqoHf -4M+UzgoTf0DlaUDhu65xd6S70gPo85QRrGJX8XOUmI5OKUUNFXOKf3MJAl2qf5tQ -1h2zS8OvWvrZL2DbBlNeJ+4hfG0fiQGgVr+i8HdpqQKBgQDO0kAeotG+nMMcTk4z -TmLK9JK1WuMGUQqMImtwlfAKvvAAOafXmjZXxCg7gyngqhNWW6/x0CsTbdfLOk3o -KdpkKIIAp55SHlSJJ37ELNqxLC32kvhGrQVMpR22lpemyqG2opvSHh7IjnWqhzwt -SegxLKrfeNWb68go/5Tm3hRsVQKBgQDEUfOzz//tv1LfkhIABviZsawBMhRclBUX -IQRGxAGGMRW7dtjwwBGsKGEBIlIROQKyf6vjsim4pxfO3kdRmzGuDe3xSIwPzLqO -PkclUpANdHeWs0SHH4E85G+iOQ5uvufNcQa7+xw/7g1ztv8wCpiGEjAQ8SJ3E3+E -NIUUT2mBmwKBgQCLZdKp03wjSW2ISo8SraaQvL+VVKjnvP+q7BgWTjj4RTFmNXYX -L22pQiEL26ACOR/HeQzhozklY0erRqTz8iGsmFDnOBLRrnez6dbbSpAsEmb4Zp7I -pB2KR0/7nQyh8rmEa50yxfJhowNT6Mp6i/HgEwcokD0JVqYWXA10fgKt8QKBgAKY -3vN7BfS8Ojlw8kID1Zga7J6bbf+HifvjWO4iu65tyc7QFLCiqdkwM5BTRuipa2q3 -G6wIeFrUAxGeiS0AM5kM4B/4CLpQyAsHseNBg1xaNRbOSlLLTOdkUkHAJXu7lM93 -9lHYUZha6tykCB43lar4ZKBkwEL5BA/YrgYFwuyPAoGBAJHOGbBVaUPYICFtq4VP -zDH80ogxpXf50iswHCYBLIm1YvfQY3IHQjDc3EzVUl1xxbjV7AIpv5bkqdwXQQPb -nklsJZTLe2nkcR7hQtQ6FAloppSso1/hjxszyTkg2CUvkeKKKlL2DjP+jU1rV9ye -DZx4GWo1PLU/MJC68JUqJSig ------END PRIVATE KEY----- diff --git a/.docker/https/localhost.pfx b/.docker/https/localhost.pfx deleted file mode 100644 index 65aae547..00000000 Binary files a/.docker/https/localhost.pfx and /dev/null differ diff --git a/.docker/makecert.sh b/.docker/makecert.sh deleted file mode 100755 index 7bf1abec..00000000 --- a/.docker/makecert.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -openssl req -x509 -newkey rsa:2048 -keyout https/localhost.key -out https/localhost.crt -days 365 -nodes -subj '/CN=wallet.local/O=wallet.local/C=US' -config ssl-selfsigned.cnf -openssl pkcs12 -export -out https/localhost.pfx -inkey https/localhost.key -in https/localhost.crt -name "Localhost selfsigned certificate" -password pass:MyCertificatePassword \ No newline at end of file diff --git a/.docker/setup.production.sh b/.docker/setup.production.sh new file mode 100644 index 00000000..a76e7683 --- /dev/null +++ b/.docker/setup.production.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# 1. makecert + +openssl req -x509 -newkey rsa:2048 -keyout ./https/localhost.key -out ./https/localhost.crt -days 365 -subj "/CN=wallet.local/O=wallet.local/C=US" -config ./ssl-selfsigned.cnf -passout pass:MyCertificatePassword +openssl pkcs12 -export -out ./https/localhost.pfx -inkey ./https/localhost.key -in ./https/localhost.crt -name "Localhost selfsigned certificate" -password pass:MyCertificatePassword -passin pass:MyCertificatePassword +openssl rsa -in ./https/localhost.key -out ./https/localhost.key -passin pass:MyCertificatePassword + +# 2. [trustcert](https://gist.github.com/epcim/03f66dfa85ad56604c7b8e6df79614e0) + +sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ./https/localhost.crt + +# 3. hostadd + +cat << EOF >> /etc/hosts +# To allow the same website for Wallet SPA/IdentityServer and AccountsAPI +127.0.0.1 wallet.local +# End of section +EOF +exit + +# 4. build + +docker-compose build --no-cache + +# 5. run + +docker-compose -f docker-compose.yml -f docker-compose.production.yml up -d \ No newline at end of file diff --git a/.docker/setup.ps1 b/.docker/setup.ps1 new file mode 100644 index 00000000..dd0d5ac8 --- /dev/null +++ b/.docker/setup.ps1 @@ -0,0 +1,21 @@ +# 1. makecert + +openssl req -x509 -newkey rsa:2048 -keyout ./https/localhost.key -out ./https/localhost.crt -days 365 -subj "/CN=wallet.local/O=wallet.local/C=US" -config ./ssl-selfsigned.cnf -passout pass:MyCertificatePassword +openssl pkcs12 -export -out ./https/localhost.pfx -inkey ./https/localhost.key -in ./https/localhost.crt -name "Localhost selfsigned certificate" -password pass:MyCertificatePassword -passin pass:MyCertificatePassword +openssl rsa -in ./https/localhost.key -out ./https/localhost.key -passin pass:MyCertificatePassword + +# 2. [trustcert](https://gist.github.com/epcim/03f66dfa85ad56604c7b8e6df79614e0) + +certutil -addstore -f "ROOT" ./https/localhost.crt + +# 3. hostadd + +Add-Content -Path $env:windir\System32\drivers\etc\hosts -Value "`n127.0.0.1`twallet.local" -Force + +# 4. build + +docker-compose build --no-cache + +# 5. run + +docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d \ No newline at end of file diff --git a/.docker/setup.sh b/.docker/setup.sh new file mode 100644 index 00000000..75d37b3f --- /dev/null +++ b/.docker/setup.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# 1. makecert + +openssl req -x509 -newkey rsa:2048 -keyout ./https/localhost.key -out ./https/localhost.crt -days 365 -subj "/CN=wallet.local/O=wallet.local/C=US" -config ./ssl-selfsigned.cnf -passout pass:MyCertificatePassword +openssl pkcs12 -export -out ./https/localhost.pfx -inkey ./https/localhost.key -in ./https/localhost.crt -name "Localhost selfsigned certificate" -password pass:MyCertificatePassword -passin pass:MyCertificatePassword +openssl rsa -in ./https/localhost.key -out ./https/localhost.key -passin pass:MyCertificatePassword + +# 2. [trustcert](https://gist.github.com/epcim/03f66dfa85ad56604c7b8e6df79614e0) + +sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ./https/localhost.crt + +# 3. hostadd + +cat << EOF >> /etc/hosts +# To allow the same website for Wallet SPA/IdentityServer and AccountsAPI +127.0.0.1 wallet.local +# End of section +EOF +exit + +# 4. build + +docker-compose build --no-cache + +# 5. run + +docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d \ No newline at end of file diff --git a/.docker/startup-production.sh b/.docker/startup-production.sh deleted file mode 100644 index 3b22ba52..00000000 --- a/.docker/startup-production.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -if [ `ls -1 https/localhost.* 2>/dev/null | wc -l ` -gt 0 ]; -then - echo "0. Using certificates from $(tput setaf 3)https$(tput sgr0) folder." -else - echo "ERROR: Failed to find certificates. Check the specific makecert script for your OS." - exit 1 -fi -echo "1. Building Docker images. This may take few minutes..." -echo -e "\n\n\tEnsure Docker is up and running.\n\n" -docker-compose build -echo "2. Starting up applications. This may take few minutes..." -docker-compose -f docker-compose.yml -f docker-compose.production.yml up -d -echo -e "3. Manually add the entry $(tput setaf 3)127.0.0.1 wallet.local$(tput sgr0) to the hosts file." -echo -e "\tBrowse to $(tput setaf 3)https://wallet.local/$(tput sgr0)\n\nUse the following credentials to login into Identity Server:\n\n\tUsername:\t$(tput setaf 3)alice$(tput sgr0)\n\tPassword:\t$(tput setaf 3)alice$(tput sgr0)" -echo -e "\tRun $(tput setaf 3)docker ps$(tput sgr0) to check if all containers are up. The frontend SPA could take several minutes to get ready." - diff --git a/.docker/startup.sh b/.docker/startup.sh deleted file mode 100755 index c9859d65..00000000 --- a/.docker/startup.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -if [ `ls -1 https/localhost.* 2>/dev/null | wc -l ` -gt 0 ]; -then - echo "0. Using certificates from $(tput setaf 3)https$(tput sgr0) folder." -else - echo "ERROR: Failed to find certificates. Check the specific makecert script for your OS." - exit 1 -fi -echo "1. Building Docker images. This may take few minutes..." -echo -e "\n\n\tEnsure Docker is up and running.\n\n" -docker-compose build -echo "2. Starting up applications. This may take few minutes..." -docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d -echo -e "3. Manually add the entry $(tput setaf 3)127.0.0.1 wallet.local$(tput sgr0) to the hosts file." -echo -e "\tBrowse to $(tput setaf 3)https://wallet.local:8081/$(tput sgr0)\n\nUse the following credentials to login into Identity Server:\n\n\tUsername:\t$(tput setaf 3)alice$(tput sgr0)\n\tPassword:\t$(tput setaf 3)alice$(tput sgr0)" -echo -e "\tRun $(tput setaf 3)docker ps$(tput sgr0) to check if all containers are up. The frontend SPA could take several minutes to get ready." diff --git a/.docker/trustcert-windows.ps1 b/.docker/trustcert-windows.ps1 deleted file mode 100644 index f2ff4087..00000000 --- a/.docker/trustcert-windows.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# Check out for multiple options to trust certificates -# https://gist.github.com/epcim/03f66dfa85ad56604c7b8e6df79614e0 -# -dotnet dev-certs https -ep https/localhost.pfx -p MyCertificatePassword -dotnet dev-certs https --trust -certutil -addstore -f "ROOT" https/localhost.crt \ No newline at end of file diff --git a/.docker/trustcert.sh b/.docker/trustcert.sh deleted file mode 100755 index fce99620..00000000 --- a/.docker/trustcert.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -# https://gist.github.com/epcim/03f66dfa85ad56604c7b8e6df79614e0 -sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain https/localhost.crt \ No newline at end of file diff --git a/Clean-Architecture-Manga.sln b/Clean-Architecture-Manga.sln index 663a0e54..10d49c88 100644 --- a/Clean-Architecture-Manga.sln +++ b/Clean-Architecture-Manga.sln @@ -3,13 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29519.87 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{23ED54A6-81AF-4160-97A6-FD3C25C33E30}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{F6826529-32A9-419B-B7E5-63BE9A0FDA93}" - ProjectSection(SolutionItems) = preProject - .github\workflows\dotnet-core.yml = .github\workflows\dotnet-core.yml - EndProjectSection -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "accounts-api", "accounts-api", "{51331007-CACA-4676-934B-217999A6B1E2}" ProjectSection(SolutionItems) = preProject accounts-api\.editorconfig = accounts-api\.editorconfig @@ -54,8 +47,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".vscode", ".vscode", "{02D5 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer", "identity-server\IdentityServer.csproj", "{01537DBF-3C0F-4B83-A089-0D12E5CA06C6}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".docker", ".docker", "{FAA0BAC6-0AA8-4908-A287-D550E9F9CBA8}" -EndProject Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", ".docker\docker-compose.dcproj", "{A0517AF3-3B35-443A-80DC-FF94F10CF056}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain", "accounts-api\src\Domain\Domain.csproj", "{0925FCA6-083A-4478-80F3-2391987AAF2C}" @@ -71,16 +62,26 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "accounts-api-seed", "accoun accounts-api-seed\Dockerfile = accounts-api-seed\Dockerfile EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wallet-spa", "wallet-spa", "{231C4C02-5F48-45CE-AF73-65B441017D57}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3A9E410D-D37D-469C-BAE3-153943AE70FF}" + ProjectSection(SolutionItems) = preProject + .all-contributorsrc = .all-contributorsrc + .dockerignore = .dockerignore + .gitignore = .gitignore + CHANGELOG.md = CHANGELOG.md + FUNDING.yml = FUNDING.yml + LICENSE = LICENSE + README.md = README.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wallett-spa", "wallett-spa", "{E578FEEE-CF6A-4017-97F1-E5A9B0D2F398}" ProjectSection(SolutionItems) = preProject wallet-spa\.dockerignore = wallet-spa\.dockerignore - wallet-spa\.env = wallet-spa\.env - wallet-spa\.env.vs.debug = wallet-spa\.env.vs.debug + wallet-spa\.env.development = wallet-spa\.env.development + wallet-spa\.env.docker = wallet-spa\.env.docker + wallet-spa\.env.localhost = wallet-spa\.env.localhost wallet-spa\.gitignore = wallet-spa\.gitignore wallet-spa\Dockerfile = wallet-spa\Dockerfile - wallet-spa\package-lock.json = wallet-spa\package-lock.json - wallet-spa\package.json = wallet-spa\package.json - wallet-spa\README.md = wallet-spa\README.md + wallet-spa\vs.debug.env = wallet-spa\vs.debug.env EndProjectSection EndProject Global @@ -134,7 +135,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {F6826529-32A9-419B-B7E5-63BE9A0FDA93} = {23ED54A6-81AF-4160-97A6-FD3C25C33E30} {F4408BAF-2D26-4D97-808C-7A96C4A7F636} = {51331007-CACA-4676-934B-217999A6B1E2} {54ECA5D5-FCB9-4427-98A1-6915E0C2C71B} = {51331007-CACA-4676-934B-217999A6B1E2} {B3ABDDAF-9164-4FC4-862D-07A2D9F62F5D} = {51331007-CACA-4676-934B-217999A6B1E2} @@ -147,7 +147,6 @@ Global {BF05183E-699A-43A8-A5F3-1DB71B0F38B0} = {54ECA5D5-FCB9-4427-98A1-6915E0C2C71B} {02D548DA-5DE0-486E-A5D5-9BEDFFC0CA2A} = {51331007-CACA-4676-934B-217999A6B1E2} {01537DBF-3C0F-4B83-A089-0D12E5CA06C6} = {5829A64A-52DE-4656-A6C0-C06B1A6195E7} - {A0517AF3-3B35-443A-80DC-FF94F10CF056} = {FAA0BAC6-0AA8-4908-A287-D550E9F9CBA8} {0925FCA6-083A-4478-80F3-2391987AAF2C} = {F4408BAF-2D26-4D97-808C-7A96C4A7F636} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/README.md b/README.md index da101e35..8d489e64 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,14 @@ Sample implementation of the **Clean Architecture Principles with .NET Core**. Use cases as central organizing structure, decoupled from frameworks and technology details. Built by small components that are developed and tested in isolation. -We maintain two versions: +We support two versions: -- [Latest .NET Core 3.1 release](https://github.com/ivanpaulovich/clean-architecture-manga) - Check the .NET Core SDK on `global.json`. -- [.NET 5](https://github.com/ivanpaulovich/clean-architecture-manga/tree/dotnet5) - Experimental features and .NET 5. +- [.NET Core 3.1](https://github.com/ivanpaulovich/clean-architecture-manga) - .NET Core. +- [.NET 5](https://github.com/ivanpaulovich/clean-architecture-manga/tree/dotnet5) - .NET 5 version. > Hit the `WATCH` button to get the latest Clean Architecture updates. -Manga is a Virtual Wallet software in which the customer register an account then manage the balance by `Deposits`, `Withdraws` and `Transfers`. +Manga is a Virtual Wallet Solution in which the customer register an account then manage the balance by `Deposits`, `Withdraws` and `Transfers` operations. The Web API's demo is hosted on Azure servers and there's a beautiful [Swagger Client](https://clean-architecture-manga.azurewebsites.net/swagger/index.html) available. [![Swagger Demo](https://raw.githubusercontent.com/ivanpaulovich/clean-architecture-manga/docs/docs/clean-architecture-manga-swagger-v2.jpg)](https://clean-architecture-manga.azurewebsites.net/swagger/index.html) @@ -19,7 +19,6 @@ We also support the React client: [![React+Redux Demo](https://raw.githubusercontent.com/ivanpaulovich/clean-architecture-manga/docs/docs/clean-architecture-manga-react.png)](https://clean-architecture-manga.azurewebsites.net) -

Run the Docker container in less than 2 minutes using Play With Docker:
@@ -31,73 +30,29 @@ We also support the React client: To startup the whole solution, execute the following command: -```sh -$ cd .docker; ./makecert.sh && ./trustcert.sh && sudo ./hostsadd.sh; popd; -$ cd .docker; ./startup.sh; popd; -``` - -Then the following containers should be running `docker ps`: - -| Application | URL | -|------------------ | -------------------------------------- | -| NGINX | https://wallet.local:8081 | -| Wallet SPA | https://wallet.local:8081 | -| Accounts API | https://wallet.local:8081/accounts-api | -| Identity Server | https://wallet.local:8081/identity-server | -| SQL Server | Server=localhost;User Id=sa;Password=;Database=Accounts; | - -Browse to `https://wallet.local:8081` then click on Log In. Trust the [self-signed certificate](https://stackoverflow.com/questions/21397809/create-a-trusted-self-signed-ssl-cert-for-localhost-for-use-with-express-node). - -If you prefer dotnet commands then start each service individually: - -

- Expand to get the dotnet run steps. - -### Generate Self Signed Certificate - -```sh -dotnet dev-certs https --clean -dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\aspnetapp.pfx -p MyCertificatePassword -dotnet dev-certs https --trust -``` - -### Spin up SQL Server in a Docker container +Windows: -```sh -docker pull mcr.microsoft.com/mssql/server:2019-latest -docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=' -p 1433:1433 --name sql1 -d mcr.microsoft.com/mssql/server:2019-latest +```ps1 +PS cd docker && ./setup.ps1 ``` -### Create and Seed Accounts Database +MacOS: ```sh -dotnet tool update --global dotnet-ef --version 3.1.6 -dotnet ef database update --project accounts-api/src/Infrastructure --startup-project accounts-api/src/WebApi +$ cd docker && ./setup.sh ``` -### Running Services +Then the following containers should be running on `docker ps`: -#### Identity Server - -```sh -dotnet run --project identity-server/src/IdentityServer.csproj -``` -#### Account API - -```sh -dotnet run --project accounts-api/src/WebApi/WebApi.csproj -``` - -#### Wallett SPA - -```sh -pushd wallet-spa/src/ClientApp -npm install -popd -dotnet run --project wallet-spa/src/WalletSPA.csproj --launch-profile WalletSPA -``` +| Application | URL | +|-------------------- | ----------------------------------------------------------------------------- | +| NGINX | https://wallet.local:8081 | +| Wallet SPA | https://wallet.local:8081 | +| Accounts API | https://wallet.local:8081/accounts-api | +| Identity Server | https://wallet.local:8081/identity-server | +| SQL Server | Server=localhost;User Id=sa;Password=;Database=Accounts; | -
+Browse to [https://wallet.local:8081](https://wallet.local:8081) then click on Log In. If asked trust the [self-signed certificate](https://stackoverflow.com/questions/21397809/create-a-trusted-self-signed-ssl-cert-for-localhost-for-use-with-express-node). ## Motivation diff --git a/accounts-api-seed/Dockerfile b/accounts-api-seed/Dockerfile index dead4788..252d2d7a 100644 --- a/accounts-api-seed/Dockerfile +++ b/accounts-api-seed/Dockerfile @@ -3,5 +3,6 @@ FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build RUN dotnet tool update --global dotnet-ef --version 5.0.1 WORKDIR /src COPY . . +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false RUN dotnet restore "src/WebApi/WebApi.csproj" RUN dotnet build "src/WebApi/WebApi.csproj" --no-restore diff --git a/accounts-api/src/Application/Application.csproj b/accounts-api/src/Application/Application.csproj index 149646b9..e1bd2703 100644 --- a/accounts-api/src/Application/Application.csproj +++ b/accounts-api/src/Application/Application.csproj @@ -15,16 +15,15 @@ - + all runtime; build; native; contentfiles; analyzers - + all runtime; build; native; contentfiles; analyzers - - + all runtime; build; native; contentfiles; analyzers diff --git a/accounts-api/src/Domain/Domain.csproj b/accounts-api/src/Domain/Domain.csproj index 2f021d44..326cf8ee 100644 --- a/accounts-api/src/Domain/Domain.csproj +++ b/accounts-api/src/Domain/Domain.csproj @@ -11,16 +11,15 @@ - + all runtime; build; native; contentfiles; analyzers - + all runtime; build; native; contentfiles; analyzers - - + all runtime; build; native; contentfiles; analyzers diff --git a/accounts-api/src/Infrastructure/Infrastructure.csproj b/accounts-api/src/Infrastructure/Infrastructure.csproj index 84c4d744..46d402d5 100644 --- a/accounts-api/src/Infrastructure/Infrastructure.csproj +++ b/accounts-api/src/Infrastructure/Infrastructure.csproj @@ -12,16 +12,15 @@ - + all runtime; build; native; contentfiles; analyzers - + all runtime; build; native; contentfiles; analyzers - - + all runtime; build; native; contentfiles; analyzers @@ -29,20 +28,20 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers - + diff --git a/accounts-api/src/WebApi/Dockerfile b/accounts-api/src/WebApi/Dockerfile index 8b606363..a5119edf 100644 --- a/accounts-api/src/WebApi/Dockerfile +++ b/accounts-api/src/WebApi/Dockerfile @@ -24,4 +24,8 @@ WORKDIR /app COPY --from=publish /app/publish . COPY /src/WebApi/entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh + +RUN apk add icu-libs +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false + CMD ["entrypoint.sh"] diff --git a/accounts-api/src/WebApi/UseCases/V1/Accounts/OpenAccount/AccountsController.cs b/accounts-api/src/WebApi/UseCases/V1/Accounts/OpenAccount/AccountsController.cs index 26c1d0dc..bf9cce6c 100644 --- a/accounts-api/src/WebApi/UseCases/V1/Accounts/OpenAccount/AccountsController.cs +++ b/accounts-api/src/WebApi/UseCases/V1/Accounts/OpenAccount/AccountsController.cs @@ -61,7 +61,9 @@ void IOutputPort.Ok(Account account) => [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(OpenAccountResponse))] [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(OpenAccountResponse))] [ApiConventionMethod(typeof(CustomApiConventions), nameof(CustomApiConventions.Post))] +#pragma warning disable SCS0016 // Controller method is potentially vulnerable to Cross Site Request Forgery (CSRF). public async Task Post( +#pragma warning restore SCS0016 // Controller method is potentially vulnerable to Cross Site Request Forgery (CSRF). [FromServices] IOpenAccountUseCase useCase, [FromForm] [Required] decimal amount, [FromForm] [Required] string currency) diff --git a/accounts-api/src/WebApi/UseCases/V1/Transactions/Deposit/TransactionsController.cs b/accounts-api/src/WebApi/UseCases/V1/Transactions/Deposit/TransactionsController.cs index 3e54f1ee..5a9e5cd0 100644 --- a/accounts-api/src/WebApi/UseCases/V1/Transactions/Deposit/TransactionsController.cs +++ b/accounts-api/src/WebApi/UseCases/V1/Transactions/Deposit/TransactionsController.cs @@ -63,7 +63,9 @@ void IOutputPort.Ok(Credit credit, Account account) => [HttpPatch("{accountId:guid}/Deposit")] [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(DepositResponse))] [ApiConventionMethod(typeof(CustomApiConventions), nameof(CustomApiConventions.Patch))] +#pragma warning disable SCS0016 // Controller method is potentially vulnerable to Cross Site Request Forgery (CSRF). public async Task Deposit( +#pragma warning restore SCS0016 // Controller method is potentially vulnerable to Cross Site Request Forgery (CSRF). [FromServices] IDepositUseCase useCase, [FromRoute] [Required] Guid accountId, [FromForm] [Required] decimal amount, diff --git a/accounts-api/src/WebApi/UseCases/V1/Transactions/Transfer/TransactionsController.cs b/accounts-api/src/WebApi/UseCases/V1/Transactions/Transfer/TransactionsController.cs index 03b0a7cc..5703d3d2 100644 --- a/accounts-api/src/WebApi/UseCases/V1/Transactions/Transfer/TransactionsController.cs +++ b/accounts-api/src/WebApi/UseCases/V1/Transactions/Transfer/TransactionsController.cs @@ -67,7 +67,9 @@ void IOutputPort.Ok(Account originAccount, Debit debit, Account destinationAccou [HttpPatch("{accountId:guid}/{destinationAccountId:guid}")] [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(TransferResponse))] [ApiConventionMethod(typeof(CustomApiConventions), nameof(CustomApiConventions.Patch))] +#pragma warning disable SCS0016 // Controller method is potentially vulnerable to Cross Site Request Forgery (CSRF). public async Task Transfer( +#pragma warning restore SCS0016 // Controller method is potentially vulnerable to Cross Site Request Forgery (CSRF). [FromServices] ITransferUseCase useCase, [FromRoute] [Required] Guid accountId, [FromRoute] [Required] Guid destinationAccountId, diff --git a/accounts-api/src/WebApi/UseCases/V1/Transactions/Withdraw/TransactionsController.cs b/accounts-api/src/WebApi/UseCases/V1/Transactions/Withdraw/TransactionsController.cs index e081834a..4e5984e3 100644 --- a/accounts-api/src/WebApi/UseCases/V1/Transactions/Withdraw/TransactionsController.cs +++ b/accounts-api/src/WebApi/UseCases/V1/Transactions/Withdraw/TransactionsController.cs @@ -72,7 +72,9 @@ void IOutputPort.Ok(Debit debit, Account account) => [HttpPatch("{accountId:guid}/Withdraw")] [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(WithdrawResponse))] [ApiConventionMethod(typeof(CustomApiConventions), nameof(CustomApiConventions.Patch))] +#pragma warning disable SCS0016 // Controller method is potentially vulnerable to Cross Site Request Forgery (CSRF). public async Task Withdraw( +#pragma warning restore SCS0016 // Controller method is potentially vulnerable to Cross Site Request Forgery (CSRF). [FromServices] IWithdrawUseCase useCase, [FromRoute] [Required] Guid accountId, [FromForm] [Required] decimal amount, diff --git a/accounts-api/src/WebApi/WebApi.csproj b/accounts-api/src/WebApi/WebApi.csproj index 82969ff7..099734ee 100644 --- a/accounts-api/src/WebApi/WebApi.csproj +++ b/accounts-api/src/WebApi/WebApi.csproj @@ -38,16 +38,15 @@ - + all runtime; build; native; contentfiles; analyzers - + all runtime; build; native; contentfiles; analyzers - - + all runtime; build; native; contentfiles; analyzers @@ -55,27 +54,27 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - + + + + + + + - - + + diff --git a/accounts-api/src/WebApi/key-72c2ccaa-af98-4798-98b6-2717633c0f5b.xml b/accounts-api/src/WebApi/key-735c3c44-2bf6-4a13-8fbc-fa34519cefc8.xml similarity index 57% rename from accounts-api/src/WebApi/key-72c2ccaa-af98-4798-98b6-2717633c0f5b.xml rename to accounts-api/src/WebApi/key-735c3c44-2bf6-4a13-8fbc-fa34519cefc8.xml index 71f7e175..c64e998b 100644 --- a/accounts-api/src/WebApi/key-72c2ccaa-af98-4798-98b6-2717633c0f5b.xml +++ b/accounts-api/src/WebApi/key-735c3c44-2bf6-4a13-8fbc-fa34519cefc8.xml @@ -1,15 +1,15 @@  - - 2020-09-12T22:27:59.922448Z - 2020-09-12T22:27:59.852189Z - 2020-12-11T22:27:59.852189Z - + + 2021-07-02T22:30:04.8637307Z + 2021-07-02T22:30:04.8503099Z + 2021-09-30T22:30:04.8503099Z + - k9486TWrPRhbOwRBl/CSyQ+LF4cLmT+TVd5WrJKQVWAcjtmvBtggn/u0z6PqztnmnK8/0zZzz0z3aDQfHFs9TA== + 2NUYCsNQ1NwL8c5eoM4Z3/PJYURLVEANaGPExPREn1C7H4q9kYST57Ixn7liJJgilm3V0kPuMaKsbTs2dzI5ag== diff --git a/accounts-api/test/ComponentTests/ComponentTests.csproj b/accounts-api/test/ComponentTests/ComponentTests.csproj index dfaf3854..a6e9644b 100644 --- a/accounts-api/test/ComponentTests/ComponentTests.csproj +++ b/accounts-api/test/ComponentTests/ComponentTests.csproj @@ -12,14 +12,17 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/accounts-api/test/EndToEndTests/EndToEndTests.csproj b/accounts-api/test/EndToEndTests/EndToEndTests.csproj index dfaf3854..a6e9644b 100644 --- a/accounts-api/test/EndToEndTests/EndToEndTests.csproj +++ b/accounts-api/test/EndToEndTests/EndToEndTests.csproj @@ -12,14 +12,17 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/accounts-api/test/IntegrationTests/IntegrationTests.csproj b/accounts-api/test/IntegrationTests/IntegrationTests.csproj index c4eeb4f6..3318d54a 100644 --- a/accounts-api/test/IntegrationTests/IntegrationTests.csproj +++ b/accounts-api/test/IntegrationTests/IntegrationTests.csproj @@ -12,14 +12,17 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/accounts-api/test/UnitTests/UnitTests.csproj b/accounts-api/test/UnitTests/UnitTests.csproj index b2ea7083..0aab7b97 100644 --- a/accounts-api/test/UnitTests/UnitTests.csproj +++ b/accounts-api/test/UnitTests/UnitTests.csproj @@ -12,14 +12,17 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/identity-server/IdentityServer.csproj b/identity-server/IdentityServer.csproj index 07acaea3..77b3b612 100644 --- a/identity-server/IdentityServer.csproj +++ b/identity-server/IdentityServer.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/identity-server/key-cdb485fc-6967-4f51-af4c-5d1467e4d4c4.xml b/identity-server/key-cdb485fc-6967-4f51-af4c-5d1467e4d4c4.xml new file mode 100644 index 00000000..5e446ac9 --- /dev/null +++ b/identity-server/key-cdb485fc-6967-4f51-af4c-5d1467e4d4c4.xml @@ -0,0 +1,16 @@ + + + 2021-07-02T22:29:32.0861806Z + 2021-07-02T22:29:32.025172Z + 2021-09-30T22:29:32.025172Z + + + + + + + XGDHsTlVXhJmwEKy9SEeZ7RKDnPWOub8yX7Z0OeNdrsodOVQ6t8zHC3a04QpObvR/ZIyA/PRlI+2jSaupFUPTA== + + + + \ No newline at end of file diff --git a/wallet-spa/Dockerfile b/wallet-spa/Dockerfile index d6a1f4b3..4cbf7864 100644 --- a/wallet-spa/Dockerfile +++ b/wallet-spa/Dockerfile @@ -1,16 +1,20 @@ -FROM node:latest -# Create app directory -WORKDIR /usr/src/app -# Install app dependencies -COPY package*.json ./ +FROM node:9-alpine -RUN npm install -# Copy app source code -COPY . . +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app +COPY . /usr/src/app ARG ENV ENV ENV ${ENV} -#Expose port and start application +# --no-cache: download package index on-the-fly, no need to cleanup afterwards +# --virtual: bundle packages, remove whole bundle at once, when done +RUN apk --no-cache --virtual build-dependencies add \ + python \ + make \ + g++ \ + && npm install \ + && apk del build-dependencies + EXPOSE 3000 CMD npm run start-${ENV} \ No newline at end of file