Skip to content

Commit

Permalink
Dev env setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lodek committed Jan 4, 2024
1 parent 9c01be2 commit 0dde683
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 97 deletions.
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM golang:1.21-bookworm as builder

ARG IGNITE_VERSION="28.1.0"

# Ignite CLI prompts users for tracking info which hangs the tty
# See https://github.com/ignite/cli/blob/main/ignite/internal/analytics/analytics.go#L71
ENV DO_NOT_TRACK=1

# Setup env and dev tools
RUN apt update &&\
apt-get install --yes git make curl jq &&\
mkdir /env &&\
cd /env &&\
curl -L https://github.com/ignite/cli/releases/download/v${IGNITE_VERSION}/ignite_${IGNITE_VERSION}_linux_amd64.tar.gz > ignite.tar.gz &&\
tar xvf ignite.tar.gz &&\
mv ignite /usr/local/bin/ignite &&\
cd / && rm -rf /env
WORKDIR /app

# Cache deps
COPY go.* /app
COPY ./submodules /app/submodules
RUN go mod download

# Build
COPY . /app
ENV GOFLAGS='-buildvcs=false'
RUN --mount=type=cache,target=/root/.cache ignite chain build && ignite chain init

# Dev image entrypoint
ENTRYPOINT ["scripts/dev-entrypoint.sh"]
CMD ["start"]


# Deployment entrypoint
FROM debian:bookworm-slim

RUN useradd -ms /bin/bash tendermint
USER operator

COPY --from=builder /root/go/bin/sourcehubd /usr/local/bin/sourcehubd

EXPOSE 8080

ENTRYPOINT ["sourcehubd"]
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
IGNITE_RUN = docker run --rm -ti --volume $(PWD):/apps ignitehq/cli:latest
UID := $(shell id --user)
GID := $(shell id --group)
BIN = sourcehubd
DEMO_SRC = cmd/token-protocol-demo/main.go
DEMO_BIN = build/token-protocol-demo

.PHONY: build
build:
ignite chain build

.PHONY: proto
proto:
ignite generate proto-go

.PHONY: test
test:
go test ./...

.PHONY: simulate
simulate:
ignite chain simulate


.PHONY: fmt
fmt:
gofmt -w .

.PHONY: run
run:
${BIN} start
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import (
)

const (
AccountAddressPrefix = "cosmos"
AccountAddressPrefix = "source"
Name = "sourcehub"
)

Expand Down
20 changes: 9 additions & 11 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
version: 1
accounts:
- name: alice
- name: validator
coins:
- 20000token
- 200000000stake
- name: bob
- 200000000stake
- name: faucet
coins:
- 10000token
- 100000000stake
- 200000000stake
client:
openapi:
path: docs/static/openapi.yml
faucet:
name: bob
name: faucet
coins:
- 5token
- 100000stake
- 100000stake

validators:
- name: alice
bonded: 100000000stake
- name: validator
bonded: 200000000stake
10 changes: 10 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.8'

services:
sourcehub:
build:
target: builder
ports:
- 9090
volumes:
- .:/app
49 changes: 3 additions & 46 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18910,42 +18910,6 @@ paths:
parameters.
tags:
- Msg
/sourcenetwork/sourcehub/acp/params:
get:
summary: Parameters queries the parameters of the module.
operationId: SourcehubAcpQuery_Params
responses:
'200':
description: A successful response.
schema:
type: object
properties:
params:
description: params holds all the parameters of this module.
type: object
description: >-
QueryParamsResponse is response type for the Query/Params RPC
method.
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
tags:
- Query
/sourcehub.acp.Msg/UpdateParams:
post:
summary: |-
Expand Down Expand Up @@ -26693,16 +26657,6 @@ definitions:
description: |-
Version defines the versioning scheme used to negotiate the IBC verison in
the connection handshake.
sourcehub.acp.Params:
type: object
description: Params defines the parameters for the module.
sourcehub.acp.QueryParamsResponse:
type: object
properties:
params:
description: params holds all the parameters of this module.
type: object
description: QueryParamsResponse is response type for the Query/Params RPC method.
sourcehub.acp.MsgUpdateParams:
type: object
properties:
Expand All @@ -26723,6 +26677,9 @@ definitions:
description: |-
MsgUpdateParamsResponse defines the response structure for executing a
MsgUpdateParams message.
sourcehub.acp.Params:
type: object
description: Params defines the parameters for the module.
sourcehub.sourcehub.MsgUpdateParams:
type: object
properties:
Expand Down
45 changes: 6 additions & 39 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,18 @@
# sourcehub
**sourcehub** is a blockchain built using Cosmos SDK and Tendermint and created with [Ignite CLI](https://ignite.com/cli).
# SourceHub

## Get started
Source's Trust Layer

```
ignite chain serve
```

`serve` command installs dependencies, builds, initializes, and starts your blockchain in development.

### Configure

Your blockchain in development can be configured with `config.yml`. To learn more, see the [Ignite CLI docs](https://docs.ignite.com).

### Web Frontend

Additionally, Ignite CLI offers both Vue and React options for frontend scaffolding:

For a Vue frontend, use: `ignite scaffold vue`
For a React frontend, use: `ignite scaffold react`
These commands can be run within your scaffolded blockchain project.

## Development

For more information see the [monorepo for Ignite front-end development](https://github.com/ignite/web).

## Release
To release a new version of your blockchain, create and push a new tag with `v` prefix. A new draft release with the configured targets will be created.
To run locally run:

```
git tag v0.1
git push origin v0.1
docker-compose up
```

After a draft release is created, make your final changes from the release page and publish it.

### Install
To install the latest version of your blockchain node's binary, execute the following command on your machine:

```
curl https://get.ignite.com/sourcenetwork/sourcehub@latest! | sudo bash
```
`sourcenetwork/sourcehub` should match the `username` and `repo_name` of the Github repository to which the source code was pushed. Learn more about [the install process](https://github.com/allinbits/starport-installer).

## Learn more

Docs:
- [Ignite CLI](https://ignite.com/cli)
- [Tutorials](https://docs.ignite.com/guide)
- [Ignite CLI docs](https://docs.ignite.com)
- [Cosmos SDK docs](https://docs.cosmos.network)
- [Developer Chat](https://discord.gg/ignite)
4 changes: 4 additions & 0 deletions scripts/dev-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/bash

ignite chain build --skip-proto
exec sourcehubd $@
Empty file added submodules/.gitignore
Empty file.

0 comments on commit 0dde683

Please sign in to comment.