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
5 changed files
with
140 additions
and
15 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.secrets.json | ||
!example.secrets.json |
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,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Set working directory to script location | ||
cd "$(dirname "$0")" || exit 1 | ||
|
||
# Source file path (in current directory) | ||
SOURCE="example.secrets.json" | ||
|
||
# Color codes | ||
RED='\033[0;31m' | ||
YELLOW='\033[1;33m' | ||
NC='\033[0m' # No Color | ||
|
||
# List of target files | ||
TARGETS=("cn1" "cn2" "cn3" "agg") | ||
|
||
# Check if source file exists | ||
if [ ! -f "$SOURCE" ]; then | ||
echo "Error: Source file $SOURCE not found!" | ||
exit 1 | ||
fi | ||
|
||
# Copy file to each target, skipping if exists | ||
for target in "${TARGETS[@]}"; do | ||
if [ -f "${target}.secrets.json" ]; then | ||
echo "Skipping ${target}.secrets.json - file already exists" | ||
else | ||
cp "$SOURCE" "${target}.secrets.json" | ||
echo "Created ${target}.secrets.json" | ||
fi | ||
done | ||
|
||
echo "Copy operation completed!" | ||
|
||
# Check for unchanged files | ||
echo -e "\nChecking for unchanged secret files..." | ||
UNCHANGED_FILES=() | ||
|
||
for target in "${TARGETS[@]}"; do | ||
if [ -f "${target}.secrets.json" ]; then | ||
if cmp -s "$SOURCE" "${target}.secrets.json"; then | ||
UNCHANGED_FILES+=("${target}.secrets.json") | ||
fi | ||
fi | ||
done | ||
|
||
# Display warning if unchanged files found | ||
if [ ${#UNCHANGED_FILES[@]} -gt 0 ]; then | ||
echo -e "${RED}WARNING: The following files are identical to example.secrets.json:${NC}" | ||
for file in "${UNCHANGED_FILES[@]}"; do | ||
echo -e "${YELLOW}==> ${NC}${file}${YELLOW} <==${NC}" | ||
done | ||
echo -e "${RED}These files should be modified before use in production!${NC}" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"password": "changeme", | ||
"private_key": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" | ||
} |
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,31 @@ | ||
|
||
# Secrets Setup Script | ||
|
||
To deploy with swarm we need to set up the secrets file for our cluster. | ||
|
||
## Run | ||
```bash | ||
./.deploy/copy-secrets.sh | ||
``` | ||
|
||
## What it does | ||
- Copies `example.secrets.json` to create `cn1/2/3` and `agg.secrets.json` files | ||
- Skips existing files | ||
- Warns with yellow arrows (==>) if any files are identical to the example | ||
|
||
## Example output | ||
```bash | ||
Created cn1.secrets.json | ||
Skipping cn2.secrets.json - file already exists | ||
|
||
==> cn1.secrets.json <== # Yellow arrows indicate files that need customization | ||
``` | ||
|
||
Remember to modify any highlighted files before use. | ||
|
||
# Run docker swarm | ||
|
||
``` | ||
docker stack deploy -c .deploy/docker-compose.yml p2p-stack | ||
``` | ||
|