fix directory creation issue
This commit is contained in:
@@ -81,29 +81,38 @@ sudo apt update && sudo apt upgrade -y
|
||||
# Install required packages
|
||||
sudo apt install -y python3 python3-pip python3-venv nginx certbot python3-certbot-nginx git
|
||||
|
||||
# Create a non-root user for the application (recommended)
|
||||
sudo adduser --system --group --home /opt/faction-war factionwar
|
||||
# Create a service user for the application (no password by default)
|
||||
sudo adduser --disabled-password --gecos "" --home /opt/faction-war factionwar
|
||||
|
||||
# Optional: Set a password if you need to log in as this user
|
||||
# sudo passwd factionwar
|
||||
```
|
||||
|
||||
### 2. Clone and Setup Application
|
||||
|
||||
```bash
|
||||
# Switch to the application user
|
||||
sudo su - factionwar
|
||||
|
||||
# Clone the repository (or upload files via SCP/SFTP)
|
||||
# Create application directory
|
||||
sudo mkdir -p /opt/faction-war
|
||||
cd /opt/faction-war
|
||||
git clone <your-repo-url> app
|
||||
|
||||
# Clone the repository
|
||||
sudo git clone https://git.jerick.xyz/jerick/faction_war_dispatch_bot.git app
|
||||
|
||||
# Set ownership to the service user
|
||||
sudo chown -R factionwar:factionwar app
|
||||
|
||||
# Work as the application user
|
||||
cd app
|
||||
sudo -u factionwar python3 -m venv venv
|
||||
|
||||
# Create Python virtual environment
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
|
||||
# Install dependencies
|
||||
pip install -r requirements.txt
|
||||
# Install dependencies as the application user
|
||||
sudo -u factionwar venv/bin/pip install -r requirements.txt
|
||||
```
|
||||
|
||||
**Note**: The `factionwar` user is created without a password. To work as this user:
|
||||
- Use: `sudo -u factionwar bash`
|
||||
- Or set a password: `sudo passwd factionwar` and then: `sudo su - factionwar`
|
||||
|
||||
### 3. Configure Environment Variables
|
||||
|
||||
```bash
|
||||
@@ -557,37 +566,43 @@ pip install redis
|
||||
|
||||
```bash
|
||||
# 1. Server setup
|
||||
sudo apt update && sudo apt install -y python3 python3-venv nginx certbot python3-certbot-nginx
|
||||
sudo apt update && sudo apt install -y python3 python3-venv nginx certbot python3-certbot-nginx git
|
||||
|
||||
# 2. Clone and install
|
||||
cd /opt && sudo mkdir faction-war && cd faction-war
|
||||
git clone <repo> app && cd app
|
||||
python3 -m venv venv && source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
# 2. Create user and clone repository
|
||||
sudo adduser --disabled-password --gecos "" --home /opt/faction-war factionwar
|
||||
sudo mkdir -p /opt/faction-war
|
||||
cd /opt/faction-war
|
||||
sudo git clone https://git.jerick.xyz/jerick/faction_war_dispatch_bot.git app
|
||||
sudo chown -R factionwar:factionwar app
|
||||
cd app
|
||||
|
||||
# 3. Configure
|
||||
cp .env.example .env
|
||||
nano .env # Set your secrets and API keys
|
||||
# 3. Install dependencies
|
||||
sudo -u factionwar python3 -m venv venv
|
||||
sudo -u factionwar venv/bin/pip install -r requirements.txt
|
||||
|
||||
# 4. Setup SSL
|
||||
# 4. Configure
|
||||
sudo -u factionwar cp .env.example .env
|
||||
sudo -u factionwar nano .env # Set your secrets and API keys
|
||||
|
||||
# 5. Setup SSL
|
||||
sudo certbot --nginx -d yourdomain.com
|
||||
|
||||
# 5. Configure Nginx (use config from above)
|
||||
# 6. Configure Nginx (use config from above)
|
||||
sudo nano /etc/nginx/sites-available/faction-war
|
||||
sudo ln -s /etc/nginx/sites-available/faction-war /etc/nginx/sites-enabled/
|
||||
sudo nginx -t && sudo systemctl reload nginx
|
||||
|
||||
# 6. Setup systemd service (use config from above)
|
||||
# 7. Setup systemd service (use config from above)
|
||||
sudo nano /etc/systemd/system/faction-war.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable faction-war
|
||||
sudo systemctl start faction-war
|
||||
|
||||
# 7. Configure firewall
|
||||
# 8. Configure firewall
|
||||
sudo ufw allow ssh && sudo ufw allow 80/tcp && sudo ufw allow 443/tcp
|
||||
sudo ufw enable
|
||||
|
||||
# 8. Done! Visit https://yourdomain.com
|
||||
# 9. Done! Visit https://yourdomain.com
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user