forked from arthur-ai/arthur-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
100 lines (81 loc) · 3.63 KB
/
Copy pathVagrantfile
File metadata and controls
100 lines (81 loc) · 3.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Use Ubuntu 22.04 LTS as the base box
config.vm.box = "ubuntu/jammy64"
# Configure the VM
config.vm.hostname = "arthur-engine-dev"
# Allocate more resources for development
config.vm.provider "virtualbox" do |vb|
vb.memory = "8192"
vb.cpus = 2
vb.name = "arthur-engine-dev"
end
# Port forwarding for GenAI Engine services
# Main GenAI Engine server
config.vm.network "forwarded_port", guest: 8435, host: 8435, id: "genai-engine"
config.vm.network "forwarded_port", guest: 3030, host: 3030, id: "genai-engine"
# PostgreSQL database
config.vm.network "forwarded_port", guest: 5432, host: 5432, id: "postgres"
# Optional: Adminer for database management (uncomment if needed)
# config.vm.network "forwarded_port", guest: 8080, host: 8080, id: "adminer"
# Sync the current directory to /vagrant in the VM
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
# Provision the VM with necessary dependencies
config.vm.provision "shell", inline: <<-SHELL
# Update package list
apt-get update
# Install essential packages
apt-get install -y \
curl \
wget \
git \
build-essential \
software-properties-common \
apt-transport-https \
ca-certificates \
gnupg \
lsb-release
# Install Docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
# Add vagrant user to docker group
usermod -aG docker vagrant
# Install Docker Compose (standalone)
curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# Install Node.js (for UI development)
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
# Install Python 3.12 and pip
add-apt-repository -y ppa:deadsnakes/ppa
apt-get update
apt-get install -y python3.12 python3.12-venv python3.12-dev python3-pip
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> /home/vagrant/.bashrc
# Create a symlink for easier access
ln -sf /vagrant /home/vagrant/arthur-engine
# Set up environment
echo "cd /vagrant" >> /home/vagrant/.bashrc
echo "echo 'Welcome to Arthur Engine Development Environment!'" >> /home/vagrant/.bashrc
echo "echo 'Repository is mounted at /vagrant'" >> /home/vagrant/.bashrc
echo "echo 'GenAI Engine will be available at http://localhost:8435'" >> /home/vagrant/.bashrc
echo "echo 'PostgreSQL will be available at localhost:5432'" >> /home/vagrant/.bashrc
echo "echo ''" >> /home/vagrant/.bashrc
echo "echo 'To start the development environment:'" >> /home/vagrant/.bashrc
echo "echo ' cd genai-engine'" >> /home/vagrant/.bashrc
echo "echo ' docker-compose up'" >> /home/vagrant/.bashrc
echo "echo ''" >> /home/vagrant/.bashrc
# Clean up
apt-get autoremove -y
apt-get clean
SHELL
# Configure the VM to use the synced folder as the working directory
config.vm.provision "shell", inline: <<-SHELL
# Make sure the vagrant user owns the synced folder
chown -R vagrant:vagrant /vagrant
SHELL
end