v.04
This commit is contained in:
@@ -1,5 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Installing dependencies
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install ca-certificates curl
|
||||
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
||||
|
||||
# Add the repository to Apt sources:
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
|
||||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
|
||||
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
echo "installing node"
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash &&
|
||||
source ~/.bashrc &&
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
nvm install Iron &&
|
||||
npm i -g localtunnel &&
|
||||
|
||||
# Add user to the docker group and apply permissions
|
||||
sudo groupadd docker
|
||||
sudo usermod -aG docker $USER
|
||||
newgrp docker
|
||||
|
||||
# Set script variables
|
||||
PROJECT_DIR="GUI"
|
||||
PORT=3005
|
||||
@@ -7,27 +42,21 @@ TUNNEL_SERVICE="lt"
|
||||
|
||||
# Change to the project directory
|
||||
cd "$PROJECT_DIR" || exit
|
||||
|
||||
npm i &&
|
||||
|
||||
# Build and start the Next.js app
|
||||
echo "installing Dependencies"
|
||||
|
||||
echo "Building and starting Next.js app..."
|
||||
npx next build &&
|
||||
echo "Builing Web App = True"
|
||||
sleep 3
|
||||
npx next start -p "$PORT" > /dev/null 2>&1 &
|
||||
npx next start -p "$PORT" &
|
||||
|
||||
# Wait for the Next.js app to start
|
||||
echo "Waiting for Next.js app to start on port $PORT..."
|
||||
until nc -z localhost "$PORT"; do
|
||||
sleep 1
|
||||
echo "Loding ..."
|
||||
done
|
||||
|
||||
# Install the tunnel service if not installed
|
||||
|
||||
|
||||
|
||||
sleep 3
|
||||
echo "Exposing local port $PORT using $TUNNEL_SERVICE..."
|
||||
lt --port "$PORT" > /tmp/lt.log 2>&1 &
|
||||
|
||||
@@ -37,9 +66,10 @@ sleep 5
|
||||
|
||||
# Get the tunnel URL from the log file
|
||||
TUNNEL_URL=$(grep -o 'https://[^[:blank:]]*' /tmp/lt.log)
|
||||
|
||||
#Get the tunnel password
|
||||
echo "Getting Tunnel Password"
|
||||
TUNNEL_PASSWORD=$(curl https://loca.lt/mytunnelpassword)&&
|
||||
TUNNEL_PASSWORD=$(curl https://loca.lt/mytunnelpassword) &&
|
||||
|
||||
# Print the tunnel URL and password
|
||||
echo "---------------------------------------"
|
||||
|
||||
Reference in New Issue
Block a user