Skip to content

Commit

Permalink
Prepare v0.3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Caspar Oostendorp committed May 27, 2024
1 parent 9693565 commit 3238836
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 43 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ COPY --from=builder /pixelaw .
COPY --from=web /app/dist /pixelaw/web/
COPY --from=server /app server/

COPY ./startup.sh ./startup.sh
COPY ./supervisord.conf ./supervisord.conf
COPY ./scripts/.bashrc /root/
COPY docker/scripts/ /pixelaw/scripts/
COPY docker/supervisord.conf ./supervisord.conf
COPY docker/.bashrc /root/
COPY ./tools/ /pixelaw/tools/

RUN mkdir /pixelaw/log
Expand All @@ -127,5 +127,5 @@ EXPOSE 5050
EXPOSE 8080
EXPOSE 3000

CMD ["bash", "./startup.sh"]
CMD ["bash", "./scripts/startup.sh"]

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.13
0.3.14
40 changes: 8 additions & 32 deletions startup.sh → docker/.bashrc
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#!/bin/bash

echo "World address: $WORLD_ADDRESS"
echo "Server port: $SERVER_PORT"

cat << EOF >> /root/.bashrc
export STORAGE_DIR="/pixelaw/storage/$WORLD_ADDRESS"
export LOG_DIR="$STORAGE_DIR/log"
export STORAGE_INIT_DIR="/pixelaw/storage_init/$WORLD_ADDRESS"
Expand All @@ -17,33 +12,14 @@ export SERVER_LOG="$LOG_DIR/server.log"
export GENESIS="$STORAGE_DIR/genesis.json"
export STARKNET_RPC="http://localhost:5050"
export WEB_DIR="/pixelaw/web"
EOF

source /root/.bashrc

if [ ! -f "$GENESIS" ]; then
mkdir -p $LOG_DIR
touch $KATANA_LOG && touch $TORII_LOG
unzip $KATANA_DB_ZIP -d $STORAGE_DIR
unzip $TORII_DB_ZIP -d $STORAGE_DIR

cp "$STORAGE_INIT_DIR/genesis.json" $GENESIS

fi

supervisord -c /pixelaw/supervisord.conf

echo "ready"

# If there is no param, wait. Otherwise, it's a devcontainer that will take control.
if [ -z "$1" ]; then
wait
fi






alias katana_start="/pixelaw/scripts/katana_start.sh"
alias torii_start="/pixelaw/scripts/torii_start.sh"
alias server_start="/pixelaw/scripts/server_start.sh"

alias klog="tail -f $KATANA_LOG"
alias tlog="tail -f $TORII_LOG"
alias slog="tail -f $SERVER_LOG"

echo "World Address: $WORLD_ADDRESS"
echo "View logs with klog, tlog and slog commands"
36 changes: 36 additions & 0 deletions docker/scripts/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

echo "World address: $WORLD_ADDRESS"
echo "Server port: $SERVER_PORT"

source /root/.bashrc

# Not sure if this helps on MacOs to wait for disk mount?
sleep 2

if [ ! -f "$GENESIS" ]; then
mkdir -p $LOG_DIR
touch $KATANA_LOG && touch $TORII_LOG
unzip $KATANA_DB_ZIP -d $STORAGE_DIR
unzip $TORII_DB_ZIP -d $STORAGE_DIR

cp "$STORAGE_INIT_DIR/genesis.json" $GENESIS

fi

supervisord -c /pixelaw/supervisord.conf

echo "ready"

# If there is no param, wait. Otherwise, it's a devcontainer that will take control.
if [ -z "$1" ]; then
wait
fi








6 changes: 3 additions & 3 deletions supervisord.conf → docker/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ pidfile=/pixelaw/supervisord.pid


[program:katana]
command=katana --genesis %(ENV_GENESIS)s --invoke-max-steps 4294967295 --disable-fee --disable-validate --json-log --block-time 2000 --db-dir %(ENV_KATANA_DB)s --allowed-origins "*"
command=/pixelaw/scripts/katana_start.sh
redirect_stderr=true
stdout_logfile=%(ENV_KATANA_LOG)s
stdout_logfile_maxbytes=0

[program:torii]
command=torii --world %(ENV_WORLD_ADDRESS)s --database %(ENV_TORII_DB)s --events-chunk-size 10000 --allowed-origins "*"
command=/pixelaw/scripts/torii_start.sh
redirect_stderr=true
stdout_logfile=%(ENV_TORII_LOG)s
stdout_logfile_maxbytes=0

[program:server]
command=yarn --cwd /pixelaw/server server
command=/pixelaw/scripts/server_start.sh
redirect_stderr=true
stdout_logfile=%(ENV_SERVER_LOG)s
stdout_logfile_maxbytes=0
3 changes: 0 additions & 3 deletions scripts/.bashrc

This file was deleted.

0 comments on commit 3238836

Please sign in to comment.