From 6a7fc04519919bd7a4a66b17ccd311ad237e3059 Mon Sep 17 00:00:00 2001 From: Keith Perfetti Date: Wed, 23 Jul 2025 19:02:46 -0400 Subject: [PATCH 1/8] We are attached --- bin/build_github.sh | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/bin/build_github.sh b/bin/build_github.sh index 36f822c..05da9af 100755 --- a/bin/build_github.sh +++ b/bin/build_github.sh @@ -1,14 +1,4 @@ #!/bin/bash -if [ ! -f .env ]; then - export FRONTEND_BUILD_CONTEXT="https://${GH_TOKEN}@${FRONTEND_REPO_URL}#${FRONTEND_REF}" - export API_BUILD_CONTEXT="https://${GH_TOKEN}@${API_REPO_URL}#${API_REF}" - export BACKEND_BUILD_CONTEXT="https://${GH_TOKEN}@${BACKEND_REPO_URL}#${BACKEND_REF}" - - echo "" >> .env - echo "FRONTEND_BUILD_CONTEXT='${FRONTEND_BUILD_CONTEXT}'" >> .env - echo "API_BUILD_CONTEXT='${API_BUILD_CONTEXT}'" >> .env - echo "BACKEND_BUILD_CONTEXT='${BACKEND_BUILD_CONTEXT}'" >> .env -fi source .env @@ -25,4 +15,4 @@ docker compose exec nginx nginx -s reload docker rm nginx_tmp # Run Docker Compose without local volumes -docker-compose --profile core up --build --no-deps -d +docker-compose --profile core up --build --no-deps From 7c57f80d31f3e7d5974b0217aa2ddf59840212fd Mon Sep 17 00:00:00 2001 From: Keith Perfetti Date: Wed, 23 Jul 2025 19:05:08 -0400 Subject: [PATCH 2/8] stopping github testing since we are optimizing for circleci --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index af5891d..582411d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,6 +35,7 @@ env: jobs: test: + if: false runs-on: ubuntu-latest steps: From ffa9a0bdfe140a1b4042c2a8bb6f6e54b856deac Mon Sep 17 00:00:00 2001 From: Keith Perfetti Date: Wed, 23 Jul 2025 19:08:52 -0400 Subject: [PATCH 3/8] build github needs to be detached --- bin/build_github.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/build_github.sh b/bin/build_github.sh index 05da9af..d4ae433 100755 --- a/bin/build_github.sh +++ b/bin/build_github.sh @@ -15,4 +15,4 @@ docker compose exec nginx nginx -s reload docker rm nginx_tmp # Run Docker Compose without local volumes -docker-compose --profile core up --build --no-deps +docker-compose --profile core up --build --no-deps -d From 70bd74afa4a846e7953bc260f446f9dad4d2d8c7 Mon Sep 17 00:00:00 2001 From: Keith Perfetti Date: Wed, 23 Jul 2025 19:19:05 -0400 Subject: [PATCH 4/8] fixing readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 5cd4136..dce04ee 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,13 @@ Example for a blog post about nginx docker compose Set your environment variables & initialize submodules ```bash cp .env.sample .env +echo "GH_TOKEN=" > .env source .env git submodule sync git submodule update --init --recursive + +./bin/build_local.sh ``` From 951f5b28bb7b01eca091f0ced4ca34ced594d6ed Mon Sep 17 00:00:00 2001 From: Keith Perfetti Date: Wed, 23 Jul 2025 19:24:24 -0400 Subject: [PATCH 5/8] fixing test configuration --- test/README.md | 2 +- test/cypress/e2e/books_flow.cy.js | 38 +++++++++++++++++-------------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/test/README.md b/test/README.md index 96e0819..6fcaf77 100644 --- a/test/README.md +++ b/test/README.md @@ -24,7 +24,7 @@ npm install ```bash # Open Cypress GUI for development -npm run test:local +npm run test:gui # Run tests headlessly npm test diff --git a/test/cypress/e2e/books_flow.cy.js b/test/cypress/e2e/books_flow.cy.js index 5525214..44af61d 100644 --- a/test/cypress/e2e/books_flow.cy.js +++ b/test/cypress/e2e/books_flow.cy.js @@ -4,6 +4,13 @@ describe("Books Flow", () => { cy.resetTestData(); }); + function fillInBookForm({title, publisher, author, isbn}) { + cy.get('input[placeholder="Enter book title"]').type(title); + cy.get('input[placeholder="Enter book publisher"]').type(publisher); + cy.get('input[placeholder="Enter book author"]').type(author); + cy.get('input[placeholder="Enter book ISBN"]').type(isbn); + } + it("allows proposing and approving books", () => { // Visit React1 app (root path) cy.visit("/"); @@ -11,14 +18,12 @@ describe("Books Flow", () => { // Propose a new book cy.contains("button", "Propose New Book").click(); - cy.get('input[placeholder="Enter book title"]').type("Test Book Title"); - cy.get('input[placeholder="Enter book publisher"]').type( - "Test Author Name" - ); - cy.get('input[placeholder="Enter book author"]').type( - "Test Publisher Name" - ); - cy.get('input[placeholder="Enter book ISBN"]').type("1234567890"); + fillInBookForm({ + title: "Test Book Title", + publisher: "Test Author Name", + author: "Test Publisher Name", + isbn: "1234567890", + }); cy.contains("button", "Submit").click(); // Visit React2 app (/backend path) @@ -45,21 +50,20 @@ describe("Books Flow", () => { it("allows denying provisional books", () => { // Visit React1 app - cy.visit("/backend"); - + cy.visit("/"); // Propose a new book cy.contains("button", "Propose New Book").click(); - cy.get('input[placeholder="Enter book title"]').type("Book To Deny"); - cy.get('input[placeholder="Enter book publisher"]').type( - "Test Author Name" - ); - cy.get('input[placeholder="Enter book author"]').type( - "Test Publisher Name" - ); + fillInBookForm({ + title: "Book To Deny", + publisher: "Test Author Name", + author: "Test Publisher Name", + isbn: "1234567890", + }); cy.contains("button", "Submit").click(); // Visit React2 app and deny the book cy.visit("/backend/"); + cy.contains("Provisional Books"); cy.contains(".book-item", "Book To Deny") .contains("button", "Deny") .click(); From 6be545316743b63abf0cacd857bc591b26652490 Mon Sep 17 00:00:00 2001 From: Keith Perfetti Date: Wed, 23 Jul 2025 19:36:19 -0400 Subject: [PATCH 6/8] frontend really needed something --- repo_refs/react1-app | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repo_refs/react1-app b/repo_refs/react1-app index b8bbbc2..06a5ac9 160000 --- a/repo_refs/react1-app +++ b/repo_refs/react1-app @@ -1 +1 @@ -Subproject commit b8bbbc2b9e501d359b3e0f1238883703987c02b0 +Subproject commit 06a5ac987bcad09e75074f517e8e9e66fe21999c From bacd7219891c943e1db3040f4b6f46889728c401 Mon Sep 17 00:00:00 2001 From: Keith Perfetti Date: Wed, 23 Jul 2025 19:43:40 -0400 Subject: [PATCH 7/8] fixing readme --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index dce04ee..1cb7244 100644 --- a/README.md +++ b/README.md @@ -60,3 +60,13 @@ Once the container is up and running, you can hit `http://localhost:8089/` it `/ `http://localhost:8089/backend/` will route you to the backend service. `http://localhost:8089/api/` will route you to the backend service with the api path. + + +## Running the Test suite + +In the directory `test` you'll find a cypress test suite. In here is our business logic testing. It is a marvel of modern cypriotic book approval/censorship. After you have `bin/build_local.sh` running, follow the instructions in `./test/README.md` and boot up the Cypress tests. + +## What on earth are these services? +React1(localhost:8089/) - a frontend application allowing users to reccomend books for listing. +React2(localhost:8089/backend) - Super secret admin panel app allowing admins to approve or deny books for listing +Rails(localhost:8089/api/books) - Api holding the data, performing business logic. ¡Truly revolutionary! From 647fdcd51ec38b4bffc938b5de80a317dda353b8 Mon Sep 17 00:00:00 2001 From: Keith Perfetti Date: Wed, 23 Jul 2025 19:46:26 -0400 Subject: [PATCH 8/8] fixing github build --- bin/build_github.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bin/build_github.sh b/bin/build_github.sh index d4ae433..a613af4 100755 --- a/bin/build_github.sh +++ b/bin/build_github.sh @@ -1,4 +1,12 @@ #!/bin/bash +if [ ! -f .env ]; then + export FRONTEND_BUILD_CONTEXT="https://${GH_TOKEN}@${FRONTEND_REPO_URL}#${FRONTEND_REF}" + export API_BUILD_CONTEXT="https://${GH_TOKEN}@${API_REPO_URL}#${API_REF}" + export BACKEND_BUILD_CONTEXT="https://${GH_TOKEN}@${BACKEND_REPO_URL}#${BACKEND_REF}" + echo "FRONTEND_BUILD_CONTEXT=${FRONTEND_BUILD_CONTEXT}" >> .env + echo "API_BUILD_CONTEXT=${API_BUILD_CONTEXT}" >> .env + echo "BACKEND_BUILD_CONTEXT=${BACKEND_BUILD_CONTEXT}" >> .env +fi source .env