Skip to content
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

75 improve building deployment #76

Merged
merged 23 commits into from
Oct 27, 2024
Merged
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
4 changes: 3 additions & 1 deletion .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ jobs:
- uses: depot/build-push-action@v1
with:
context: .
build-args: DOJO_VERSION=${{ env.DOJO_VERSION }}
build-args: |
GENERATE_POPULATED_CORE=true
DOJO_VERSION=${{ env.DOJO_VERSION }}
push: true
# FIXME: Currently arm64 is failing on node-gyp compilation
platforms: linux/amd64,linux/arm64
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ jobs:
- uses: asdf-vm/actions/setup@v3
- run: |
asdf plugin add dojo https://github.com/dojoengine/asdf-dojo
asdf install dojo 1.0.0-alpha.17
asdf global dojo 1.0.0-alpha.17
asdf install dojo 1.0.0-alpha.18
asdf global dojo 1.0.0-alpha.18
sozo test
21 changes: 9 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
target/
node_modules/
.idea/

.idea
.env
deployed.log
last_deployed_world
web/public/assets/placeholder/pixel-state.png
**/**/*.log
**/**/*.sqlite
target/

contracts/out
contracts/target
contracts/manifests/
contracts/overlay
.aider*
db/
contracts/manifests/dev*

*.account.json
*.keystore.json

2 changes: 1 addition & 1 deletion DOJO_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0-alpha.17
1.0.0-alpha.18
44 changes: 10 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ SHELL ["/bin/bash", "-c"]

ARG ASDF_VERSION="v0.14.1"
ARG SCARB_VERSION="2.7.0"
ARG DOJO_VERSION="1.0.0-alpha.17"
ARG DOJO_VERSION="1.0.0-alpha.18"
ARG STARKLI_VERSION="0.1.6"


# Install dependencies
RUN apt-get update && \
apt-get install -y \
Expand Down Expand Up @@ -59,14 +60,6 @@ RUN source ~/.bashrc
ENV PATH="/root/.starkli/bin:${PATH}"
RUN starkliup -v ${STARKLI_VERSION}

##Install Scarb
#RUN curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash -s -- -v 2.7.0
##RUN chmod +x ./install.sh
##RUN export PATH=$HOME/.local/bin:$PATH && ./install.sh
#RUN echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.bashrc
#ENV PATH="/root/.local/bin:${PATH}"



# Stage 4: Setup runtime
FROM dojo AS builder
Expand All @@ -85,6 +78,7 @@ COPY ./contracts/dojo_dev.toml /tmp/dojo_init
COPY ./contracts/Scarb.toml /tmp/dojo_init
COPY ./contracts/Scarb.lock /tmp/dojo_init


# Run build separately to cache the dojo/scarb dependencies

RUN --mount=type=cache,id=scarb_cache,target=/root/.cache/scarb \
Expand All @@ -96,37 +90,19 @@ COPY ./contracts /tmp/contracts

WORKDIR /tmp/contracts

## Generate genesis.json for EMPTY core
## Generate storage_init
RUN \
--mount=type=cache,id=scarb_cache,target=/root/.cache/scarb \
--mount=type=secret,id=DOJO_KEYSTORE_PASSWORD \
export DOJO_KEYSTORE_PASSWORD=$(cat /run/secrets/DOJO_KEYSTORE_PASSWORD) && \
export STARKNET_KEYSTORE_PASSWORD=$(cat /run/secrets/DOJO_KEYSTORE_PASSWORD) && \
bash scripts/create_snapshot.sh dev && \
WORLD_ADDRESS=$(jq -r '.world.address' manifests/dev/deployment/manifest.json) && \
echo $WORLD_ADDRESS && \
mkdir -p /pixelaw/storage_init/$WORLD_ADDRESS && \
cp out/dev/genesis.json /pixelaw/storage_init/$WORLD_ADDRESS/genesis.json && \
cp manifests/dev/deployment/manifest.json /pixelaw/storage_init/$WORLD_ADDRESS/manifest.json && \
cp out/dev/katana_db.zip /pixelaw/storage_init/$WORLD_ADDRESS/katana_db.zip && \
cp out/dev/torii.sqlite.zip /pixelaw/storage_init/$WORLD_ADDRESS/torii.sqlite.zip && \
rm -rf out/dev


## Generate genesis.json for POPULATED core
bash scripts/create_snapshot_docker.sh dev


ARG GENERATE_POPULATED_CORE=false
RUN \
--mount=type=cache,id=scarb_cache,target=/root/.cache/scarb \
--mount=type=secret,id=DOJO_KEYSTORE_PASSWORD \
export DOJO_KEYSTORE_PASSWORD=$(cat /run/secrets/DOJO_KEYSTORE_PASSWORD) && \
export STARKNET_KEYSTORE_PASSWORD=$(cat /run/secrets/DOJO_KEYSTORE_PASSWORD) && \
bash scripts/create_snapshot.sh dev-pop && \
WORLD_ADDRESS=$(jq -r '.world.address' manifests/dev-pop/deployment/manifest.json) && \
echo $WORLD_ADDRESS && \
mkdir -p /pixelaw/storage_init/$WORLD_ADDRESS && \
cp out/dev-pop/genesis.json /pixelaw/storage_init/$WORLD_ADDRESS/genesis.json && \
cp out/dev-pop/katana_db.zip /pixelaw/storage_init/$WORLD_ADDRESS/katana_db.zip && \
cp out/dev-pop/torii.sqlite.zip /pixelaw/storage_init/$WORLD_ADDRESS/torii.sqlite.zip && \
rm -rf out/dev-pop
bash scripts/create_snapshot_docker.sh dev-pop ${GENERATE_POPULATED_CORE}



# Stage 2: Put the webapp files in place
Expand Down
14 changes: 0 additions & 14 deletions GAME_IDEAS.md

This file was deleted.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ DOJO_VERSION = $(shell cat DOJO_VERSION)
docker_build:
echo $$private_key && \
docker build -t $(REPO):$(CORE_VERSION) -t $(REPO):latest \
--build-arg DOJO_VERSION=$(DOJO_VERSION) \
--build-arg DOJO_VERSION=$(DOJO_VERSION) \
--build-arg GENERATE_POPULATED_CORE=false \
--secret id=DOJO_KEYSTORE_PASSWORD \
--network=host \
--pull=false \
Expand Down
2 changes: 1 addition & 1 deletion contracts/.tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dojo 1.0.0-alpha.17
dojo 1.0.0-alpha.18
scarb 2.7.0
2 changes: 1 addition & 1 deletion contracts/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"cairo1.enableLanguageServer": true,
"cairo1.languageServerPath": "${userHome}/.asdf/installs/dojo/1.0.0-alpha.17/bin/dojo-language-server",
"cairo1.languageServerPath": "${userHome}/.asdf/installs/dojo/1.0.0-alpha.18/bin/dojo-language-server",
"cairo1.enableScarb": true,
"cairo1.scarbPath": "${userHome}/.asdf/installs/scarb/2.7.0/bin/scarb",
"cairo1.preferScarbLanguageServer": false
Expand Down
2 changes: 1 addition & 1 deletion contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Follow the asdf installation instructions.

```
asdf plugin add dojo https://github.com/dojoengine/asdf-dojo
asdf install dojo 1.0.0-alpha.17
asdf install dojo 1.0.0-alpha.18
```

### Install scarb
Expand Down
2 changes: 1 addition & 1 deletion contracts/Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = 1
[[package]]
name = "dojo"
version = "1.0.0-alpha.4"
source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.17#e6bab2d0066c3cf1acfc5ee41a27294b5b23697d"
source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.18#e6bab2d0066c3cf1acfc5ee41a27294b5b23697d"

[[package]]
name = "pixelaw"
Expand Down
4 changes: 2 additions & 2 deletions contracts/Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
cairo-version = "=2.7.0"
name = "pixelaw"
version = "0.4.4"
version = "0.4.6"
homepage = "https://github.com/pixelaw/core"
edition = "2024_07"

[cairo]
sierra-replace-ids = true

[dependencies]
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.17" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.18" }

[tool.fmt]
sort-module-level-items = true
Expand Down
4 changes: 2 additions & 2 deletions contracts/Scarb_deploy.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
cairo-version = "=2.7.0"
name = "pixelaw"
version = "0.4.4"
version = "0.4.6"
homepage = "https://github.com/pixelaw/core"
edition = "2024_07"

[cairo]
sierra-replace-ids = true

[dependencies]
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.17" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.18" }

[tool.fmt]
sort-module-level-items = true
Expand Down
13 changes: 0 additions & 13 deletions contracts/dev-account.json

This file was deleted.

20 changes: 0 additions & 20 deletions contracts/dev-keystore.json

This file was deleted.

3 changes: 2 additions & 1 deletion contracts/dojo_dev-pop.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mappings = {}

[env]
rpc_url = "http://localhost:5050/"
account_address = "0xb3ff441a68610b30fd5e2abbf3a1548eb6ba6f3559f2862bf2dc757e5828ca"
account_address = "0x3c4dd268780ef738920c801edc3a75b6337bc17558c74795b530c0ff502486"
private_key = "0x2bbf4f9fd0bbb2e60b0316c1fe0b76cf7a4d0198bd493ced9b8df2a3a24d68a"
world_address = "0x5729e109ed70ce4f33e3164505c78476e9fec57874b69467cdf0ba51636085"

5 changes: 3 additions & 2 deletions contracts/dojo_dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mappings = {}

[env]
rpc_url = "http://localhost:5050/"
account_address = "0x127fd5f1fe78a71f8bcd1fec63e3fe2f0486b6ecd5c86a0466c3a21fa5cfcec"
private_key = "0xc5b2fcab997346f3ea1c00b002ecf6f382c5f9c9659a3894eb783c5320f912"
account_address = "0x3c4dd268780ef738920c801edc3a75b6337bc17558c74795b530c0ff502486"
private_key = "0x2bbf4f9fd0bbb2e60b0316c1fe0b76cf7a4d0198bd493ced9b8df2a3a24d68a"
world_address = "0x4adbe4bfe631a95a5ce99d8200a8721b1ac8096ff8941cecddc4e79a7b2d5d5"

19 changes: 0 additions & 19 deletions contracts/dojo_pop.toml

This file was deleted.

3 changes: 3 additions & 0 deletions contracts/dojo_sepolia.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ mappings = {}

[env]
rpc_url = "https://starknet-sepolia.public.blastapi.io/rpc/v0_7"
keystore_path = "accounts/deployer.keystore.json"
account_address = "0x02c306e30b02a1a734bc770af37b32619911f1cfd6ccecb93c5899632f379da9"
world_address = "0x4adbe4bfe631a95a5ce99d8200a8721b1ac8096ff8941cecddc4e79a7b2d5d5"
Loading
Loading