Skip to content

Add Lab to quickstart #678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
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 .github/workflows/build-future.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
horizon_ref: horizon-v22.0.2
stellar_rpc_ref: v22.1.2
friendbot_ref: horizon-v22.0.2
lab_ref: main
test_matrix: |
{
"network": ["local"],
Expand All @@ -61,6 +62,7 @@ jobs:
horizon_ref: horizon-v22.0.2
stellar_rpc_ref: v22.1.2
friendbot_ref: horizon-v22.0.2
lab_ref: main
test_matrix: |
{
"network": ["local"],
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
horizon_ref: horizon-v22.0.2
stellar_rpc_ref: v22.1.2
friendbot_ref: horizon-v22.0.2
lab_ref: main
test_matrix: |
{
"network": ["pubnet", "local"],
Expand All @@ -62,6 +63,7 @@ jobs:
horizon_ref: horizon-v22.0.2
stellar_rpc_ref: v22.1.2
friendbot_ref: horizon-v22.0.2
lab_ref: main
test_matrix: |
{
"network": ["pubnet", "local"],
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
horizon_ref: horizon-v22.0.2
stellar_rpc_ref: v22.1.2
friendbot_ref: horizon-v22.0.2
lab_ref: main
test_matrix: |
{
"network": ["testnet", "pubnet", "local"],
Expand All @@ -63,6 +64,7 @@ jobs:
horizon_ref: horizon-v22.0.2
stellar_rpc_ref: v22.1.2
friendbot_ref: horizon-v22.0.2
lab_ref: main
test_matrix: |
{
"network": ["testnet", "pubnet", "local"],
Expand Down
120 changes: 94 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ on:
xdr_ref:
description: 'Git ref for the stellar/rs-stellar-xdr repo'
type: 'string'
required: false
required: false
stellar_rpc_ref:
description: 'Git ref for the stellar/stellar-rpc repo (stellar-rpc)'
type: 'string'
Expand All @@ -50,6 +50,10 @@ on:
description: 'Git ref for the stellar/go repo (friendbot)'
type: 'string'
required: true
lab_ref:
description: 'Git ref for the stellar/laboratory (lab)'
type: 'string'
required: true
test_matrix:
description: 'JSON matrix for the test job'
type: 'string'
Expand All @@ -64,6 +68,7 @@ env:
HORIZON_REPO_REF: ${{ inputs.horizon_ref }}
FRIENDBOT_REPO_REF: ${{ inputs.friendbot_ref }}
STELLAR_RPC_REPO_BRANCH: ${{ inputs.stellar_rpc_ref }}
LAB_REPO_REF: ${{ inputs.lab_ref }}
CORE_REPO: ${{ inputs.core_repo }}
CORE_REPO_REF: ${{ inputs.core_ref }}
XDR_REPO_REF: ${{ inputs.xdr_ref }}
Expand Down Expand Up @@ -104,11 +109,11 @@ jobs:
- uses: docker/setup-buildx-action@5146db6c4d81fbfd508899f851bbb3883a96ff9f
- name: Build Stellar-Core Image
run: >
docker buildx build --platform linux/${{ inputs.arch }}
-f docker/Dockerfile.testing -t stellar-core:${{ inputs.arch }}
-o type=docker,dest=/tmp/image
${{ env.CORE_REPO }}#${{ env.CORE_REPO_REF }}
--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
docker buildx build --platform linux/${{ inputs.arch }}
-f docker/Dockerfile.testing -t stellar-core:${{ inputs.arch }}
-o type=docker,dest=/tmp/image
${{ env.CORE_REPO }}#${{ env.CORE_REPO_REF }}
--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
--build-arg CONFIGURE_FLAGS='${{ inputs.core_configure_flags }}'
- name: Upload Stellar-Core Image
uses: actions/upload-artifact@v4
Expand All @@ -131,9 +136,9 @@ jobs:
uses: docker/setup-buildx-action@5146db6c4d81fbfd508899f851bbb3883a96ff9f
- name: Build Stellar-Horizon Image
run: >
docker buildx build --platform linux/${{ inputs.arch }}
-f Dockerfile.horizon --target builder
-t stellar-horizon:${{ inputs.arch }} -o type=docker,dest=/tmp/image
docker buildx build --platform linux/${{ inputs.arch }}
-f Dockerfile.horizon --target builder
-t stellar-horizon:${{ inputs.arch }} -o type=docker,dest=/tmp/image
--build-arg REF="${{ env.HORIZON_REPO_REF }}" .
- name: Upload Stellar-Horizon Image
uses: actions/upload-artifact@v4
Expand All @@ -152,10 +157,10 @@ jobs:
uses: docker/setup-buildx-action@5146db6c4d81fbfd508899f851bbb3883a96ff9f
- name: Build Stellar-Friendbot Image
run: >
docker buildx build --platform linux/${{ inputs.arch }}
-f services/friendbot/docker/Dockerfile -t stellar-friendbot:${{ inputs.arch }}
-o type=docker,dest=/tmp/image
--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
docker buildx build --platform linux/${{ inputs.arch }}
-f services/friendbot/docker/Dockerfile -t stellar-friendbot:${{ inputs.arch }}
-o type=docker,dest=/tmp/image
--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
https://github.com/stellar/go.git#${{ env.FRIENDBOT_REPO_REF }}
- name: Upload Stellar-Friendbot Image
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -197,18 +202,66 @@ jobs:
- uses: docker/setup-buildx-action@5146db6c4d81fbfd508899f851bbb3883a96ff9f
- name: Build Stellar-rpc Image
run: >
docker buildx build --platform linux/${{ inputs.arch }}
-f cmd/stellar-rpc/docker/Dockerfile --target build
-t stellar-rpc:${{ inputs.arch }}
-o type=docker,dest=/tmp/image
--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
docker buildx build --platform linux/${{ inputs.arch }}
-f cmd/stellar-rpc/docker/Dockerfile --target build
-t stellar-rpc:${{ inputs.arch }}
-o type=docker,dest=/tmp/image
--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
https://github.com/stellar/stellar-rpc.git#${{ env.STELLAR_RPC_REPO_BRANCH }}
- name: Upload Stellar-rpc Image
uses: actions/upload-artifact@v4
with:
name: image-stellar-rpc-${{ inputs.tag }}-${{ inputs.arch }}
path: /tmp/image

load-stellar-lab-from-cache:
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}
steps:
- id: cache
uses: actions/cache@v3
with:
path: /tmp/image
key: image-stellar-lab-${{ inputs.tag }}-${{ env.LAB_REPO_REF }}
- name: Upload Stellar-Lab Image
if: steps.cache.outputs.cache-hit == 'true'
uses: actions/upload-artifact@v4
with:
name: image-stellar-lab-${{ inputs.tag }}-${{ env.LAB_REPO_REF }}
path: /tmp/image

build-stellar-lab:
if: ${{ needs.load-stellar-lab-from-cache.outputs.cache-hit != 'true' }}
runs-on: ubuntu-latest
steps:
- id: cache
uses: actions/cache@v3
with:
path: /tmp/image
key: image-stellar-lab-${{ inputs.tag }}-${{ env.LAB_REPO_REF }}
- name: Checkout Quickstart for Horizon docker file
uses: actions/checkout@v3
with:
ref: ${{ inputs.sha }}
- if: inputs.arch == 'arm64'
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18
with:
platforms: arm64
- name: Setup buildx
uses: docker/setup-buildx-action@5146db6c4d81fbfd508899f851bbb3883a96ff9f
- name: Build Stellar-lab Image
run: >
docker buildx build --platform linux/${{ inputs.arch }}
-f Dockerfile.lab --target builder
-t stellar-lab:${{ inputs.arch }} -o type=docker,dest=/tmp/image
--build-arg NEXT_PUBLIC_COMMIT_HASH=${{ env.LAB_REPO_REF }} .
- name: Upload Stellar-lab Image
uses: actions/upload-artifact@v4
with:
name: image-stellar-lab-${{ inputs.tag }}-${{ env.LAB_REPO_REF }}
path: /tmp/image

load-rs-stellar-xdr-from-cache:
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -247,25 +300,32 @@ jobs:
- uses: docker/setup-buildx-action@5146db6c4d81fbfd508899f851bbb3883a96ff9f
- name: Build Stellar-Rs-Xdr Image
run: >
docker buildx build --platform linux/${{ inputs.arch }}
-f Dockerfile.xdr --target builder
-t stellar-rs-xdr:${{ inputs.arch }}
-o type=docker,dest=/tmp/image
--build-arg REPO=https://github.com/stellar/rs-stellar-xdr.git
--build-arg REF="${{ env.XDR_REPO_REF }}" .
docker buildx build --platform linux/${{ inputs.arch }}
-f Dockerfile.xdr --target builder
-t stellar-rs-xdr:${{ inputs.arch }}
-o type=docker,dest=/tmp/image
--build-arg REPO=https://github.com/stellar/rs-stellar-xdr.git
--build-arg REF="${{ env.XDR_REPO_REF }}" .
- name: Upload Stellar-Rs-Xdr Image
uses: actions/upload-artifact@v4
with:
name: image-rs-stellar-xdr-${{ inputs.tag }}-${{ inputs.arch }}
path: /tmp/image
path: /tmp/image

build:
needs: [build-stellar-core, build-stellar-horizon, build-rs-stellar-xdr, build-stellar-friendbot, build-stellar-rpc]
needs: [build-stellar-core, build-stellar-horizon, build-rs-stellar-xdr, build-stellar-friendbot, build-stellar-rpc, build-stellar-lab]
if: always()
outputs:
image: ${{ steps.image.outputs.name }}
runs-on: ubuntu-latest
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
df -h
- uses: actions/checkout@v3
with:
ref: ${{ inputs.sha }}
Expand All @@ -289,6 +349,11 @@ jobs:
with:
name: image-stellar-friendbot-${{ inputs.tag }}-${{ inputs.arch }}
path: /tmp/stellar-friendbot
- name: Download Stellar-Lab Image
uses: actions/download-artifact@v4
with:
name: image-stellar-lab-${{ inputs.tag }}-${{ env.LAB_REPO_REF }}
path: /tmp/stellar-lab
- name: Download Stellar-rpc Image
uses: actions/download-artifact@v4
with:
Expand All @@ -300,6 +365,8 @@ jobs:
run: docker load -i /tmp/stellar-horizon/image
- name: Load Stellar-Friendbot Image
run: docker load -i /tmp/stellar-friendbot/image
- name: Load Stellar-Lab Image
run: docker load -i /tmp/stellar-lab/image
- name: Load Stellar-rpc Image
run: docker load -i /tmp/stellar-rpc/image
- name: Load Stellar-Rs-Xdr Image
Expand Down Expand Up @@ -334,6 +401,7 @@ jobs:
--build-arg HORIZON_IMAGE_REF=stellar-horizon:${{ inputs.arch }}
--build-arg FRIENDBOT_IMAGE_REF=stellar-friendbot:${{ inputs.arch }}
--build-arg STELLAR_RPC_IMAGE_REF=stellar-rpc:${{ inputs.arch }}
--build-arg LAB_IMAGE_REF=stellar-lab:${{ inputs.arch }}
- name: Save Quickstart Image
run: docker save $IMAGE -o /tmp/image
- name: Upload Quickstart Image
Expand Down
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ ARG STELLAR_CORE_IMAGE_REF
ARG HORIZON_IMAGE_REF
ARG FRIENDBOT_IMAGE_REF
ARG STELLAR_RPC_IMAGE_REF
ARG LAB_IMAGE_REF

FROM $STELLAR_XDR_IMAGE_REF AS stellar-xdr
FROM $STELLAR_CORE_IMAGE_REF AS stellar-core
FROM $HORIZON_IMAGE_REF AS horizon
FROM $FRIENDBOT_IMAGE_REF AS friendbot
FROM $STELLAR_RPC_IMAGE_REF AS stellar-rpc
FROM $LAB_IMAGE_REF AS lab

FROM ubuntu:22.04

Expand All @@ -19,21 +21,28 @@ EXPOSE 5432
EXPOSE 8000
EXPOSE 6060
EXPOSE 6061
EXPOSE 8002
EXPOSE 11625
EXPOSE 11626

ADD dependencies /
RUN /dependencies

COPY --from=stellar-xdr /usr/local/cargo/bin/stellar-xdr /usr/local/bin/stellar-xdr

COPY --from=stellar-core /usr/local/bin/stellar-core /usr/bin/stellar-core

COPY --from=horizon /go/bin/horizon /usr/bin/stellar-horizon

COPY --from=friendbot /app/friendbot /usr/local/bin/friendbot

COPY --from=stellar-rpc /bin/stellar-rpc /usr/bin/stellar-rpc
COPY --from=lab /lab /opt/stellar/lab
COPY --from=lab /usr/local/bin/node \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the lab is a static website. Can we build the static site and host it with nginx instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is, but I asked in Slack anyway.

/usr/local/bin/npm \
/usr/local/bin/corepack \
/usr/local/bin/npx \
/usr/local/bin/yarn \
/usr/local/bin/yarnpkg \
/usr/bin/
COPY --from=lab /usr/local/include/node /usr/local/include/node
COPY --from=lab /usr/local/lib/node_modules /usr/local/lib/node_modules

RUN adduser --system --group --quiet --home /var/lib/stellar --disabled-password --shell /bin/bash stellar;

Expand Down
17 changes: 17 additions & 0 deletions Dockerfile.lab
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:22 AS builder

ARG NEXT_PUBLIC_COMMIT_HASH
ENV NEXT_TELEMETRY_DISABLED=1
ENV PORT=8002
WORKDIR /lab
RUN git clone https://github.com/stellar/laboratory /lab
RUN git fetch origin ${NEXT_PUBLIC_COMMIT_HASH}
RUN git checkout ${NEXT_PUBLIC_COMMIT_HASH}
RUN rm -rf .git
RUN yarn install
ENV NEXT_PUBLIC_DEFAULT_NETWORK=custom
ENV NEXT_BASE_PATH=/lab
RUN yarn build

EXPOSE 8002
CMD ["npm", "start"]
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ CORE_CONFIGURE_FLAGS?=--disable-tests
STELLAR_RPC_REF?=main
HORIZON_REF?=master
FRIENDBOT_REF?=$(HORIZON_REF)
LAB_REF?=main

run:
docker run --rm --name stellar -p 8000:8000 stellar/quickstart:$(TAG) --local --enable-stellar-rpc
Expand Down Expand Up @@ -58,8 +59,9 @@ build:
--build-arg HORIZON_IMAGE_REF=stellar-horizon:$(HORIZON_REF) \
--build-arg FRIENDBOT_IMAGE_REF=stellar-friendbot:$(FRIENDBOT_REF) \
--build-arg STELLAR_RPC_IMAGE_REF=stellar-rpc:$(STELLAR_RPC_REF) \
--build-arg LAB_IMAGE_REF=stellar-lab:$(LAB_REF)

build-deps: build-deps-xdr build-deps-core build-deps-horizon build-deps-friendbot build-deps-stellar-rpc
build-deps: build-deps-xdr build-deps-core build-deps-horizon build-deps-friendbot build-deps-stellar-rpc build-deps-lab

build-deps-xdr:
docker build -t stellar-xdr:$(XDR_REF) -f Dockerfile.xdr --target builder . --build-arg REPO="$(XDR_REPO)" --build-arg REF="$(XDR_REF)"
Expand All @@ -75,3 +77,6 @@ build-deps-friendbot:

build-deps-stellar-rpc:
docker build -t stellar-rpc:$(STELLAR_RPC_REF) -f cmd/stellar-rpc/docker/Dockerfile --target build https://github.com/stellar/stellar-rpc.git#$(STELLAR_RPC_REF) --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true

build-deps-lab:
docker build -t stellar-lab:$(LAB_REF) -f Dockerfile.lab --target builder . --build-arg NEXT_PUBLIC_COMMIT_HASH=$(LAB_REF)
10 changes: 10 additions & 0 deletions common/lab/bin/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /bin/bash

set -e
set -o pipefail

echo "starting lab..."
export PORT=8002
export NEXT_BASE_PATH=/lab
export NEXT_PUBLIC_DEFAULT_NETWORK=custom
./node_modules/.bin/next start
4 changes: 4 additions & 0 deletions common/nginx/etc/conf.d/lab.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
location /lab {
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8002;
}
9 changes: 9 additions & 0 deletions common/supervisor/etc/supervisord.conf.d/stellar-lab.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[program:stellar-lab]
user=stellar
directory=/opt/stellar/lab
command=/opt/stellar-default/common/lab/bin/start
autostart=false
startretries=50
autorestart=true
priority=60
redirect_stderr=true
Loading
Loading