-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from hamster-shared/feature/v1
Feature/v1
- Loading branch information
Showing
12 changed files
with
102 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
/frontend/node_modules | ||
#/frontend/dist | ||
/frontend/package-lock.json | ||
Dockerfile | ||
hamster-gateway | ||
#hamster-gateway | ||
.dockerignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,29 @@ | ||
FROM golang:1.17.3 as builder | ||
|
||
# install cgo-related dependencies | ||
RUN set -eux; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
libvirt-dev \ | ||
gcc \ | ||
; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /usr/local/go/src/github.com/hamster-shared/hamster-gateway/ | ||
|
||
ENV GO111MODULE on | ||
ENV GOPROXY https://goproxy.cn | ||
|
||
COPY . . | ||
|
||
RUN set -eux; \ | ||
go mod tidy ; \ | ||
go build | ||
|
||
FROM node:17 as builder-2 | ||
|
||
FROM docker:20 | ||
WORKDIR /usr/local/go/src/github.com/hamster-shared/hamster-gateway/frontend | ||
|
||
RUN set -eux; \ | ||
apk update ; \ | ||
apk add libvirt-dev | ||
COPY . . | ||
|
||
WORKDIR /root/ | ||
RUN npm install ;\ | ||
npm run build | ||
|
||
## test evn | ||
ENV CHAIN_ADDRESS 183.66.65.207:49944 | ||
ENV CPU 1 | ||
ENV MEMORY 1 | ||
|
||
COPY --from=builder /usr/local/go/src/tntlinking.com/ttchain-compute-provider/ttchain-compute-provider /usr/local/bin/ | ||
FROM ubuntu:20.04 | ||
|
||
RUN set -eux ;\ | ||
ttchain-compute-gateway init | ||
COPY --from=builder /usr/local/go/src/github.com/hamster-shared/hamster-gateway/hamster-gateway /usr/local/bin/ | ||
|
||
COPY --from=builder-2 /usr/local/go/src/github.com/hamster-shared/hamster-gateway/frontend/dist /usr/local/bin/frontend/ | ||
|
||
CMD sed -i 's/"none"/"done"/' ~/.ttchain-compute-provider/config \ | ||
&& sed -i "s/127.0.0.1:9944/$CHAIN_ADDRESS/" ~/.ttchain-compute-provider/config \ | ||
&& sed -i "s/cpu\"\:1/cpu\"\:$CPU/" ~/.ttchain-compute-provider/config\ | ||
&& sed -i "s/mem\"\:1/mem\"\:$MEMORY/" ~/.ttchain-compute-provider/config\ | ||
&& ttchain-compute-provider daemon | ||
CMD hamster-gateway daemon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FROM ipfs/go-ipfs | ||
ENV IPFS_SWARM_KEY '/key/swarm/psk/1.0.0/\n/base16/\n55158d9b6b7e5a8e41aa8b34dd057ff1880e38348613d27ae194ad7c5b9670d7' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: '3.9' | ||
services: | ||
ipfs: | ||
image: 'ipfs/go-ipfs:latest' | ||
ports: | ||
- "37774:37774" | ||
- "5001:5001" | ||
- "4001:4001" | ||
restart: always | ||
volumes: | ||
- "ipfs_data:/data/ipfs" | ||
- "./swarm.key:/data/ipfs/swarm.key" | ||
entrypoint: /sbin/tini -- | ||
environment: | ||
IPFS_PROFILE: badgerds | ||
command: >- | ||
/bin/sh -c "/usr/local/bin/start_ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '[\"http://127.0.0.1:5001\",\"http://localhost:5001\", \"http://ipfs:5001\"]' | ||
&& /usr/local/bin/start_ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '[\"PUT\", \"POST\"]' | ||
&& /usr/local/bin/start_ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/37774 | ||
&& /usr/local/bin/start_ipfs config Addresses.API /ip4/127.0.0.1/tcp/5001 | ||
&& /usr/local/bin/start_ipfs config Datastore.StorageMax 20GB | ||
&& /usr/local/bin/start_ipfs config --json Swarm.RelayClient.Enabled true | ||
&& /usr/local/bin/start_ipfs config --json Swarm.RelayService.Enabled true | ||
&& /usr/local/bin/start_ipfs bootstrap rm --all | ||
&& /usr/local/bin/start_ipfs bootstrap add /ip4/59.80.40.149/tcp/4001/p2p/12D3KooWSm8rYXfjbMaBkySrt1WhtHEZpqJXyqj36hPJoVkMvQfd | ||
&& /usr/local/bin/start_ipfs daemon --migrate=true" | ||
container_name: ipfs | ||
volumes: | ||
ipfs_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/key/swarm/psk/1.0.0/ | ||
/base16/ | ||
55158d9b6b7e5a8e41aa8b34dd057ff1880e38348613d27ae194ad7c5b9670d7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ export default { | |
accessPort: '访问端口', | ||
type: '虚拟化类型', | ||
resourceInfo: '资源信息', | ||
setStateFail: '修改状态失败', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters