Fix deployment script issues (#1)
- Fix Go installation by extracting to /tmp first then moving to final destination - Return to original directory after Go installation - Add attempt to install secp256k1 from package manager before building from source - Add missing automake package for autoreconf - Fix binary build by running go build after embedded web update Co-authored-by: mleku <me@mleku.dev> Reviewed-on: https://git.nostrdev.com/mleku/next.orly.dev/pulls/1 Co-authored-by: daniyal <daniyal@nostrdev.com> Co-committed-by: daniyal <daniyal@nostrdev.com>
This commit is contained in:
@@ -71,6 +71,9 @@ check_go_installation() {
|
|||||||
install_go() {
|
install_go() {
|
||||||
log_info "Installing Go $GO_VERSION..."
|
log_info "Installing Go $GO_VERSION..."
|
||||||
|
|
||||||
|
# Save original directory
|
||||||
|
local original_dir=$(pwd)
|
||||||
|
|
||||||
# Determine architecture
|
# Determine architecture
|
||||||
local arch=$(uname -m)
|
local arch=$(uname -m)
|
||||||
case $arch in
|
case $arch in
|
||||||
@@ -100,13 +103,17 @@ install_go() {
|
|||||||
rm -rf "$GOROOT"
|
rm -rf "$GOROOT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract Go
|
# Extract Go to a temporary location first, then move to final destination
|
||||||
log_info "Extracting Go to $GOROOT..."
|
log_info "Extracting Go..."
|
||||||
tar -xf "$go_archive"
|
tar -xf "$go_archive" -C /tmp
|
||||||
|
mv /tmp/go "$GOROOT"
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f "$go_archive"
|
rm -f "$go_archive"
|
||||||
|
|
||||||
|
# Return to original directory
|
||||||
|
cd "$original_dir"
|
||||||
|
|
||||||
log_success "Go $GO_VERSION installed successfully"
|
log_success "Go $GO_VERSION installed successfully"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +174,10 @@ build_application() {
|
|||||||
log_info "Updating embedded web assets..."
|
log_info "Updating embedded web assets..."
|
||||||
./scripts/update-embedded-web.sh
|
./scripts/update-embedded-web.sh
|
||||||
|
|
||||||
# The update-embedded-web.sh script should have built the binary
|
# Build the binary in the current directory
|
||||||
|
log_info "Building binary in current directory..."
|
||||||
|
CGO_ENABLED=1 go build -o "$BINARY_NAME"
|
||||||
|
|
||||||
if [[ -f "./$BINARY_NAME" ]]; then
|
if [[ -f "./$BINARY_NAME" ]]; then
|
||||||
log_success "ORLY relay built successfully"
|
log_success "ORLY relay built successfully"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,14 +1,40 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
apt -y install build-essential autoconf libtool git wget
|
|
||||||
cd $SCRIPT_DIR
|
# Update package lists
|
||||||
|
apt-get update
|
||||||
|
|
||||||
|
# Try to install from package manager first (much faster)
|
||||||
|
echo "Attempting to install secp256k1 from package manager..."
|
||||||
|
if apt-get install -y libsecp256k1-dev >/dev/null 2>&1; then
|
||||||
|
echo "✓ Installed secp256k1 from package manager"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fall back to building from source if package not available
|
||||||
|
echo "Package not available in repository, building from source..."
|
||||||
|
|
||||||
|
# Install build dependencies
|
||||||
|
apt-get install -y build-essential autoconf automake libtool git wget pkg-config
|
||||||
|
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
rm -rf secp256k1
|
rm -rf secp256k1
|
||||||
|
|
||||||
|
# Clone and setup secp256k1
|
||||||
git clone https://github.com/bitcoin-core/secp256k1.git
|
git clone https://github.com/bitcoin-core/secp256k1.git
|
||||||
cd secp256k1
|
cd secp256k1
|
||||||
git checkout v0.6.0
|
git checkout v0.6.0
|
||||||
|
|
||||||
|
# Initialize and update submodules
|
||||||
git submodule init
|
git submodule init
|
||||||
git submodule update
|
git submodule update
|
||||||
|
|
||||||
|
# Build and install
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
./configure --enable-module-schnorrsig --enable-module-ecdh --prefix=/usr
|
./configure --enable-module-schnorrsig --enable-module-ecdh --prefix=/usr
|
||||||
make -j1
|
make -j$(nproc)
|
||||||
sudo make install
|
make install
|
||||||
|
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
|||||||
Reference in New Issue
Block a user