Skip to content

Instantly share code, notes, and snippets.

@pascalgrimaud
Last active March 8, 2021 20:48
Show Gist options
  • Save pascalgrimaud/0398f1e2174f8a39cfb862d99e770cdb to your computer and use it in GitHub Desktop.
Save pascalgrimaud/0398f1e2174f8a39cfb862d99e770cdb to your computer and use it in GitHub Desktop.

Revisions

  1. pascalgrimaud revised this gist Mar 8, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion microservice-demo
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ entity Product {
    name String required
    description String
    price BigDecimal required min(0)
    size Size required
    productSize Size required
    image ImageBlob
    }
    enum Size {
  2. pascalgrimaud created this gist Mar 8, 2021.
    174 changes: 174 additions & 0 deletions microservice-demo
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,174 @@
    //**************************************************
    // Gateway
    //**************************************************

    application {
    config {
    baseName gateway
    applicationType gateway
    packageName io.github.pascalgrimaud.gateway
    serviceDiscoveryType consul
    authenticationType jwt
    devDatabaseType postgresql
    prodDatabaseType postgresql
    buildTool maven
    clientFramework vue
    clientTheme cosmo
    testFrameworks [cypress]
    }
    entities *
    }

    //**************************************************
    // Store microservice
    //**************************************************

    application {
    config {
    baseName store
    applicationType microservice
    packageName io.github.pascalgrimaud.store
    serviceDiscoveryType consul
    authenticationType jwt
    cacheProvider hazelcast
    devDatabaseType mysql
    prodDatabaseType mysql
    buildTool maven
    serverPort 8081
    }
    entities *
    }

    entity Product {
    name String required
    description String
    price BigDecimal required min(0)
    size Size required
    image ImageBlob
    }
    enum Size {
    S, M, L, XL, XXL
    }
    entity Customer {
    firstName String required
    lastName String required
    gender Gender required
    email String required pattern(/[a-z0-9._+-]{1,20}@[a-z0-9]{3,15}\.[a-z]{2,4}/)
    phone String required
    addressLine1 String required
    addressLine2 String
    city String required
    country String required
    }
    enum Gender {
    MALE, FEMALE, OTHER
    }
    entity ProductOrder {
    placedDate Instant required
    status OrderStatus required
    code String required
    invoiceId String
    }
    enum OrderStatus {
    COMPLETED, PENDING, CANCELLED
    }
    entity OrderItem {
    quantity Integer required min(0)
    totalPrice BigDecimal required min(0)
    status OrderItemStatus required
    }
    enum OrderItemStatus {
    AVAILABLE, OUT_OF_STOCK, BACK_ORDER
    }
    relationship ManyToOne {
    OrderItem{product(name) required} to Product
    }
    relationship OneToMany {
    Customer{order} to ProductOrder{customer(email) required},
    ProductOrder{orderItem} to OrderItem{order(code) required}
    }

    dto Product, Customer, ProductOrder, OrderItem with mapstruct
    service Product, Customer, ProductOrder, OrderItem with serviceClass
    paginate Product, Customer, ProductOrder, OrderItem with pagination
    filter Customer, ProductOrder, OrderItem
    clientRootFolder Product, Customer, ProductOrder, OrderItem with store

    microservice Customer, Product, ProductOrder, OrderItem with store

    //**************************************************
    // Invoice microservice
    //**************************************************

    application {
    config {
    baseName invoice
    applicationType microservice
    packageName io.github.pascalgrimaud.invoice
    serviceDiscoveryType consul
    authenticationType jwt
    cacheProvider hazelcast
    databaseType mongodb
    devDatabaseType mongodb
    prodDatabaseType mongodb
    buildTool maven
    serverPort 8082
    }
    entities *
    }

    entity Invoice {
    code String required
    date Instant required
    details String
    status InvoiceStatus required
    paymentMethod PaymentMethod required
    paymentDate Instant required
    paymentAmount BigDecimal required
    }
    enum InvoiceStatus {
    PAID, ISSUED, CANCELLED
    }
    entity Shipment {
    trackingCode String
    date Instant required
    details String
    }
    enum PaymentMethod {
    CREDIT_CARD, CASH_ON_DELIVERY, PAYPAL
    }
    relationship OneToMany {
    Invoice{shipment} to Shipment{invoice(code) required}
    }

    dto Invoice, Shipment with mapstruct
    service Invoice, Shipment with serviceClass
    paginate Invoice, Shipment with infinite-scroll
    filter Invoice, Shipment
    clientRootFolder Invoice, Shipment with invoice

    microservice Invoice, Shipment with invoice

    //**************************************************
    // Deployments
    //**************************************************

    deployment {
    deploymentType docker-compose
    appsFolders [gateway, store, invoice]
    dockerRepositoryName "pascalgrimaud"
    monitoring no
    serviceDiscoveryType consul
    }

    deployment {
    deploymentType kubernetes
    appsFolders [gateway, store, invoice]
    dockerRepositoryName "pascalgrimaud"
    gatewayType SpringCloudGateway
    monitoring no
    serviceDiscoveryType consul
    kubernetesNamespace pascalgrimaud
    kubernetesServiceType LoadBalancer
    istio false
    }