Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
austbot committed Oct 1, 2022

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent ca38b3d commit a49ad8d
Showing 30 changed files with 579 additions and 145 deletions.
33 changes: 29 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -80,17 +80,20 @@ Developing with Docker is much easier, but has some nuances to it. This test doc

You need to run the following script (which takes a long time) in order to get all those .so files.

#### Authentication with Docker and AWS

```aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin {your aws container registry}```

```bash
chmod
chmod +x ./dowload-programs.sh
./dowload-programs.sh
```
This script grabs all the code for these programs and compiles it, and chucks it into your programs folder. Go grab some coffe because this will take a while/

If you get some permissions errors, just sudo delete the programs directory and start again.

We use ``docker-compose`` on some systems its ``docker compose``.
```bash
docker-compose build

```
This builds the docker container for API and the Ingester components and will download the appropriate Redis, Postgres and Solana+plerkle docker images.
Keep in mind that the version `latest` on the Solana Validator image will match the latest version available on the docs, for other versions please change that version in your docker compose file.
@@ -99,5 +102,27 @@ Keep in mind that the version `latest` on the Solana Validator image will match
docker-compose up
```

When making changes you will need to ``docker compose up --force-recreate`` again to get the latest changes.
When making changes you will need to ``docker compose up --build --force-recreate`` again to get the latest changes.
Also when mucking about with the docker file if your gut tells you that something is wrong, and you are getting build errors run `docker compose build --no-cache`


TODO-> make anote about root folders and deleting
Once everything is working you can see that there is a api being served on
```
http://localhost:9090
```
And a Metrics System on
```
http://localhost:3000
```


# Deploying to Kubernetes
Using skaffold you can deploy to k8s, make sure you authenticate with your docker registry
```bash
skaffold build --file-output skaffold-state.json --cache-artifacts=false
## Your namepsace may differ.
skaffold deploy --build-artifacts skaffold-state.json --namespace devnet-read-api --tail=true
```


4 changes: 2 additions & 2 deletions das_api/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions digital_asset_types/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions digital_asset_types/src/dao/generated/asset.rs
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ pub struct Model {
pub royalty_target_type: RoyaltyTargetType,
pub royalty_target: Option<Vec<u8>>,
pub royalty_amount: i32,
pub asset_data: Option<i64>,
pub asset_data: Option<Vec<u8>>,
pub created_at: Option<DateTimeWithTimeZone>,
pub burnt: bool,
pub slot_updated: i64,
@@ -114,7 +114,7 @@ impl ColumnTrait for Column {
Self::RoyaltyTargetType => RoyaltyTargetType::db_type(),
Self::RoyaltyTarget => ColumnType::Binary.def().null(),
Self::RoyaltyAmount => ColumnType::Integer.def(),
Self::AssetData => ColumnType::BigInteger.def().null(),
Self::AssetData => ColumnType::Binary.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Burnt => ColumnType::Boolean.def(),
Self::SlotUpdated => ColumnType::BigInteger.def(),
11 changes: 4 additions & 7 deletions digital_asset_types/src/dao/generated/asset_data.rs
Original file line number Diff line number Diff line change
@@ -16,8 +16,7 @@ impl EntityName for Entity {

#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)]
pub struct Model {
pub id: i64,
pub asset_id: Vec<u8>,
pub id: Vec<u8>,
pub chain_data_mutability: ChainMutability,
pub chain_data: Json,
pub metadata_url: String,
@@ -29,7 +28,6 @@ pub struct Model {
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
AssetId,
ChainDataMutability,
ChainData,
MetadataUrl,
@@ -44,9 +42,9 @@ pub enum PrimaryKey {
}

impl PrimaryKeyTrait for PrimaryKey {
type ValueType = i64;
type ValueType = Vec<u8>;
fn auto_increment() -> bool {
true
false
}
}

@@ -59,8 +57,7 @@ impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::BigInteger.def(),
Self::AssetId => ColumnType::Binary.def(),
Self::Id => ColumnType::Binary.def(),
Self::ChainDataMutability => ChainMutability::db_type(),
Self::ChainData => ColumnType::JsonBinary.def(),
Self::MetadataUrl => ColumnType::String(Some(200u32)).def(),
96 changes: 48 additions & 48 deletions digital_asset_types/src/dao/generated/sea_orm_active_enums.rs
Original file line number Diff line number Diff line change
@@ -4,38 +4,44 @@ use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "chain_mutability")]
pub enum ChainMutability {
#[sea_orm(string_value = "immutable")]
Immutable,
#[sea_orm(string_value = "mutable")]
Mutable,
#[sea_orm(
rs_type = "String",
db_type = "Enum",
enum_name = "royalty_target_type"
)]
pub enum RoyaltyTargetType {
#[sea_orm(string_value = "creators")]
Creators,
#[sea_orm(string_value = "fanout")]
Fanout,
#[sea_orm(string_value = "single")]
Single,
#[sea_orm(string_value = "unknown")]
Unknown,
}
#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
#[sea_orm(
rs_type = "String",
db_type = "Enum",
enum_name = "specification_asset_class"
enum_name = "specification_versions"
)]
pub enum SpecificationAssetClass {
#[sea_orm(string_value = "FUNGIBLE_ASSET")]
FungibleAsset,
#[sea_orm(string_value = "FUNGIBLE_TOKEN")]
FungibleToken,
#[sea_orm(string_value = "IDENTITY_NFT")]
IdentityNft,
#[sea_orm(string_value = "NFT")]
Nft,
#[sea_orm(string_value = "NON_TRANSFERABLE_NFT")]
NonTransferableNft,
#[sea_orm(string_value = "PRINT")]
Print,
#[sea_orm(string_value = "PRINTABLE_NFT")]
PrintableNft,
#[sea_orm(string_value = "TRANSFER_RESTRICTED_NFT")]
TransferRestrictedNft,
pub enum SpecificationVersions {
#[sea_orm(string_value = "unknown")]
Unknown,
#[sea_orm(string_value = "v0")]
V0,
#[sea_orm(string_value = "v1")]
V1,
#[sea_orm(string_value = "v2")]
V2,
}
#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "chain_mutability")]
pub enum ChainMutability {
#[sea_orm(string_value = "immutable")]
Immutable,
#[sea_orm(string_value = "mutable")]
Mutable,
#[sea_orm(string_value = "unknown")]
Unknown,
}
@@ -63,33 +69,27 @@ pub enum OwnerType {
#[sea_orm(
rs_type = "String",
db_type = "Enum",
enum_name = "royalty_target_type"
)]
pub enum RoyaltyTargetType {
#[sea_orm(string_value = "creators")]
Creators,
#[sea_orm(string_value = "fanout")]
Fanout,
#[sea_orm(string_value = "single")]
Single,
#[sea_orm(string_value = "unknown")]
Unknown,
}
#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
#[sea_orm(
rs_type = "String",
db_type = "Enum",
enum_name = "specification_versions"
enum_name = "specification_asset_class"
)]
pub enum SpecificationVersions {
pub enum SpecificationAssetClass {
#[sea_orm(string_value = "FUNGIBLE_ASSET")]
FungibleAsset,
#[sea_orm(string_value = "FUNGIBLE_TOKEN")]
FungibleToken,
#[sea_orm(string_value = "IDENTITY_NFT")]
IdentityNft,
#[sea_orm(string_value = "NFT")]
Nft,
#[sea_orm(string_value = "NON_TRANSFERABLE_NFT")]
NonTransferableNft,
#[sea_orm(string_value = "PRINT")]
Print,
#[sea_orm(string_value = "PRINTABLE_NFT")]
PrintableNft,
#[sea_orm(string_value = "TRANSFER_RESTRICTED_NFT")]
TransferRestrictedNft,
#[sea_orm(string_value = "unknown")]
Unknown,
#[sea_orm(string_value = "v0")]
V0,
#[sea_orm(string_value = "v1")]
V1,
#[sea_orm(string_value = "v2")]
V2,
}
#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
#[sea_orm(
10 changes: 10 additions & 0 deletions digital_asset_types/src/json/chain_data.rs
Original file line number Diff line number Diff line change
@@ -5,8 +5,18 @@ use serde::{Deserialize, Serialize};
pub struct ChainDataV1 {
pub name: String,
pub symbol: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub edition_nonce: Option<u8>,
pub primary_sale_happened: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub token_standard: Option<TokenStandard>,
#[serde(skip_serializing_if = "Option::is_none")]
pub uses: Option<Uses>,
}

impl ChainDataV1 {
pub fn sanitize(&mut self) {
self.name = self.name.trim().replace("\0","").to_string();
self.symbol = self.symbol.trim().replace("\0","").to_string();
}
}
6 changes: 4 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ services:
- "8126:8126"
- "2003:2003"
- "2004:2004"

grafana:
image: grafana/grafana
restart: always
@@ -20,6 +19,9 @@ services:
- graphite
environment:
- GF_SECURITY_ADMIN_PASSWORD=password
volumes:
- ./grafana/datasources:/etc/grafana/provisioning/datasources
- ./grafana/dashboards:/etc/grafana/provisioning/dashboards
ingester:
depends_on:
- redis
@@ -74,7 +76,7 @@ services:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
- ./db-data/:/var/lib/postgresql/data/:rw
solana:
image: digital-asset-validator-plugin-solana #ghcr.io/metaplex-foundation/plerkle-test-validator:v0.4.5
image: ghcr.io/metaplex-foundation/plerkle-test-validator:v0.4.6
volumes:
- ./programs:/so/:ro
- ./ledger:/config:rw
Empty file added grafana/dashboards/.gitkeep
Empty file.
Loading

0 comments on commit a49ad8d

Please sign in to comment.