Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnSancho GovTool v1.0.13 candidate #1692

Merged
merged 24 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ac38100
fix: frontend votes info copy and other minor spelling in copu
Ryun1 Aug 5, 2024
88ddda6
chore: add mock metadata with random value
kneerose Aug 5, 2024
82061bb
chore: add function to upload mock metadata and calculate hash
kneerose Aug 5, 2024
3a9fe6e
chore: update register dRep anchor with uploaded metadata URL and gen…
kneerose Aug 5, 2024
b850faf
chore: refactor naming and valid matadata
kneerose Aug 6, 2024
4ee15a2
Merge pull request #1678 from IntersectMBO/bugfix/incorrect-dRep-meta…
kneerose Aug 6, 2024
239bb4e
chore: append a timestamp to valid username and remove unnecessary to…
kneerose Aug 6, 2024
cfd5b11
Merge pull request #1681 from IntersectMBO/refactor/username-format
kneerose Aug 6, 2024
63a5b0c
feat(#1644): add missing network metrics model to frontend service
MSzalowski Jul 31, 2024
2f3d2f0
chore: remove occurencies of sanchonet from contributing guide
MSzalowski Jul 31, 2024
35c14d7
feat: replace hardcoded sanchonet with the network from network metrics
MSzalowski Aug 6, 2024
1ddf878
chore: update codeowner
MSzalowski Aug 7, 2024
ea8609d
fix(#1687): fix building metadata body
MSzalowski Aug 7, 2024
5a1d746
feat: replace app logo image
MSzalowski Aug 7, 2024
edc14ee
Merge pull request #1684 from IntersectMBO/feat/1637-replace-sanchone…
MSzalowski Aug 7, 2024
e750390
Merge pull request #1691 from IntersectMBO/develop
MSzalowski Aug 7, 2024
b9fb302
Merge pull request #1689 from IntersectMBO/1687-metadatada-jsonld-add…
MSzalowski Aug 7, 2024
b20009c
fix: fix pdf not enabled in default deployments
MSzalowski Aug 7, 2024
fb735fc
chore: adjust testing code owners
Ryun1 Aug 7, 2024
1f64046
Merge pull request #1690 from IntersectMBO/chore/update-codeowner
MSzalowski Aug 7, 2024
4056b1b
Merge pull request #1693 from IntersectMBO/fix/pdf-not-enabled-in-def…
MSzalowski Aug 7, 2024
656f9aa
fix: fix displaying wrong network
MSzalowski Aug 7, 2024
6d18f40
Merge pull request #1695 from IntersectMBO/fix/wrong-network-info-on-…
MSzalowski Aug 7, 2024
080cee6
Merge pull request #1698 from IntersectMBO/develop
MSzalowski Aug 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
SENTRY_IGNORE_API_RESOLUTION_ERROR: "1"
TRAEFIK_LE_EMAIL: "admin+govtool@binarapps.com"
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: ${{github.event_name == 'push' && 'false' || inputs.isProposalDiscussionForumEnabled == 'enabled'}}
IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: ${{github.event_name == 'push' && 'true' || inputs.isProposalDiscussionForumEnabled == 'enabled'}}
PDF_API_URL: ${{ secrets.PDF_API_URL}}
steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
SENTRY_IGNORE_API_RESOLUTION_ERROR: "1"
TRAEFIK_LE_EMAIL: "admin+govtool@binarapps.com"
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: ${{github.event_name == 'push' && 'false' || inputs.isProposalDiscussionForumEnabled == 'enabled'}}
IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: ${{github.event_name == 'push' && 'true' || inputs.isProposalDiscussionForumEnabled == 'enabled'}}
PDF_API_URL: ${{ secrets.PDF_API_URL}}
steps:
- name: Checkout code
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ changes.

### Added

-
- Unsancho GovTool [Issue 1637](https://github.com/IntersectMBO/govtool/issues/1637)
- Add network metrics model to frontend service

### Fixed

-
- Incorrect copy on DRep votes + other minor copy spelling mistakes
- Remove incorrect @value property to fix validating the metadata body [Issue 1687](https://github.com/IntersectMBO/govtool/issues/1687)
- Fix PDF not enabled in default deployments
- Fix displaying incorrect connected to Voltaire GovTool network

### Changed

Expand Down
12 changes: 6 additions & 6 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* @Ryun1 @MSzalowski

# Frontend assets templates
govtool/frontend/* @MSzalowski @Sworzen1 @JanJaroszczak
*.tsx @MSzalowski @Sworzen1 @JanJaroszczak
*.ts @MSzalowski @Sworzen1 @JanJaroszczak
*.css @MSzalowski @Sworzen1 @JanJaroszczak
govtool/frontend/* @MSzalowski @jdyczka
*.tsx @MSzalowski @jdyczka
*.ts @MSzalowski @jdyczka
*.css @MSzalowski @jdyczka

# Backend
govtool/backend/* @MSzalowski @jankun4
Expand All @@ -18,5 +18,5 @@ config/govtool/* @pla
infra/terraform/* @placek @adgud

# Testing
tests/* @IntersectMBO/govtool-test
gov-action-loader/* @IntersectMBO/govtool-test
tests/* @spannercode @mesudip @kneerose
gov-action-loader/* @spannercode @mesudip @kneerose
34 changes: 9 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
⚠️ This is a work in progress document, more instruction on how-to contribute to come!

Contributing todo:

- [ ] Align with latest OSC policies
- [ ] Refactor to reflect reality
- [ ] Make more friendly to open source contributors
Expand All @@ -21,9 +22,9 @@ This document contains guidelines to help you get started and how to make sure y
- [Ask for Help](#ask-for-help)
- [Roles and Responsibilities](#roles-and-responsibilities)
- [I Want To Contribute](#i-want-to-contribute)
- [Before Submitting a Bug Report](#before-submitting-a-bug-report)
- [How Do I Submit a Good Bug Report?](#how-do-i-submit-a-good-bug-report)
- [Your First Code Contribution](#your-first-code-contribution)
- [Before Submitting a Bug Report](#before-submitting-a-bug-report)
- [How Do I Submit a Good Bug Report?](#how-do-i-submit-a-good-bug-report)
- [Your First Code Contribution](#your-first-code-contribution)
- [Working Conventions](#working-conventions)
- [Pull Requests](#pull-requests)
- [Branch Naming](#branch-naming)
Expand All @@ -38,8 +39,6 @@ This document contains guidelines to help you get started and how to make sure y
- [CSS in Javascript](#css-in-javascript)
- [CSS / SASS](#css--sass)
- [Haskell](#haskell)
- [Bumping Node, DB-Sync, SanchoNet Versions](#bumping-node-db-sync-sanchonet-versions)
- [Steps to upgrade](#steps-to-upgrade)
- [Development Processes](#development-processes)
- [Developer workflow](#developer-workflow)
- [QA Workflow](#qa-workflow)
Expand Down Expand Up @@ -90,7 +89,7 @@ We use GitHub issues to track bugs and errors. If you run into an issue with the
(Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
- Explain the behavior you would expect and the actual behavior.
- Please provide as much context as possible.
Describe the *reproduction steps* that someone else can follow to recreate the issue on their own.
Describe the _reproduction steps_ that someone else can follow to recreate the issue on their own.
This usually includes your code.
For good bug reports you should isolate the problem and create a reduced test case.
- Provide the information you collected in the previous section.
Expand All @@ -117,6 +116,7 @@ TODO
Thank you for contributing your changes by opening a pull requests!

To get something merged we usually require:

- Follow the Pull Request template
- Description of the changes - if your commit messages are great, this is less important
- Quality of changes is ensured - through new or updated automated tests
Expand All @@ -133,6 +133,7 @@ Please reuse the branch naming for the pull request naming.
- Using the related issue number after the prefix is required.

Examples:

- `feat/123-added-ability-for-dreps-to-change-drep-id`
- `fix/312-fixed-drep-ids-being-reversed`
- `chore/567-bumped-cardano-node-version-to-9`
Expand All @@ -151,6 +152,7 @@ Also, include any relevant meta-information, such as issue numbers.
If a commit completely addresses a issue, you can put that in the headline if you want, but it’s fine to just put it in the body.

Here are seven rules for great git commit messages:

1. Separate subject from body with a blank line
2. Limit the subject line to 50 characters (soft limit)
3. Capitalize the subject line
Expand Down Expand Up @@ -190,6 +192,7 @@ Releases that aren't stable will be released as pre-releases and will append a -
### Changelog

During development, on every PR;

- Make sure `CHANGELOG.md` is kept up-to-date with high-level, technical, but user-focused list of changes according to [keepachangelog](https://keepachangelog.com/en/1.0.0/).
- Bump `UNRELEASED` version in `CHANGELOG.md` according to [semver](https://semver.org/).

Expand All @@ -211,25 +214,6 @@ Please see [CSS / SASS Style Guide](./docs/style-guides/css-sass/).

Please see [stylish-haskell configuration](./govtool/backend/.stylish-haskell.yaml).

## Bumping Node, DB-Sync, SanchoNet Versions

- SanchoNet periodically has to be respun, where all data is erased.
- This is normally to allow for the nodes to be upgraded to a new version, where the old chain may not be compatible with newer node implementation.
- So to go along with each respin GovTool's Node needs to upgraded to a newer version and it's local database must be dropped.
- New versions of DB-Sync are usually released alongside new Node versions, to ensure compatibility.
- Some new versions of DB-Sync will include revisions to the DB schema, if this is the case then we also need to upgrade the BE interface to work.

### Steps to upgrade

1. Coordinate and align with DB-Sync/Node teams to anticipate SanchoNet respins and version releases. Once network has been respun upgrade.
- Often a new node version is released a few days ahead of a Sanchonet respin, DB-Sync is normally a couple of days post node release.
2. Change the versions in the [docker-compose file](./src/docker-compose.sanchonet.yml), here the DB-Sync and Node docker versions can be incremented. Merge this change, following standard working conventions.
- IF the DB-Sync schema changed, then BE changes will have to be merged also.
3. Then the upgrade can be deployed using normal workflows, ensure to tick `resync_cardano_node_and_db` option of the workflow. This will wipe the existing Node and Db-Sync's data, to let the upgraded versions fully resync.
4. Wait for resync, depending on the size SanchoNet resycing will likely take over an hour.
5. Check successful resync, using the BE you are able to check transaction status. You can use the SanchoNet faucet to send transactions, then check faucet Tx id via GovTool BE. If GovTool sees the Tx then GovTool BE is on the same network as the faucet which is ideal.


## Development Processes

### Developer workflow
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@
</p>

<p align="center">
<big><strong>Monorepo containing SanchoNet GovTool and supporting utilities</strong></big>
<big><strong>Monorepo containing Voltaire GovTool and supporting utilities</strong></big>
</p>

<div align="center">

[![npm](https://img.shields.io/npm/v/npm.svg?style=flat-square)](https://www.npmjs.com/package/npm) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)


[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=intersect-govtool&metric=ncloc)](https://sonarcloud.io/summary/overall?id=intersect-govtool) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=intersect-govtool&metric=coverage)](https://sonarcloud.io/summary/overall?id=intersect-govtool) [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=intersect-govtool&metric=sqale_index)](https://sonarcloud.io/summary/overall?id=intersect-govtool)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=intersect-govtool&metric=ncloc)](https://sonarcloud.io/summary/overall?id=intersect-govtool) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=intersect-govtool&metric=coverage)](https://sonarcloud.io/summary/overall?id=intersect-govtool) [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=intersect-govtool&metric=sqale_index)](https://sonarcloud.io/summary/overall?id=intersect-govtool)

</div>

<hr/>

## 🌄 Purpose

The SanchoNet GovTool enables ada holders to experience some of the governance features described in [CIP-1694](https://github.com/cardano-foundation/CIPs/blob/master/CIP-1694/README.md) and to test governance features on [SanchoNet](https://sancho.network/) through a guided and straightforward experience.
The SanchoNet GovTool is currently open for beta testing and can be accessed at [sanchogov.tools](https://sanchogov.tools/).
The Voltaire GovTool enables ada holders to experience some of the governance features described in [CIP-1694](https://github.com/cardano-foundation/CIPs/blob/master/CIP-1694/README.md) and to test governance features.
The Voltaire GovTool is currently open for preview testing and can be accessed at [preview.gov.tools](https://preview.gov.tools/).

Learn more; [docs.sanchogov.tools](https://docs.sanchogov.tools/).

Expand Down
45 changes: 24 additions & 21 deletions docs/operations/README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,53 @@
# Overview

The application is setup with the following tools:
* Terraform - for creating infrastructure in AWS for each environment
* Docker - to build and run application components
* Docker Compose - to connect the application components together and deploy them as a stack
* make - to simplify operations tasks
* Prometheus - to gather metrics from application host and Docker containers
* Grafana - to visualize metrics gathered from Prometheus and handle alerting

- Terraform - for creating infrastructure in AWS for each environment
- Docker - to build and run application components
- Docker Compose - to connect the application components together and deploy them as a stack
- make - to simplify operations tasks
- Prometheus - to gather metrics from application host and Docker containers
- Grafana - to visualize metrics gathered from Prometheus and handle alerting

# Environments

The application is hosted on AWS, there are several application environments, each of them is described with Terraform in `src/terraform/main.tf` file. Terraform is executed manually, in order to add/modify/delete an environment, modify the code and run `terraform plan` to see the changes and `terraform apply` to execute them.

Each environment consists of:

* VPC network (with subnets, route tables, IGW)
* Security Groups
* EC2 instance
* Elastic IPs associated with EC2 instance
* Route 53 record (only for environments using `govtool.byron.network` domain)
- VPC network (with subnets, route tables, IGW)
- Security Groups
- EC2 instance
- Elastic IPs associated with EC2 instance
- Route 53 record (only for environments using `govtool.byron.network` domain)

For each environment, the frontend is hosted at root and the backend is at `/api`.

## List of public environments

### beta

A beta environment connected to `sanchonet` Cardano network.
A beta environment connected to `preview` Cardano network.

Available at https://sanchogov.tools/. The DNS record for this domain is created manually.
Available at https://preview.gov.tools/. The DNS record for this domain is created manually.

# Deployment

Deployment is performed via GitHub Actions workflow (`.github/workflows/build-and-deploy.yml`).

The workflow performs the following steps:
* check if the environment is defined in Terraform (to avoid deployment attempt to inexistant environment)
* build of frontend app
* build of backend app
* generate configuration files and upload them (over SSH) to the target environment
* setup the application compoments with Docker Compose on the target environment

- check if the environment is defined in Terraform (to avoid deployment attempt to inexistant environment)
- build of frontend app
- build of backend app
- generate configuration files and upload them (over SSH) to the target environment
- setup the application compoments with Docker Compose on the target environment

The workflow can be triggered directly from GitHub Actions panel. When ruuning the workflow, you need to specify:
* Cardano network to be used
* environment name
* optionally skip the build process (frontend and backend) - useful when there are plain configuration changes that do not require the application to be rebuild

- Cardano network to be used
- environment name
- optionally skip the build process (frontend and backend) - useful when there are plain configuration changes that do not require the application to be rebuild

# Monitoring

Expand Down
52 changes: 28 additions & 24 deletions govtool/frontend/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import React from "react";
import { I18nextProvider } from "react-i18next";
import { QueryClient, QueryClientProvider } from "react-query";
import { MemoryRouter, Route, Routes } from "react-router-dom";

import { AppContextProvider } from "../src/context/appContext";
import { ModalProvider } from "../src/context/modal";
import i18n from "../src/i18n";
import { theme } from "../src/theme";
Expand All @@ -23,30 +25,32 @@ const preview: Preview = {
decorators: [
(Story) => (
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<ModalProvider>
<I18nextProvider i18n={i18n}>
<MemoryRouter>
<Routes>
<Route
path="/*"
element={
<div
style={{
margin: "0px",
padding: "0px",
position: "relative",
}}
>
<Story />
</div>
}
/>
</Routes>
</MemoryRouter>
</I18nextProvider>
</ModalProvider>
</ThemeProvider>
<AppContextProvider>
<ThemeProvider theme={theme}>
<ModalProvider>
<I18nextProvider i18n={i18n}>
<MemoryRouter>
<Routes>
<Route
path="/*"
element={
<div
style={{
margin: "0px",
padding: "0px",
position: "relative",
}}
>
<Story />
</div>
}
/>
</Routes>
</MemoryRouter>
</I18nextProvider>
</ModalProvider>
</ThemeProvider>
</AppContextProvider>
</QueryClientProvider>
),
],
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
rel="stylesheet"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SanchoNet Govtool</title>
<title>Voltaire Govtool</title>
<style>
html,
body {
Expand Down
Empty file.
10 changes: 4 additions & 6 deletions govtool/frontend/maintenance-page/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,10 @@
<div>
<h1 class="heading">GovTool is down</h1>
<h2 class="text">
The SanchoNet GovTool Beta is currently down for maintenance.
SanchoNet Govtool is connected to SanchoNet testnet, which
means that if the network gets upgraded with new features
Govtool needs to be updated too.

Please try again later.
The Voltaire GovTool is currently down for maintenance. Voltaire
Govtool is connected to Preview testnet, which means that if the
network gets upgraded with new features Govtool needs to be updated
too. Please try again later.
</h2>
<!-- <a href="" class="status">Status tracker</a> -->
</div>
Expand Down
Loading
Loading