forked from matter-labs/zksync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create initial dockerfile for exit tool
- Loading branch information
Showing
12 changed files
with
131 additions
and
13 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
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,12 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Check generated sqlx data | ||
if ! cargo sqlx prepare --check | ||
then | ||
# Prepare sqlx bindings | ||
# We're going to do it even on CI, since it seems that this file can be invalidated after several subsequent compilations. | ||
echo "Going to rerun 'sqlx prepare'" | ||
cargo sqlx prepare | ||
fi |
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
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 @@ | ||
DATABASE_URL=postgres://postgres@localhost/plasma |
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,30 @@ | ||
# syntax=docker/dockerfile:experimental | ||
FROM debian:buster-slim | ||
|
||
WORKDIR /usr/src/zksync | ||
|
||
# Prepare dependencies | ||
RUN apt-get update && apt-get install -y bash git nodejs npm postgresql openssl libssl-dev gcc g++ curl libpq-dev pkg-config software-properties-common | ||
RUN apt-get install -y libpq5 ca-certificates && rm -rf /var/lib/apt/lists/* | ||
RUN npm install -g yarn | ||
|
||
# Install Rust and required cargo packages | ||
ENV RUSTUP_HOME=/usr/local/rustup \ | ||
CARGO_HOME=/usr/local/cargo \ | ||
PATH=/usr/local/cargo/bin:$PATH | ||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y | ||
RUN cargo install diesel_cli --no-default-features --features postgres | ||
RUN cargo install --version=0.1.0-beta.1 sqlx-cli | ||
|
||
# Copy workspace | ||
COPY . . | ||
|
||
# Build all the required zkSync binaries | ||
RUN cargo build --release | ||
RUN cargo build --release --example generate_exit_proof | ||
|
||
COPY docker/exit-tool/exit-tool-entry.sh /usr/local/bin/ | ||
|
||
# Setup the environment | ||
ENV ZKSYNC_HOME=/usr/src/zksync | ||
ENV PATH="${ZKSYNC_HOME}/bin:${PATH}" |
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,12 @@ | ||
version: '3.2' | ||
services: | ||
postgres: | ||
image: "postgres:12" | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- type: bind | ||
source: ./volumes/postgres | ||
target: /var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_HOST_AUTH_METHOD=trust |
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,44 @@ | ||
#!/bin/bash | ||
|
||
# 1. Check whether database `plasma` exists | ||
# 2. If not, run all the migrations | ||
# 3. Run data-restore in the finite mode | ||
# 4. Run gen-exit-proof | ||
|
||
USAGE="exit_tool_entry.sh init|restart|run|continue account_id token web3_url" | ||
|
||
. .setup_env | ||
|
||
cd $ZKSYNC_HOME | ||
|
||
if [ -z $ZKSYNC_ENV ]; | ||
then | ||
echo "$USAGE" | ||
exit 1 | ||
fi | ||
|
||
COMMAND=$1 | ||
|
||
case $COMMAND in | ||
init) | ||
f db-setup | ||
echo "Database set up" | ||
exit 0 | ||
;; | ||
run) | ||
f cargo run --bin zksync_data_restore --release -- --genesis --finite | ||
;; | ||
continue) | ||
f cargo run --bin zksync_data_restore --release -- --continue --finite | ||
;; | ||
-h | --help) | ||
echo "$USAGE" | ||
exit 0 | ||
;; | ||
*) | ||
echo "Unknown Data Restore command" | ||
echo "$USAGE" | ||
exit 1 | ||
;; | ||
esac | ||
|
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 @@ | ||
# 1. Download keys | ||
# 2. Run the binary with the keys directory mapped to the `/keys/setup` in container |