Update deployment script to use root directory
This commit is contained in:
parent
5fbce08f96
commit
3967ee3304
22
deploy.sh
22
deploy.sh
@ -10,12 +10,12 @@ echo -e "${BLUE}=== Setting up Postaci on Ubuntu Server ===${NC}"
|
|||||||
|
|
||||||
# Update system
|
# Update system
|
||||||
echo -e "${YELLOW}Updating system packages...${NC}"
|
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
|
# Install Node.js, npm, and other dependencies
|
||||||
echo -e "${YELLOW}Installing Node.js and dependencies...${NC}"
|
echo -e "${YELLOW}Installing Node.js and dependencies...${NC}"
|
||||||
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
|
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
|
||||||
sudo apt install -y nodejs postgresql postgresql-contrib nginx git
|
apt install -y nodejs postgresql postgresql-contrib nginx git
|
||||||
|
|
||||||
# Check Node.js and npm versions
|
# Check Node.js and npm versions
|
||||||
echo -e "${GREEN}Installed Node.js version:${NC}"
|
echo -e "${GREEN}Installed Node.js version:${NC}"
|
||||||
@ -25,8 +25,8 @@ npm -v
|
|||||||
|
|
||||||
# Start and enable PostgreSQL
|
# Start and enable PostgreSQL
|
||||||
echo -e "${YELLOW}Setting up PostgreSQL...${NC}"
|
echo -e "${YELLOW}Setting up PostgreSQL...${NC}"
|
||||||
sudo systemctl start postgresql
|
systemctl start postgresql
|
||||||
sudo systemctl enable postgresql
|
systemctl enable postgresql
|
||||||
|
|
||||||
# Create PostgreSQL user and database
|
# Create PostgreSQL user and database
|
||||||
echo -e "${YELLOW}Creating PostgreSQL user and database...${NC}"
|
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
|
# Clone the repository
|
||||||
echo -e "${YELLOW}Cloning repository...${NC}"
|
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
|
# Set up the application
|
||||||
echo -e "${YELLOW}Setting up the application...${NC}"
|
echo -e "${YELLOW}Setting up the application...${NC}"
|
||||||
cd /home/ubuntu/postaci
|
cd /root/postaci
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
echo -e "${YELLOW}Installing npm dependencies...${NC}"
|
echo -e "${YELLOW}Installing npm dependencies...${NC}"
|
||||||
@ -79,8 +79,8 @@ After=network.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=ubuntu
|
User=root
|
||||||
WorkingDirectory=/home/ubuntu/postaci/validation-service
|
WorkingDirectory=/root/postaci/validation-service
|
||||||
ExecStart=/usr/bin/node server.js
|
ExecStart=/usr/bin/node server.js
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
Environment=NODE_ENV=production
|
Environment=NODE_ENV=production
|
||||||
@ -98,8 +98,8 @@ After=network.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=ubuntu
|
User=root
|
||||||
WorkingDirectory=/home/ubuntu/postaci
|
WorkingDirectory=/root/postaci
|
||||||
ExecStart=/usr/bin/npm start
|
ExecStart=/usr/bin/npm start
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
Environment=NODE_ENV=production
|
Environment=NODE_ENV=production
|
||||||
|
Loading…
x
Reference in New Issue
Block a user