Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ lefthook.yml
treefmt.toml

# local earthly Environments
./local/
local/*
2 changes: 0 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ all:

# Build and tag all Docker images
BUILD ./containers/event-db-migrations+docker --tag=$tag --registry=$registry_final
BUILD ./containers/event-db-graphql+docker --tag=$tag --registry=$registry_final

# Build crate images from the workspace
BUILD ./src/jormungandr/jormungandr+docker --tag=$tag --registry=$registry_final
Expand Down Expand Up @@ -128,7 +127,6 @@ tag-workspace:
local:
LOCALLY
BUILD ./containers/event-db-migrations+docker
BUILD ./containers/event-db-graphql+docker
BUILD ./src/cat-data-service+docker
BUILD ./services/voting-node+docker

Expand Down
36 changes: 4 additions & 32 deletions Makefiles/db.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ install_crate = { crate_name = "refinery_cli", binary = "refinery", test_arg = "
# All the prerequisite tooling needed to work with the DB.
[tasks.install-db-prereqs]
workspace = false
run_task = { name = [
"install-refinery-cli",
], parallel = true }
run_task = { name = ["install-refinery-cli"], parallel = true }

# Setup the local database ready to run the migrations.
[tasks.local-event-db-init]
Expand Down Expand Up @@ -75,36 +73,14 @@ psql -U catalyst-event-dev -d CatalystEventDev -f historic_data/fund_5.sql ${@}
# psql -U catalyst-event-dev -d CatalystEventDev -f historic_data/fund_9.sql ${@}
'''

# Setup the local database graphql configuration.
[tasks.local-event-db-graphql-init]
workspace = false
category = "db"
script_runner = "@shell"
script = '''
cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/src/event-db
export ADMIN_ROLE_PW="CHANGE_ME"
export ANON_ROLE_PW="CHANGE_ME"
export ADMIN_USER_PW="CHANGE_ME"

psql -U postgres -f setup/graphql-setup.sql \
-v dbName=CatalystEventDev \
-v dbUser="catalyst-event-dev" \
-v adminUserFirstName="Admin" \
-v adminUserLastName="Default" \
-v adminUserAbout="Default Admin User" \
-v adminUserEmail="admin.default@projectcatalyst.io" ${@}
'''


# Setup the local database ready to run the migrations.
[tasks.local-event-db-setup]
workspace = false
category = "db"
dependencies = [
"local-event-db-init",
"local-event-db-graphql-init",
"run-event-db-migration",
"local-db-historic-data-setup"
"local-db-historic-data-setup",
]

# Setup the local database with the test data.
Expand All @@ -114,11 +90,10 @@ category = "db"
dependencies = [
"local-event-db-init",
"run-event-db-migration",
"local-db-test-data-setup"
"local-db-test-data-setup",
]



# Run Diesel Migrations, for documentation purposes.
[tasks.run-event-doc-db-migration]
workspace = false
Expand Down Expand Up @@ -147,7 +122,4 @@ psql -e -f setup/setup-db.sql \
[tasks.doc-event-db-setup]
workspace = false
category = "db"
dependencies = [
"doc-event-db-init",
"run-event-doc-db-migration"
]
dependencies = ["doc-event-db-init", "run-event-doc-db-migration"]
96 changes: 72 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,38 +30,89 @@
- [What's inside?](#whats-inside)
- [Requirements](#requirements)
- [Development](#development)
- [Development Environment (NIX Shell)](#development-environment-nix-shell)
- [Development Environment (Manual)](#development-environment-manual)
- [Earthly](#earthly)
- [Manual](#manual)
- [Prerequisites](#prerequisites)
- [Linux](#linux)
- [macOS](#macos)
- [Windows](#windows)
- [Nix](#nix)
- [Install Extra Packages/Tools](#install-extra-packagestools)
- [Testing](#testing)
- [Deployment](#deployment)
- [Building Documentation](#building-documentation)
- [Support](#support)
- [License](#license)

## What's inside?

TODO:
- [Catalyst Core Governance Engine](catalyst-core/README.md)

## Requirements

- [Rust](https://www.rust-lang.org/tools/install)
- [Docker](https://docs.docker.com/get-docker/)
- [Earthly](https://earthly.dev/get-earthly)

## Development

### Development Environment (NIX Shell)
### Earthly

> **Note**: This is the preferred development environment.

Make sure that docker is running and then run:

```sh
# This command can take a while to run.
earthly +local
```
then run:

This is the **preferred** development environment.
```sh
docker-compose -f local/docker-compose.yml up
```

1. Install NIX : <https://nixos.org/download.html>
2. Start a nix development environment (From the repo Root):
`nix develop`
You should now be able to use [Catalyst Core API V1](https://input-output-hk.github.io/catalyst-core/main/07_web_api/catalyst-core-api.html) locally:

### Development Environment (Manual)
Open a new terminal window and run:

~~ ***NOT RECOMMENDED*** ~~
```sh
curl --request GET \
--url http://localhost:3030/api/v1/events \
--header 'Accept: application/json'
```

you should get list of events:

```json
[
{
"id": 0,
"name": "Catalyst Fund 0",
"starts": "2020-05-22T00:00:00+00:00",
"ends": "2020-06-24T00:00:00+00:00",
"final": true
},
{
"id": 1,
"name": "Catalyst Fund 1",
"starts": "2020-08-08T00:00:00+00:00",
"ends": "2020-09-22T00:00:00+00:00",
"final": true
},
.
.
.
.
{
"id": 9,
"name": "Catalyst Fund 9",
"starts": "2022-06-02T00:00:00+00:00",
"ends": "2022-10-11T00:00:00+00:00",
"final": true
}
]
```

### Manual

#### Prerequisites

Expand All @@ -87,23 +138,20 @@ brew install protobuf-c libsigsegv libpq libserdes pkg-config
choco install protoc openssl sqlite postgresql14
```

### Install Extra Packages/Tools
### Nix

This only needs to be done once when the development environment is created.
> **⛔️ Note**: Nix packaging code is deprecated and will be removed in a future.

1. `cargo install cargo-binstall --locked` : see <https://github.com/cargo-bins/cargo-binstall>
2. `cargo binstall --no-confirm cargo-make` : see <https://github.com/sagiegurari/cargo-make>
3. `cargo make install-prereqs`
- Install [Nix](https://nixos.org/download.html)
- Start a nix development environment (from the repo root): `nix develop`

TODO: Can this (or an equivalent) be done by the devshell?

## Testing

TODO:
### Install Extra Packages/Tools

## Deployment
This only needs to be done once when the development environment is created.

TODO:
- `cargo install cargo-binstall --locked`
- `cargo binstall --no-confirm cargo-make`
- `cargo make install-prereqs`

## Building Documentation

Expand Down
12 changes: 0 additions & 12 deletions containers/dev-local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ services:
db:
condition: service_healthy

graphql:
image: event-db-graphql:latest
environment:
- DATABASE_URL=postgres://catalyst-event-dev:CHANGE_ME@db/CatalystEventDev
- JWT_SECRET=CHANGE_ME
- GRAPHQL_PORT=5000
ports:
- 5000:5000
depends_on:
migrations:
condition: service_completed_successfully

cat-data-service:
image: cat-data-service:latest
environment:
Expand Down
71 changes: 0 additions & 71 deletions containers/event-db-graphql/Earthfile

This file was deleted.

53 changes: 0 additions & 53 deletions containers/event-db-graphql/entry.sh

This file was deleted.

Loading