Skip to content
Open
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: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/data
/.secrets
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ yarn-error.log*
/.log

# local env files
.env.system
.env.local
.env.development.local
.env.test.local
Expand All @@ -41,3 +42,11 @@ yarn-error.log*
cypress/videos
cypress/screenshots
cypress/downloads


# IDEs
/.idea/

# docker-compose sytem
/data
/.secrets
93 changes: 93 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
include: 'https://gitlab.lidonation.com/infra-ops/autodevop/raw/main/gitlab-ci-20230315.yml'

image: registry.lidonation.com/infra-ops/gitlab-runner:main

variables:
KUBERNETES_VERSION: 1.24.9
HELM_VERSION: 3.10.2

build_image:
stage: build_image
image: docker:stable-git
retry: 2
script:
- setup_docker
- build
only:
- branches


# Keys that start with a dot (.) will not be processed by GitLab CI.
# Staging and canary jobs are disabled by default, to enable them
# remove the dot (.) before the job name.
# https://docs.gitlab.com/ee/ci/yaml/README.html#hidden-keys

# Staging deploys are disabled by default since
# continuous deployment to production is enabled by default
# If you prefer to automatically deploy to staging and
# only manually promote to production, enable this job by setting
# STAGING_ENABLED.

.production: &production_template
stage: production
image: alpine:latest
retry: 1
script:
- check_kube_domain
- install_dependencies
- kubectl config use-context $KUBE_CONTEXT
- download_chart
- create_secret
- deploy
- persist_environment_url
- |
helm template "$name" ./chart \
--set db.secret.MYSQL_DATABASE="$MYSQL_DATABASE" \
--set db.secret.MYSQL_PASSWORD="$MYSQL_PASSWORD" \
--set db.secret.MYSQL_ROOT_PASSWORD="$MYSQL_ROOT_PASSWORD" \
--set db.secret.MYSQL_USER="$MYSQL_USER" \
--set deploymentEnvironment="$CI_ENVIRONMENT_NAME" \
--set service.enabled="$service_enabled" \
--set releaseOverride="$CI_ENVIRONMENT_SLUG" \
--set image.repository="$IMAGE_REPOSITORY" \
--set image.repository="$IMAGE_PULL_SECRET" \
--set image.repository="$CI_APPLICATION_REPOSITORY" \
--set image.tag="$CI_APPLICATION_TAG" \
--set image.pullPolicy=IfNotPresent \
--set image.secrets[0].name="$secret_name" \
--set image.pullSecret="$secret_name" \
--set application.track="$track" \
--set service.url="$CI_ENVIRONMENT_URL" \
--set replicaCount="$replicas" \
--set site.setup="$setup_site" \
--set site.adminPassword="$site_admin_password" \
--set env.APP_ENV="$APP_ENV" \
--set env.APP_URL="$APP_URL" \
--set env.NEXT_PUBLIC_NETWORK="$NEXT_PUBLIC_NETWORK" \
--set env.NEXT_PUBLIC_GRAPHQL="$NEXT_PUBLIC_GRAPHQL" \
--set env.NEXT_PUBLIC_SUBMIT="$NEXT_PUBLIC_SUBMIT" \
--set env.NEXT_PUBLIC_GUN="$NEXT_PUBLIC_GUN" \
--set certificate.secretName="$SSL_CERT_SECRET_NAME" \
--set certificate.hosts[0]="$SSL_CERT_HOST" \
--set ingress.hosts[0]="$INGRESS_HOST" \
--set ingress.tls[0].secretName="$SSL_CERT_SECRET_NAME" \
--set ingress.tls[0].hosts[0]="$INGRESS_HOST" \
--set ingress.tls[0].hosts[1]="$INGRESS_HOST_2" \
--set namespace=${KUBE_NAMESPACE} \
--namespace="$KUBE_NAMESPACE" \
--version="$CI_PIPELINE_ID-$CI_JOB_ID"
environment:
name: production
url: https://$CI_PROJECT_PATH_SLUG.$AUTO_DEVOPS_DOMAIN
artifacts:
paths: [environment_url.txt]

production:
<<: *production_template
only:
refs:
- main
except:
variables:
- $STAGING_ENABLED
- $INCREMENTAL_ROLLOUT_ENABLED
Empty file.
37 changes: 32 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,41 @@
FROM node:18-alpine
FROM node:18-alpine as dependencies

RUN apk add --no-cache libc6-compat

ENV NODE_ENV production
USER node
WORKDIR /app
COPY --chown=node . .
RUN yarn install
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

FROM node:18-alpine as builder
WORKDIR /app
COPY . .
COPY --from=dependencies /app/node_modules ./node_modules

ARG NEXT_PUBLIC_NETWORK='mainnet'
ENV NEXT_PUBLIC_NETWORK $NEXT_PUBLIC_NETWORK

ARG NEXT_PUBLIC_GRAPHQL='https://graphql.lidonation.com'
ENV NEXT_PUBLIC_GRAPHQL $NEXT_PUBLIC_GRAPHQL

ARG NEXT_PUBLIC_SUBMIT='https://tx.lidonation.com;https://adao.panl.org;https://submit-api.apexpool.info/api/submit/tx'
ENV NEXT_PUBLIC_SUBMIT $NEXT_PUBLIC_SUBMIT


ARG NEXT_PUBLIC_GUN=''
ENV NEXT_PUBLIC_GUN $NEXT_PUBLIC_GUN

RUN yarn build

FROM node:18-alpine as runner
ENV NODE_ENV production
WORKDIR /app
USER node

COPY --chown=node --from=builder /app/public ./public
COPY --chown=node --from=builder /app/.next ./.next
COPY --chown=node --from=builder /app/node_modules ./node_modules
COPY --chown=node --from=builder /app/package.json ./package.json

EXPOSE 3000

ENV PORT 3000
Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,36 @@ The `pages/api` directory is mapped to `/api/*`. Files in this directory are tre
* To run Unit Tests, use `yarn test` command.
* To run UI/UX Tests, use `yarn cypress` command. Make sure your dev server `http://localhost:3000/` is on. Or use `yarn cypress:headless` to run it in headless mode.

## Running with docker-compose
1. Make sure you have docker and docker-compose installed on your system
2. Create secrets
```bash
mkdir -p ./.secrets &&\
echo cexplorer > ./.secrets/postgres_db &&\
echo postgres > ./.secrets/postgres_user &&\
echo 6v8hl32432HHlIurYupj5 > ./.secrets/postgres_password
```
3. Create system environment variables
`cp env.system.example .env.system`
Change or set values in `.env.system`
4. Create data directories
`mkdir -p ./data/cardano/cnode`
5. Download snapshots for quick startup (optional)
1. *Node Snapshot* Follow instructions here: https://csnapshots.io/about and make sure files are expanded into `./data/cardano/node`
2. Get a snapshot for your version and set the RESTORE_SNAPSHOT environment variable in `.env.system`.
ie:
```
RESTORE_SNAPSHOT=https://update-cardano-mainnet.iohk.io/cardano-db-sync/13/db-sync-snapshot-schema-13-block-8371499-x86_64.tgz
```
6. Start services
```bash
docker compose --env-file .env.system up
```

7. View applications
8. roundtable ui: http://localhost:3000/. Here you can import previous rt backup and sign txs.
9. GrapQL Playground: http://localhost:3001/. Here devs can run test GraphQL queries.

## Learn More

To learn more about Next.js, take a look at the following resources:
Expand Down
196 changes: 196 additions & 0 deletions config/network/mainnet/alonzo-genesis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
{
"lovelacePerUTxOWord": 34482,
"executionPrices": {
"prSteps":
{
"numerator" : 721,
"denominator" : 10000000
},
"prMem":
{
"numerator" : 577,
"denominator" : 10000
}
},
"maxTxExUnits": {
"exUnitsMem": 10000000,
"exUnitsSteps": 10000000000
},
"maxBlockExUnits": {
"exUnitsMem": 50000000,
"exUnitsSteps": 40000000000
},
"maxValueSize": 5000,
"collateralPercentage": 150,
"maxCollateralInputs": 3,
"costModels": {
"PlutusV1": {
"sha2_256-memory-arguments": 4,
"equalsString-cpu-arguments-constant": 1000,
"cekDelayCost-exBudgetMemory": 100,
"lessThanEqualsByteString-cpu-arguments-intercept": 103599,
"divideInteger-memory-arguments-minimum": 1,
"appendByteString-cpu-arguments-slope": 621,
"blake2b-cpu-arguments-slope": 29175,
"iData-cpu-arguments": 150000,
"encodeUtf8-cpu-arguments-slope": 1000,
"unBData-cpu-arguments": 150000,
"multiplyInteger-cpu-arguments-intercept": 61516,
"cekConstCost-exBudgetMemory": 100,
"nullList-cpu-arguments": 150000,
"equalsString-cpu-arguments-intercept": 150000,
"trace-cpu-arguments": 150000,
"mkNilData-memory-arguments": 32,
"lengthOfByteString-cpu-arguments": 150000,
"cekBuiltinCost-exBudgetCPU": 29773,
"bData-cpu-arguments": 150000,
"subtractInteger-cpu-arguments-slope": 0,
"unIData-cpu-arguments": 150000,
"consByteString-memory-arguments-intercept": 0,
"divideInteger-memory-arguments-slope": 1,
"divideInteger-cpu-arguments-model-arguments-slope": 118,
"listData-cpu-arguments": 150000,
"headList-cpu-arguments": 150000,
"chooseData-memory-arguments": 32,
"equalsInteger-cpu-arguments-intercept": 136542,
"sha3_256-cpu-arguments-slope": 82363,
"sliceByteString-cpu-arguments-slope": 5000,
"unMapData-cpu-arguments": 150000,
"lessThanInteger-cpu-arguments-intercept": 179690,
"mkCons-cpu-arguments": 150000,
"appendString-memory-arguments-intercept": 0,
"modInteger-cpu-arguments-model-arguments-slope": 118,
"ifThenElse-cpu-arguments": 1,
"mkNilPairData-cpu-arguments": 150000,
"lessThanEqualsInteger-cpu-arguments-intercept": 145276,
"addInteger-memory-arguments-slope": 1,
"chooseList-memory-arguments": 32,
"constrData-memory-arguments": 32,
"decodeUtf8-cpu-arguments-intercept": 150000,
"equalsData-memory-arguments": 1,
"subtractInteger-memory-arguments-slope": 1,
"appendByteString-memory-arguments-intercept": 0,
"lengthOfByteString-memory-arguments": 4,
"headList-memory-arguments": 32,
"listData-memory-arguments": 32,
"consByteString-cpu-arguments-intercept": 150000,
"unIData-memory-arguments": 32,
"remainderInteger-memory-arguments-minimum": 1,
"bData-memory-arguments": 32,
"lessThanByteString-cpu-arguments-slope": 248,
"encodeUtf8-memory-arguments-intercept": 0,
"cekStartupCost-exBudgetCPU": 100,
"multiplyInteger-memory-arguments-intercept": 0,
"unListData-memory-arguments": 32,
"remainderInteger-cpu-arguments-model-arguments-slope": 118,
"cekVarCost-exBudgetCPU": 29773,
"remainderInteger-memory-arguments-slope": 1,
"cekForceCost-exBudgetCPU": 29773,
"sha2_256-cpu-arguments-slope": 29175,
"equalsInteger-memory-arguments": 1,
"indexByteString-memory-arguments": 1,
"addInteger-memory-arguments-intercept": 1,
"chooseUnit-cpu-arguments": 150000,
"sndPair-cpu-arguments": 150000,
"cekLamCost-exBudgetCPU": 29773,
"fstPair-cpu-arguments": 150000,
"quotientInteger-memory-arguments-minimum": 1,
"decodeUtf8-cpu-arguments-slope": 1000,
"lessThanInteger-memory-arguments": 1,
"lessThanEqualsInteger-cpu-arguments-slope": 1366,
"fstPair-memory-arguments": 32,
"modInteger-memory-arguments-intercept": 0,
"unConstrData-cpu-arguments": 150000,
"lessThanEqualsInteger-memory-arguments": 1,
"chooseUnit-memory-arguments": 32,
"sndPair-memory-arguments": 32,
"addInteger-cpu-arguments-intercept": 197209,
"decodeUtf8-memory-arguments-slope": 8,
"equalsData-cpu-arguments-intercept": 150000,
"mapData-cpu-arguments": 150000,
"mkPairData-cpu-arguments": 150000,
"quotientInteger-cpu-arguments-constant": 148000,
"consByteString-memory-arguments-slope": 1,
"cekVarCost-exBudgetMemory": 100,
"indexByteString-cpu-arguments": 150000,
"unListData-cpu-arguments": 150000,
"equalsInteger-cpu-arguments-slope": 1326,
"cekStartupCost-exBudgetMemory": 100,
"subtractInteger-cpu-arguments-intercept": 197209,
"divideInteger-cpu-arguments-model-arguments-intercept": 425507,
"divideInteger-memory-arguments-intercept": 0,
"cekForceCost-exBudgetMemory": 100,
"blake2b-cpu-arguments-intercept": 2477736,
"remainderInteger-cpu-arguments-constant": 148000,
"tailList-cpu-arguments": 150000,
"encodeUtf8-cpu-arguments-intercept": 150000,
"equalsString-cpu-arguments-slope": 1000,
"lessThanByteString-memory-arguments": 1,
"multiplyInteger-cpu-arguments-slope": 11218,
"appendByteString-cpu-arguments-intercept": 396231,
"lessThanEqualsByteString-cpu-arguments-slope": 248,
"modInteger-memory-arguments-slope": 1,
"addInteger-cpu-arguments-slope": 0,
"equalsData-cpu-arguments-slope": 10000,
"decodeUtf8-memory-arguments-intercept": 0,
"chooseList-cpu-arguments": 150000,
"constrData-cpu-arguments": 150000,
"equalsByteString-memory-arguments": 1,
"cekApplyCost-exBudgetCPU": 29773,
"quotientInteger-memory-arguments-slope": 1,
"verifySignature-cpu-arguments-intercept": 3345831,
"unMapData-memory-arguments": 32,
"mkCons-memory-arguments": 32,
"sliceByteString-memory-arguments-slope": 1,
"sha3_256-memory-arguments": 4,
"ifThenElse-memory-arguments": 1,
"mkNilPairData-memory-arguments": 32,
"equalsByteString-cpu-arguments-slope": 247,
"appendString-cpu-arguments-intercept": 150000,
"quotientInteger-cpu-arguments-model-arguments-slope": 118,
"cekApplyCost-exBudgetMemory": 100,
"equalsString-memory-arguments": 1,
"multiplyInteger-memory-arguments-slope": 1,
"cekBuiltinCost-exBudgetMemory": 100,
"remainderInteger-memory-arguments-intercept": 0,
"sha2_256-cpu-arguments-intercept": 2477736,
"remainderInteger-cpu-arguments-model-arguments-intercept": 425507,
"lessThanEqualsByteString-memory-arguments": 1,
"tailList-memory-arguments": 32,
"mkNilData-cpu-arguments": 150000,
"chooseData-cpu-arguments": 150000,
"unBData-memory-arguments": 32,
"blake2b-memory-arguments": 4,
"iData-memory-arguments": 32,
"nullList-memory-arguments": 32,
"cekDelayCost-exBudgetCPU": 29773,
"subtractInteger-memory-arguments-intercept": 1,
"lessThanByteString-cpu-arguments-intercept": 103599,
"consByteString-cpu-arguments-slope": 1000,
"appendByteString-memory-arguments-slope": 1,
"trace-memory-arguments": 32,
"divideInteger-cpu-arguments-constant": 148000,
"cekConstCost-exBudgetCPU": 29773,
"encodeUtf8-memory-arguments-slope": 8,
"quotientInteger-cpu-arguments-model-arguments-intercept": 425507,
"mapData-memory-arguments": 32,
"appendString-cpu-arguments-slope": 1000,
"modInteger-cpu-arguments-constant": 148000,
"verifySignature-cpu-arguments-slope": 1,
"unConstrData-memory-arguments": 32,
"quotientInteger-memory-arguments-intercept": 0,
"equalsByteString-cpu-arguments-constant": 150000,
"sliceByteString-memory-arguments-intercept": 0,
"mkPairData-memory-arguments": 32,
"equalsByteString-cpu-arguments-intercept": 112536,
"appendString-memory-arguments-slope": 1,
"lessThanInteger-cpu-arguments-slope": 497,
"modInteger-cpu-arguments-model-arguments-intercept": 425507,
"modInteger-memory-arguments-minimum": 1,
"sha3_256-cpu-arguments-intercept": 0,
"verifySignature-memory-arguments": 1,
"cekLamCost-exBudgetMemory": 100,
"sliceByteString-cpu-arguments-intercept": 150000
}
}
}
Loading