-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·197 lines (166 loc) · 4.55 KB
/
setup.sh
File metadata and controls
executable file
·197 lines (166 loc) · 4.55 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
# GYPEX Odoo v19 Setup Script
# Run this script to set up the complete Odoo environment
set -e # Exit on error
echo "=========================================="
echo "GYPEX Odoo v19 Setup Script"
echo "=========================================="
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if running as root
if [ "$EUID" -eq 0 ]; then
echo -e "${RED}Please do not run this script as root${NC}"
exit 1
fi
PROJECT_DIR="/home/user/Documents/Odoo"
cd "$PROJECT_DIR"
echo -e "${GREEN}Step 1: Installing system packages...${NC}"
sudo apt update
sudo apt install -y \
python3 \
python3-pip \
python3-dev \
python3-venv \
build-essential \
libxml2-dev \
libxslt1-dev \
libevent-dev \
libsasl2-dev \
libldap2-dev \
libpq-dev \
libjpeg-dev \
zlib1g-dev \
libfreetype6-dev \
liblcms2-dev \
libwebp-dev \
libharfbuzz-dev \
libfribidi-dev \
libxcb1-dev \
git \
curl \
wget \
nodejs \
npm \
postgresql \
postgresql-contrib
echo -e "${GREEN}Step 2: Setting up PostgreSQL...${NC}"
sudo systemctl start postgresql
sudo systemctl enable postgresql
# Create Odoo database user if it doesn't exist
sudo -u postgres psql -c "CREATE USER odoo WITH CREATEDB PASSWORD 'odoo';" 2>/dev/null || \
echo "User 'odoo' already exists"
sudo -u postgres psql -c "ALTER USER odoo WITH SUPERUSER;" 2>/dev/null || true
echo -e "${GREEN}Step 3: Installing wkhtmltopdf...${NC}"
if ! command -v wkhtmltopdf &> /dev/null; then
wget -q https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb -O /tmp/wkhtmltox.deb
sudo apt install -y /tmp/wkhtmltox.deb
rm /tmp/wkhtmltox.deb
else
echo "wkhtmltopdf already installed"
fi
echo -e "${GREEN}Step 4: Cloning Odoo v19...${NC}"
if [ ! -d "odoo-19" ]; then
git clone --branch 19.0 --depth 1 https://github.com/odoo/odoo.git odoo-19
else
echo "Odoo directory already exists, skipping clone"
fi
echo -e "${GREEN}Step 5: Creating Python virtual environment...${NC}"
if [ ! -d "odoo-venv" ]; then
python3 -m venv odoo-venv
fi
source odoo-venv/bin/activate
pip install --upgrade pip
echo -e "${GREEN}Step 6: Installing Python dependencies...${NC}"
cd odoo-19
# Fix gevent compatibility issue with Python 3.10+
echo "Installing dependencies (fixing gevent compatibility)..."
pip install --upgrade pip setuptools wheel Cython
# Try to install gevent with compatible version, skip if it fails
pip install "gevent>=22.0.0" 2>/dev/null || {
echo "Note: gevent installation skipped (optional dependency)"
}
# Install other requirements, excluding problematic gevent version
if grep -q "^gevent==" requirements.txt; then
# Create temp requirements without old gevent
grep -v "^gevent==" requirements.txt > /tmp/requirements_fixed.txt
pip install -r /tmp/requirements_fixed.txt
else
pip install -r requirements.txt
fi
cd ..
echo -e "${GREEN}Step 7: Creating directory structure...${NC}"
mkdir -p custom-addons
mkdir -p logs
mkdir -p data
mkdir -p backups
mkdir -p config
echo -e "${GREEN}Step 8: Creating Odoo configuration file...${NC}"
cat > config/odoo.conf << 'EOF'
[options]
; Database
admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = odoo
db_password = odoo
db_maxconn = 64
; Server
http_port = 8069
http_interface = 127.0.0.1
; Logging
logfile = /home/user/Documents/Odoo/logs/odoo.log
log_level = info
; Addons
addons_path = /home/user/Documents/Odoo/odoo-19/addons,/home/user/Documents/Odoo/custom-addons
; Data
data_dir = /home/user/Documents/Odoo/data
; Language
translate_modules = ['all']
EOF
echo -e "${GREEN}Step 9: Setting up Git repository...${NC}"
if [ ! -d ".git" ]; then
git init
cat > .gitignore << 'GITIGNORE'
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
odoo-venv/
*.egg-info/
dist/
build/
# Odoo
*.log
data/
backups/
*.db
*.sql
# IDE
.vscode/
.idea/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db
GITIGNORE
git add .gitignore PROJECT_ANALYSIS.md SETUP_GUIDE.md ODOO_BASICS.md ROADMAP.md
git commit -m "Initial project setup and documentation"
fi
echo ""
echo -e "${GREEN}=========================================="
echo "Setup Complete!"
echo "==========================================${NC}"
echo ""
echo "Next steps:"
echo "1. Activate virtual environment: source odoo-venv/bin/activate"
echo "2. Start Odoo: cd odoo-19 && python3 odoo-bin -c ../config/odoo.conf"
echo "3. Open browser: http://localhost:8069"
echo ""
echo -e "${YELLOW}Note: Default admin password is 'admin'${NC}"
echo ""