-
Notifications
You must be signed in to change notification settings - Fork 89
/
run.sh
49 lines (41 loc) · 1.52 KB
/
run.sh
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
#!/bin/bash
DESTINATION=$1
PORT=$2
CHAT=$3
# Clone Odoo directory
git clone --depth=1 https://github.com/minhng92/odoo-13-docker-compose $DESTINATION
rm -rf $DESTINATION/.git
# Create PostgreSQL directory
mkdir -p $DESTINATION/postgresql
# Change ownership to current user and set restrictive permissions for security
sudo chown -R $USER:$USER $DESTINATION
sudo chmod -R 700 $DESTINATION # Only the user has access
# Check if running on macOS
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Running on macOS. Skipping inotify configuration."
else
# System configuration
if grep -qF "fs.inotify.max_user_watches" /etc/sysctl.conf; then
echo $(grep -F "fs.inotify.max_user_watches" /etc/sysctl.conf)
else
echo "fs.inotify.max_user_watches = 524288" | sudo tee -a /etc/sysctl.conf
fi
sudo sysctl -p
fi
# Set ports in docker-compose.yml
# Update docker-compose configuration
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS sed syntax
sed -i '' 's/10013/'$PORT'/g' $DESTINATION/docker-compose.yml
sed -i '' 's/20013/'$CHAT'/g' $DESTINATION/docker-compose.yml
else
# Linux sed syntax
sed -i 's/10013/'$PORT'/g' $DESTINATION/docker-compose.yml
sed -i 's/20013/'$CHAT'/g' $DESTINATION/docker-compose.yml
fi
# Set file and directory permissions after installation
find $DESTINATION -type f -exec chmod 644 {} \;
find $DESTINATION -type d -exec chmod 755 {} \;
# Run Odoo
docker-compose -f $DESTINATION/docker-compose.yml up -d
echo "Odoo started at http://localhost:$PORT | Master Password: minhng.info | Live chat port: $CHAT"