Update deployment script to use root directory

This commit is contained in:
m3mo 2025-04-21 02:22:13 +02:00
parent 5fbce08f96
commit 3967ee3304

View File

@ -10,12 +10,12 @@ echo -e "${BLUE}=== Setting up Postaci on Ubuntu Server ===${NC}"
# Update system
echo -e "${YELLOW}Updating system packages...${NC}"
sudo apt update && sudo apt upgrade -y
apt update && apt upgrade -y
# Install Node.js, npm, and other dependencies
echo -e "${YELLOW}Installing Node.js and dependencies...${NC}"
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs postgresql postgresql-contrib nginx git
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt install -y nodejs postgresql postgresql-contrib nginx git
# Check Node.js and npm versions
echo -e "${GREEN}Installed Node.js version:${NC}"
@ -25,8 +25,8 @@ npm -v
# Start and enable PostgreSQL
echo -e "${YELLOW}Setting up PostgreSQL...${NC}"
sudo systemctl start postgresql
sudo systemctl enable postgresql
systemctl start postgresql
systemctl enable postgresql
# Create PostgreSQL user and database
echo -e "${YELLOW}Creating PostgreSQL user and database...${NC}"
@ -36,11 +36,11 @@ sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE postaci TO postaci;"
# Clone the repository
echo -e "${YELLOW}Cloning repository...${NC}"
git clone https://gitea.oezdag.io/m3mo/POSTERAPP_V1.git /home/ubuntu/postaci
git clone https://gitea.oezdag.io/m3mo/POSTERAPP_V1.git /root/postaci
# Set up the application
echo -e "${YELLOW}Setting up the application...${NC}"
cd /home/ubuntu/postaci
cd /root/postaci
# Install dependencies
echo -e "${YELLOW}Installing npm dependencies...${NC}"
@ -79,8 +79,8 @@ After=network.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/postaci/validation-service
User=root
WorkingDirectory=/root/postaci/validation-service
ExecStart=/usr/bin/node server.js
Restart=on-failure
Environment=NODE_ENV=production
@ -98,8 +98,8 @@ After=network.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/postaci
User=root
WorkingDirectory=/root/postaci
ExecStart=/usr/bin/npm start
Restart=on-failure
Environment=NODE_ENV=production