generated from PaulRBerg/hardhat-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
577 additions
and
86 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,3 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker build -t ghcr.io/gnosisguild/ciphernode:mytest -f ./packages/ciphernode/Dockerfile . | ||
# Enable BuildKit | ||
export DOCKER_BUILDKIT=1 | ||
|
||
mkdir -p /tmp/docker-cache | ||
|
||
time docker buildx build \ | ||
--cache-from=type=local,src=/tmp/docker-cache \ | ||
--cache-to=type=local,dest=/tmp/docker-cache \ | ||
--load \ | ||
-t ghcr.io/gnosisguild/ciphernode -f ./packages/ciphernode/Dockerfile . |
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,8 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ ! -f "./.deploy/.env" ]; then | ||
echo "Environment file ./.deploy/.env not found!" | ||
exit 1 | ||
fi | ||
wait_ready() { | ||
local stack_name="$1" | ||
until [ "$(docker stack services $stack_name --format '{{.Replicas}}' | awk -F'/' '$1 != $2')" = "" ]; do | ||
printf "." | ||
sleep 1 | ||
done | ||
echo -ne "\r\033[K" | ||
echo "Stack $stack_name is ready!" | ||
} | ||
|
||
docker stack deploy -c .deploy/docker-compose.yml enclave-stack --detach=false | ||
wait_removed() { | ||
local stack_name="$1" | ||
while docker stack ps $stack_name >/dev/null 2>&1; do | ||
printf "." | ||
sleep 1 | ||
done | ||
echo -ne "\r\033[K" | ||
echo "Stack $stack_name is removed" | ||
} | ||
|
||
stack_name=${1:-enclave} | ||
docker stack rm $stack_name | ||
wait_removed $stack_name | ||
docker stack deploy -c docker-compose.yml --prune $stack_name | ||
wait_ready $stack_name |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,13 @@ | ||
use petname::{Generator, Petnames}; | ||
use rand::rngs::StdRng; | ||
use rand::SeedableRng; | ||
|
||
static COMPILE_ID: u64 = compile_time::unix!(); | ||
|
||
/// Generate a unique compilation ID for the build based on the time of compilation | ||
pub fn generate_id() -> String { | ||
let mut rng = StdRng::seed_from_u64(COMPILE_ID); | ||
Petnames::small() | ||
.generate(&mut rng, 3, "_") | ||
.unwrap_or("default-name".to_owned()) | ||
} |
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,24 @@ | ||
use std::{ | ||
fmt::Display, | ||
sync::atomic::{AtomicUsize, Ordering}, | ||
}; | ||
|
||
static NEXT_CORRELATION_ID: AtomicUsize = AtomicUsize::new(1); | ||
|
||
#[derive(Debug,Clone)] | ||
pub struct CorrelationId { | ||
id: usize, | ||
} | ||
|
||
impl CorrelationId { | ||
pub fn new() -> Self { | ||
let id = NEXT_CORRELATION_ID.fetch_add(1, Ordering::SeqCst); | ||
Self { id } | ||
} | ||
} | ||
|
||
impl Display for CorrelationId { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "{}", self.id) | ||
} | ||
} |
Oops, something went wrong.