Skip to content
Open
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: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Sometimes in Apple Silicon devices (m1/m2 macbooks), buildx will not work for bu
```
DOCKER_BUILD=build ./docker.local/bin/build.base.sh
DOCKER_BUILD=build ./docker.local/bin/build.blobber.sh
DOCKER_BUILD=build ./docker.local/bin/build.validator.sh.
DOCKER_BUILD=build ./docker.local/bin/build.validator.sh
```

4. To link to local gosdk so that the changes are reflected on the blobber build please use the below command(optional)
Expand Down Expand Up @@ -128,7 +128,7 @@ cd $HOME/.zcn/

```
# For locally build images
make blobbers_start num=n
./blobbers_start num=n

where n is the number of blobbers you want to run

Expand Down
Binary file added bin/fundwallet
Binary file not shown.
Empty file removed blobber_start.sh
Empty file.
Empty file removed blobber_stop.sh
Empty file.
47 changes: 47 additions & 0 deletions blobbers_start
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$SCRIPT_DIR"

usage() {
cat <<EOF
Usage: $(basename "$0") num=<count>

Starts the specified number of blobbers by invoking the Makefile target
defined in ${PROJECT_ROOT}/Makefile.
EOF
}

NUM=""

for arg in "$@"; do
case "$arg" in
num=*)
NUM="${arg#num=}"
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $arg" >&2
usage
exit 1
;;
esac
done

if [[ -z "$NUM" ]]; then
echo "Error: num parameter is required." >&2
usage
exit 1
fi

if ! [[ "$NUM" =~ ^[1-9][0-9]*$ ]]; then
echo "Error: num must be a positive integer." >&2
exit 1
fi

make -C "$PROJECT_ROOT" blobbers_start "num=$NUM"

2 changes: 2 additions & 0 deletions docker.local/b0docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ services:
- ../config/postgresql.conf:/etc/postgresql/postgresql.conf
- ./blobber${BLOBBER}/data/postgresql:/var/lib/postgresql/data
- ./sql_init:/docker-entrypoint-initdb.d
- ./postgres-entrypoint-fix.sh:/usr/local/bin/postgres-entrypoint-fix.sh:ro
# - ../blobber${BLOBBER}/data/postgresql2:/var/lib/postgresql/hdd
entrypoint: ["/usr/local/bin/postgres-entrypoint-fix.sh"]
command: postgres -c config_file=/etc/postgresql/postgresql.conf
restart: unless-stopped
networks:
Expand Down
31 changes: 31 additions & 0 deletions docker.local/fix-postgres-symlinks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# Script to fix broken PostgreSQL symlinks in pg_tblspc

BLOBBER=${BLOBBER:-1}
DATA_DIR="./blobber${BLOBBER}/data/postgresql"

if [ ! -d "$DATA_DIR" ]; then
echo "Error: Data directory not found: $DATA_DIR"
echo "Please set BLOBBER environment variable if using a different blobber number"
exit 1
fi

PG_TBLSPC_DIR="$DATA_DIR/pg_tblspc"

if [ -d "$PG_TBLSPC_DIR" ]; then
echo "Checking for broken symlinks in $PG_TBLSPC_DIR..."
broken_links=$(find "$PG_TBLSPC_DIR" -type l ! -exec test -e {} \; -print)

if [ -z "$broken_links" ]; then
echo "No broken symlinks found."
else
echo "Found broken symlinks. Removing them..."
find "$PG_TBLSPC_DIR" -type l ! -exec test -e {} \; -delete
echo "Broken symlinks removed."
fi
else
echo "pg_tblspc directory not found. This is normal for a fresh database."
fi

echo "Done!"

23 changes: 23 additions & 0 deletions docker.local/postgres-entrypoint-fix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -e

# Fix broken symlinks in pg_tblspc before PostgreSQL starts
# This prevents the "chown: cannot dereference" error
if [ -d "/var/lib/postgresql/data/pg_tblspc" ]; then
echo "Checking for broken symlinks in pg_tblspc..."
find /var/lib/postgresql/data/pg_tblspc -type l ! -exec test -e {} \; -print | while read -r broken_link; do
echo "Removing broken symlink: $broken_link"
rm -f "$broken_link"
done
fi

# Ensure the tablespace directory exists if SLOW_TABLESPACE_PATH is set
if [ -n "$SLOW_TABLESPACE_PATH" ]; then
echo "Ensuring tablespace directory exists: $SLOW_TABLESPACE_PATH"
mkdir -p "$SLOW_TABLESPACE_PATH"
chown -R postgres:postgres "$SLOW_TABLESPACE_PATH" 2>/dev/null || true
fi

# Call the original PostgreSQL entrypoint
exec /usr/local/bin/docker-entrypoint.sh "$@"

22 changes: 22 additions & 0 deletions test_upload.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
This is a test file for uploading to the blobber allocation.

File Details:
- Created: 2025-01-01
- Purpose: Testing file upload functionality
- Content: Sample text for verification

Test Content:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.

This file contains:
- Basic text content
- Multiple lines
- Special characters: !@#$%^&*()
- Numbers: 1234567890
- Mixed case: Hello World

End of test file.


Loading