-
Notifications
You must be signed in to change notification settings - Fork 16
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
6 changed files
with
374 additions
and
6 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,116 @@ | ||
name: MOR Agents Build Linux | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install pyinstaller | ||
- name: Build with PyInstaller | ||
run: | | ||
pyinstaller --name="MORagents" --add-data "images/moragents.png:images" main.py | ||
- name: Create Debian package | ||
run: | | ||
mkdir -p debian/DEBIAN | ||
mkdir -p debian/usr/bin | ||
mkdir -p debian/usr/share/applications | ||
mkdir -p debian/usr/share/icons/hicolor/256x256/apps | ||
cp -r dist/MORagents/* debian/usr/bin/ | ||
cp images/moragents.png debian/usr/share/icons/hicolor/256x256/apps/moragents.png | ||
echo "[Desktop Entry] | ||
Name=MORagents | ||
Exec=/usr/bin/MORagents | ||
Icon=moragents | ||
Type=Application | ||
Categories=Utility;" > debian/usr/share/applications/moragents.desktop | ||
echo "Package: moragents | ||
Version: 1.0 | ||
Section: utils | ||
Priority: optional | ||
Architecture: amd64 | ||
Maintainer: LachsBagel | ||
Description: MORagents application | ||
MORagents is a desktop application for AI agents." > debian/DEBIAN/control | ||
dpkg-deb --build debian moragents.deb | ||
- name: Create setup script | ||
run: | | ||
cat << EOF > moragents-setup.sh | ||
#!/bin/bash | ||
set -e | ||
# Colors for output | ||
GREEN='\033[0;32m' | ||
YELLOW='\033[0;33m' | ||
NC='\033[0m' # No Color | ||
# Function to check if a command exists | ||
command_exists() { | ||
command -v "$1" >/dev/null 2>&1 | ||
} | ||
# Install curl if not present | ||
if ! command_exists curl; then | ||
echo -e "${YELLOW}Installing curl...${NC}" | ||
sudo apt-get update | ||
sudo apt-get install -y curl | ||
fi | ||
# Install Docker if not present | ||
if ! command_exists docker; then | ||
echo -e "${YELLOW}Installing Docker...${NC}" | ||
curl -fsSL https://get.docker.com -o get-docker.sh | ||
sudo sh get-docker.sh | ||
sudo usermod -aG docker $USER | ||
sudo systemctl enable docker | ||
sudo systemctl start docker | ||
else | ||
echo -e "${GREEN}Docker is already installed.${NC}" | ||
fi | ||
# Pull necessary Docker images | ||
echo -e "${YELLOW}Pulling Docker images...${NC}" | ||
sudo docker pull morpheusai/nginx-agent:latest | ||
sudo docker pull morpheusai/agents:latest | ||
# Start Docker containers | ||
echo -e "${YELLOW}Starting Docker containers...${NC}" | ||
sudo docker run -d --name agents -p 8080:5000 --restart always -v /var/lib/agents -v /app/src morpheusai/agents:latest | ||
sudo docker run -d --name nginx -p 3333:80 morpheusai/nginx-agent:latest | ||
echo -e "${GREEN}Setup complete!${NC}" | ||
echo -e "${YELLOW}NOTE: Please log out and log back in for Docker group changes to take effect.${NC}" | ||
EOF | ||
chmod +x moragents-setup.sh | ||
- name: Upload Debian Package and Setup Script | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: MORagentsSetup-Linux | ||
path: | | ||
moragents.deb | ||
moragents-setup.sh |
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,80 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Colors for output | ||
GREEN='\033[0;32m' | ||
YELLOW='\033[0;33m' | ||
RED='\033[0;31m' | ||
NC='\033[0m' # No Color | ||
|
||
# Function to check if a command exists | ||
command_exists() { | ||
command -v "$1" >/dev/null 2>&1 | ||
} | ||
|
||
# Function to get the current user | ||
get_current_user() { | ||
if [ -n "$SUDO_USER" ]; then | ||
echo "$SUDO_USER" | ||
elif [ -n "$USER" ]; then | ||
echo "$USER" | ||
else | ||
echo $(whoami) | ||
fi | ||
} | ||
|
||
# Install curl if not present | ||
if ! command_exists curl; then | ||
echo -e "${YELLOW}Installing curl...${NC}" | ||
sudo apt-get update | ||
sudo apt-get install -y curl | ||
fi | ||
|
||
# Check Docker installation | ||
if command_exists docker; then | ||
echo -e "${GREEN}Docker is already installed.${NC}" | ||
else | ||
echo -e "${YELLOW}Installing Docker...${NC}" | ||
curl -fsSL https://get.docker.com -o get-docker.sh | ||
sudo sh get-docker.sh | ||
echo -e "${GREEN}Docker installed successfully.${NC}" | ||
fi | ||
|
||
# Ensure current user is in docker group | ||
CURRENT_USER=$(get_current_user) | ||
if [ -n "$CURRENT_USER" ]; then | ||
if groups "$CURRENT_USER" | grep -q '\bdocker\b'; then | ||
echo -e "${GREEN}User $CURRENT_USER is already in the docker group.${NC}" | ||
else | ||
echo -e "${YELLOW}Adding user $CURRENT_USER to the docker group...${NC}" | ||
sudo usermod -aG docker "$CURRENT_USER" | ||
echo -e "${GREEN}User $CURRENT_USER added to docker group. You may need to log out and back in for this to take effect.${NC}" | ||
fi | ||
else | ||
echo -e "${RED}Warning: Couldn't determine current user. You may need to manually add your user to the docker group.${NC}" | ||
fi | ||
|
||
# Ensure Docker service is running | ||
if ! systemctl is-active --quiet docker; then | ||
echo -e "${YELLOW}Starting Docker service...${NC}" | ||
sudo systemctl start docker | ||
fi | ||
|
||
# Pull necessary Docker images | ||
echo -e "${YELLOW}Pulling Docker images...${NC}" | ||
sudo docker pull morpheusai/nginx-agent:latest | ||
sudo docker pull morpheusai/agents:latest | ||
|
||
# Stop and remove existing containers if they exist | ||
echo -e "${YELLOW}Stopping and removing existing containers if present...${NC}" | ||
sudo docker stop agents nginx 2>/dev/null || true | ||
sudo docker rm agents nginx 2>/dev/null || true | ||
|
||
# Start Docker containers | ||
echo -e "${YELLOW}Starting Docker containers...${NC}" | ||
sudo docker run -d --name agents -p 8080:5000 --restart always -v /var/lib/agents:/var/lib/agents -v /app/src:/app/src morpheusai/agents:latest | ||
sudo docker run -d --name nginx -p 3333:80 morpheusai/nginx-agent:latest | ||
|
||
echo -e "${GREEN}Setup complete!${NC}" | ||
echo -e "${YELLOW}NOTE: If you were added to the docker group, please log out and log back in for the changes to take effect.${NC}" | ||
echo -e "${YELLOW}After logging back in, you can run Docker commands without sudo.${NC}" |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.