-
Notifications
You must be signed in to change notification settings - Fork 130
one click deploy
RiverRay edited this page Jun 19, 2023
·
3 revisions
author:gpt4
请阅读 https://github.com/ConnectAI-E/MidJourney-Web 并为我写一个bash的交互式部署脚本。
这个脚本将会检查并创建必要的文件夹,然后下载并设置 Midjourney-Web 项目。此外,它还会检查并安装必要的依赖项。
bash
#!/bin/bash
# Check if docker is installed
if ! command -v docker &> /dev/null
then
echo "Docker is not installed. Installing Docker..."
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker
echo "Docker installed successfully."
else
echo "Docker is already installed."
fi
# Check if git is installed
if ! command -v git &> /dev/null
then
echo "Git is not installed. Installing Git..."
sudo yum install -y git
echo "Git installed successfully."
else
echo "Git is already installed."
fi
# Check if Node.js is installed
if ! command -v node &> /dev/null
then
echo "Node.js is not installed. Installing Node.js..."
curl -sL https://rpm.nodesource.com/setup_18.x | sudo bash -
sudo yum install -y nodejs
echo "Node.js installed successfully."
else
echo "Node.js is already installed."
fi
# Check if pnpm is installed
if ! command -v pnpm &> /dev/null
then
echo "pnpm is not installed. Installing pnpm..."
npm install -g pnpm
echo "pnpm installed successfully."
else
echo "pnpm is already installed."
fi
# Prompt the user for environment variables
echo "Enter the Discord guild ID:"
read guild_id
echo "Enter the Discord channel ID:"
read channel_id
echo "Enter the Discord user token:"
read user_token
# Run the Docker command with the environment variables
docker run -d --name midjourney-proxy \
-p 8080:8080 \
-e mj.discord.guild-id=$guild_id \
-e mj.discord.channel-id=$channel_id \
-e mj.discord.user-token=$user_token \
--restart=always \
novicezk/midjourney-proxy:2.2.3
# Check if the project directory exists
# Replace /path/to/directory with your desired directory
dir="/path/to/directory"
if [ ! -d "$dir" ]; then
echo "Directory does not exist. Creating directory..."
mkdir -p $dir
echo "Directory created."
else
echo "Directory exists."
fi
# Change to the project directory
cd $dir
# Check if the project is downloaded
if [ ! -d "Midjourney-Web" ]; then
echo "Project not found. Downloading project..."
git clone https://github.com/ConnectAI-E/MidJourney-Web.git
echo "Project downloaded."
else
echo "Project exists."
fi
# Change to the Midjourney-Web directory
cd Midjourney-Web
# Set up and run Midjourney-Web
cp .env.example .env
pnpm install
pnpm run dev