From 508ceec539213e97d36e36799121caa7f4540f06 Mon Sep 17 00:00:00 2001 From: FerSanchez <72047538+fersan1985@users.noreply.github.com> Date: Fri, 22 Jul 2022 16:11:48 -0300 Subject: [PATCH 01/11] Added the port (#244) (#245) Co-authored-by: Fernando Sanchez Co-authored-by: Fernando Sanchez --- backend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index a2e82d2f1..bcf9ce773 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -20,7 +20,7 @@ RUN CGO_ENABLED=0 go build -o flow-voting-tool-server ./main FROM alpine:latest ENV CWD "/flow-voting-tool/" -ENV SNAPSHOT_BASE_URL "http://snapshot-flow-balances-svc.cast.svc.cluster.local" +ENV SNAPSHOT_BASE_URL "http://snapshot-flow-balances-svc.cast.svc.cluster.local:8008" ENV TX_OPTIONS_ADDRS "0xe0de919ed4ebeee4 0x7f81b82fa0e59b17" RUN apk --no-cache add ca-certificates COPY --from=vt-build /flow-voting-tool /flow-voting-tool From 6a41ab994165b7dd22551a9893f93e47d348d7bf Mon Sep 17 00:00:00 2001 From: FerSanchez <72047538+fersan1985@users.noreply.github.com> Date: Tue, 2 Aug 2022 14:53:09 -0300 Subject: [PATCH 02/11] Nginx change (#329) (#330) Co-authored-by: Fernando Sanchez Co-authored-by: Fernando Sanchez --- frontend/Dockerfile.stage | 3 ++- frontend/deploy/nginx.conf | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/Dockerfile.stage b/frontend/Dockerfile.stage index ac7ed90d5..d76d2e37f 100644 --- a/frontend/Dockerfile.stage +++ b/frontend/Dockerfile.stage @@ -26,6 +26,7 @@ FROM nginx:latest as production-stage RUN mkdir -p /var/run/nginx-cache && chmod 0755 /var/run/nginx-cache WORKDIR /app COPY --from=build-stage /app/packages/client/build /app +COPY ./packages/client/public/cast.png /app COPY ./deploy/nginx.conf /etc/nginx/nginx.conf EXPOSE 80 -RUN ls -la /app \ No newline at end of file +RUN ls -la /app diff --git a/frontend/deploy/nginx.conf b/frontend/deploy/nginx.conf index b1c38cebf..fb77587e0 100644 --- a/frontend/deploy/nginx.conf +++ b/frontend/deploy/nginx.conf @@ -27,8 +27,7 @@ http { index index.html; try_files $uri $uri/ /index.html; } - location /cast.png { - root /cast.png; + location /app/cast.png{ } location /js/script.js { # Change this if you use a different variant of the script @@ -62,4 +61,4 @@ http { root /usr/share/nginx/html; } } -} \ No newline at end of file +} From b613521024c538752c6cea86ffeceedcd3f59c89 Mon Sep 17 00:00:00 2001 From: David Slone Date: Mon, 22 Aug 2022 15:42:21 -0700 Subject: [PATCH 03/11] fix latest tag --- .github/workflows/update-prod.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-prod.yaml b/.github/workflows/update-prod.yaml index 0cc201aec..b0ee257d5 100644 --- a/.github/workflows/update-prod.yaml +++ b/.github/workflows/update-prod.yaml @@ -68,7 +68,7 @@ jobs: - name: Build Docker image from release id: docker-from-release run: | - export TAG=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ env.github_token }}" https://api.github.com/repos/DapperCollectives/CAST/releases/latest | jq -r '.tag_name') + export TAG=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/DapperCollectives/CAST/releases/latest | jq -r '.tag_name') cd backend && docker build . -t bruddev/cast-backend:$TAG && docker push bruddev/cast-backend:$TAG ## ARGO FROM HERE @@ -95,7 +95,7 @@ jobs: run: | curl -fL https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.5/kustomize_v4.5.5_linux_amd64.tar.gz| tar xz && \ chmod +x kustomize - export TAG=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ env.github_token }}" https://api.github.com/repos/DapperCollectives/CAST/releases/latest | jq -r '.tag_name') + export TAG=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/DapperCollectives/CAST/releases/latest | jq -r '.tag_name') cd ./argo/voting-tool-stage-prod/backend/environments/prod && kustomize edit set image bruddev/cast-backend:$TAG git config --global user.email "brunkins@brudfyi.com" git config --global user.name "Brunkins" @@ -125,7 +125,7 @@ jobs: - name: Build Docker image from release #TEST THIS id: docker-from-release run: | - export TAG=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ env.github_token }}" https://api.github.com/repos/DapperCollectives/CAST/releases/latest | jq -r '.tag_name') + export TAG=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/DapperCollectives/CAST/releases/latest | jq -r '.tag_name') cd frontend && docker build . -t bruddev/cast-frontend:$TAG && docker push bruddev/cast-frontend:$TAG ## ARGO FROM HERE @@ -152,7 +152,7 @@ jobs: run: | curl -fL https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.5/kustomize_v4.5.5_linux_amd64.tar.gz| tar xz && \ chmod +x kustomize - export TAG=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ env.github_token }}" https://api.github.com/repos/DapperCollectives/CAST/releases/latest | jq -r '.tag_name') + export TAG=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/DapperCollectives/CAST/releases/latest | jq -r '.tag_name') cd ./argo/voting-tool-stage-prod/frontend/environments/prod && kustomize edit set image bruddev/cast-frontend:$TAG git config --global user.email "brunkins@brudfyi.com" git config --global user.name "Brunkins" From ab8d6da8445dfa0e60d273327bbc449029af1036 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 19 Sep 2022 09:00:06 -0700 Subject: [PATCH 04/11] Main -> Staging (#500) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix payload for removing users (#498) fix payload Co-authored-by: German UrrustarazĂș --- frontend/packages/client/src/api/communityUsers.js | 4 ++-- .../packages/client/src/hooks/useCommunityUsersMutation.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/packages/client/src/api/communityUsers.js b/frontend/packages/client/src/api/communityUsers.js index f4fa06b5b..f7058f696 100644 --- a/frontend/packages/client/src/api/communityUsers.js +++ b/frontend/packages/client/src/api/communityUsers.js @@ -35,7 +35,7 @@ export const addUserToCommunityUserApiRep = async ({ export const deleteCommunityMemberApiReq = async ({ communityId, addr, - hexTime, + timestamp, compositeSignatures, voucher, userType = 'member', @@ -53,7 +53,7 @@ export const deleteCommunityMemberApiReq = async ({ addr, userType, signingAddr, - timestamp: hexTime, + timestamp, compositeSignatures, voucher, }), diff --git a/frontend/packages/client/src/hooks/useCommunityUsersMutation.js b/frontend/packages/client/src/hooks/useCommunityUsersMutation.js index 5bde20fb1..c3f1fc99c 100644 --- a/frontend/packages/client/src/hooks/useCommunityUsersMutation.js +++ b/frontend/packages/client/src/hooks/useCommunityUsersMutation.js @@ -80,11 +80,11 @@ export default function useCommunityUsersMutation({ communityId } = {}) { const addCommunityUsers = useCallback( async ({ userType, addrs, body }) => { return new Promise((resolve, reject) => { - addrs.forEach((addrToRemove) => { + addrs.forEach((addrToAdd) => { mutate( { communityId, - addr: addrToRemove, + addr: addrToAdd, userType, ...body, actionType: 'add', From 3ca1949b3cd78f21cd9b28124490cb6ea2fc1120 Mon Sep 17 00:00:00 2001 From: German Urrustarazu Date: Tue, 20 Sep 2022 13:28:50 -0300 Subject: [PATCH 05/11] hide react-query icon --- frontend/packages/client/src/App.js | 3 ++- frontend/packages/client/src/const/index.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/packages/client/src/App.js b/frontend/packages/client/src/App.js index 0dab3c38c..7cd3680fe 100644 --- a/frontend/packages/client/src/App.js +++ b/frontend/packages/client/src/App.js @@ -5,6 +5,7 @@ import { HashRouter as Router } from 'react-router-dom'; import NotificationModalProvider from 'contexts/NotificationModal'; import { Web3Provider } from 'contexts/Web3'; import { ErrorHandler } from 'components'; +import { IS_PRODUCTION } from 'const'; import Hotjar from '@hotjar/browser'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; @@ -36,7 +37,7 @@ function App() { - + {!IS_PRODUCTION && } ); diff --git a/frontend/packages/client/src/const/index.js b/frontend/packages/client/src/const/index.js index dae31049b..e7d5a7fc2 100644 --- a/frontend/packages/client/src/const/index.js +++ b/frontend/packages/client/src/const/index.js @@ -14,6 +14,9 @@ export const COMMUNITY_DESCRIPTION_MAX_LENGTH = 1000; export const HAS_DELAY_ON_START_TIME = process.env.REACT_APP_APP_ENV?.toUpperCase() === 'PRODUCTION'; +export const IS_PRODUCTION = + process.env.REACT_APP_APP_ENV?.toUpperCase() === 'PRODUCTION'; + export const FilterValues = { all: 'All', active: 'Active', From 7f581dc17a053a4b2aeb956847a883593d38a58a Mon Sep 17 00:00:00 2001 From: jacksonfoley Date: Wed, 21 Sep 2022 14:20:29 -0600 Subject: [PATCH 06/11] only set to in DEV and TEST environments --- backend/main/server/app.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/main/server/app.go b/backend/main/server/app.go index edab48b3f..0cbd39f78 100644 --- a/backend/main/server/app.go +++ b/backend/main/server/app.go @@ -127,10 +127,21 @@ func (a *App) Initialize() { // Postgres dbname := os.Getenv("DB_NAME") + + // IPFS + flag.Bool("ipfs-override", false, "overrides ipfs call") + + // TEST Env if os.Getenv("APP_ENV") == "TEST" { dbname = os.Getenv("TEST_DB_NAME") + flag.Bool("ipfs-override", true, "overrides ipfs call") + } + // DEV Env + if os.Getenv("APP_ENV") == "DEV" { + flag.Bool("ipfs-override", true, "overrides ipfs call") } + // Postgres a.ConnectDB( os.Getenv("DB_USERNAME"), os.Getenv("DB_PASSWORD"), From 514a70a19851a039223bdf6425506476a5bab004 Mon Sep 17 00:00:00 2001 From: jacksonfoley Date: Wed, 21 Sep 2022 15:00:23 -0600 Subject: [PATCH 07/11] adds migration to increase vote message max length --- .../migrations/000039_increase_vote_message_max_length.down.sql | 1 + .../migrations/000039_increase_vote_message_max_length.up.sql | 1 + 2 files changed, 2 insertions(+) create mode 100644 backend/migrations/000039_increase_vote_message_max_length.down.sql create mode 100644 backend/migrations/000039_increase_vote_message_max_length.up.sql diff --git a/backend/migrations/000039_increase_vote_message_max_length.down.sql b/backend/migrations/000039_increase_vote_message_max_length.down.sql new file mode 100644 index 000000000..91ca60f88 --- /dev/null +++ b/backend/migrations/000039_increase_vote_message_max_length.down.sql @@ -0,0 +1 @@ +-- no going back! \ No newline at end of file diff --git a/backend/migrations/000039_increase_vote_message_max_length.up.sql b/backend/migrations/000039_increase_vote_message_max_length.up.sql new file mode 100644 index 000000000..804d8225b --- /dev/null +++ b/backend/migrations/000039_increase_vote_message_max_length.up.sql @@ -0,0 +1 @@ +ALTER TABLE votes ALTER COLUMN message TYPE VARCHAR(1024); \ No newline at end of file From b1189909bf1f51147db86ac3cf34299f5e9f3d3e Mon Sep 17 00:00:00 2001 From: jacksonfoley Date: Wed, 21 Sep 2022 15:02:39 -0600 Subject: [PATCH 08/11] fix migration order --- ....down.sql => 000041_increase_vote_message_max_length.down.sql} | 0 ...ngth.up.sql => 000041_increase_vote_message_max_length.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename backend/migrations/{000039_increase_vote_message_max_length.down.sql => 000041_increase_vote_message_max_length.down.sql} (100%) rename backend/migrations/{000039_increase_vote_message_max_length.up.sql => 000041_increase_vote_message_max_length.up.sql} (100%) diff --git a/backend/migrations/000039_increase_vote_message_max_length.down.sql b/backend/migrations/000041_increase_vote_message_max_length.down.sql similarity index 100% rename from backend/migrations/000039_increase_vote_message_max_length.down.sql rename to backend/migrations/000041_increase_vote_message_max_length.down.sql diff --git a/backend/migrations/000039_increase_vote_message_max_length.up.sql b/backend/migrations/000041_increase_vote_message_max_length.up.sql similarity index 100% rename from backend/migrations/000039_increase_vote_message_max_length.up.sql rename to backend/migrations/000041_increase_vote_message_max_length.up.sql From 0b13d3bafe09f2081f9f17d1577fa4c8fa2dd08d Mon Sep 17 00:00:00 2001 From: jacksonfoley Date: Wed, 21 Sep 2022 15:21:17 -0600 Subject: [PATCH 09/11] remove duplicate flag.Bool call --- backend/main/server/app.go | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/main/server/app.go b/backend/main/server/app.go index 5490b6339..979cbbc06 100644 --- a/backend/main/server/app.go +++ b/backend/main/server/app.go @@ -116,7 +116,6 @@ func (a *App) Initialize() { // when running "make proposals" sets db to dev not test arg := flag.String("db", "", "database type") - flag.Bool("ipfs-override", true, "overrides ipfs call") flag.Int("port", 5001, "port") flag.Int("amount", 4, "Amount of proposals to create") From 95cb4ed25511967c03d8f15baab2c4fc0070a8d2 Mon Sep 17 00:00:00 2001 From: jacksonfoley Date: Wed, 21 Sep 2022 15:25:06 -0600 Subject: [PATCH 10/11] only call flag.Bool('ipfs-override') once --- backend/main/server/app.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/backend/main/server/app.go b/backend/main/server/app.go index 979cbbc06..f4a9dec08 100644 --- a/backend/main/server/app.go +++ b/backend/main/server/app.go @@ -128,16 +128,15 @@ func (a *App) Initialize() { dbname := os.Getenv("DB_NAME") // IPFS - flag.Bool("ipfs-override", false, "overrides ipfs call") + if os.Getenv("APP_ENV") == "TEST" || os.Getenv("APP_ENV") == "DEV" { + flag.Bool("ipfs-override", true, "overrides ipfs call") + } else { + flag.Bool("ipfs-override", false, "overrides ipfs call") + } // TEST Env if os.Getenv("APP_ENV") == "TEST" { dbname = os.Getenv("TEST_DB_NAME") - flag.Bool("ipfs-override", true, "overrides ipfs call") - } - // DEV Env - if os.Getenv("APP_ENV") == "DEV" { - flag.Bool("ipfs-override", true, "overrides ipfs call") } // Postgres From 5fe22e82f072ad0f84a2d4e61f25509590bbaa49 Mon Sep 17 00:00:00 2001 From: jacksonfoley Date: Wed, 21 Sep 2022 15:29:58 -0600 Subject: [PATCH 11/11] change votes.message column to TEXT instead of VARCHAR --- .../migrations/000041_increase_vote_message_max_length.up.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/migrations/000041_increase_vote_message_max_length.up.sql b/backend/migrations/000041_increase_vote_message_max_length.up.sql index 804d8225b..397527d5b 100644 --- a/backend/migrations/000041_increase_vote_message_max_length.up.sql +++ b/backend/migrations/000041_increase_vote_message_max_length.up.sql @@ -1 +1 @@ -ALTER TABLE votes ALTER COLUMN message TYPE VARCHAR(1024); \ No newline at end of file +ALTER TABLE votes ALTER COLUMN message TYPE TEXT; \ No newline at end of file