Skip to content

πŸ’» This project provides a comprehensive script for setting up a web server environment with Preact, Java, and PostgreSQL using Docker

Notifications You must be signed in to change notification settings

fordus/docker-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ–₯️ Web Server Configuration Script

This project provides a comprehensive script for setting up a web server environment with Preact, Java, and PostgreSQL using Docker.

πŸ“‹ Table of Contents

✨ Features

  • 🐳 Docker and Docker Compose setup
  • 🌐 Preact frontend and Java backend configuration
  • 🐘 PostgreSQL database setup
  • πŸ‘₯ User and group management
  • πŸ”’ Basic firewall configuration
  • πŸ”„ Automated database backups
  • πŸš‡ Packetriot tunnel support for remote access

🧰 Prerequisites

  • A Debian-based Linux system (e.g., Ubuntu)
  • Root access to the server
  • Internet connection for package installation

πŸš€ Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/web-server-config.git
    cd web-server-config
  2. Make the script executable:

    chmod +x setup_script.sh
  3. Run the script with root privileges:

    sudo ./setup_script.sh

πŸ–₯️ Usage

The script will automatically:

  1. Install necessary dependencies
  2. Create users and groups
  3. Set up directory structure and permissions
  4. Configure the firewall
  5. Set up automated backups
  6. Start the web server using Docker Compose

After running the script, your server will be set up and running.

πŸ“‚ Directory Structure

  • /var/www/frontend: Frontend files (Preact)
  • /var/www/backend: Backend files (Java)
  • /var/db: Database files
  • /backupdb: Database backups

πŸ‘₯ User Management

The script creates the following users:

  • frontend: For frontend development
  • backend: For backend development
  • dbadmin: For database administration
  • sysadmin: For system administration

Important: Change the default passwords after setup!

πŸ’Ύ Backup

Database backups are automated using cron, occurring every minute. Backups are stored in /backupdb.

πŸš‡ Tunnel Configuration

To set up a Packetriot tunnel for remote access:

  1. Register at https://packetriot.com/
  2. Activate a domain and create a CNAME record pointing to your tunnel server
  3. Run:
    docker exec -it tunnel pktriot configure
    docker exec -it tunnel pktriot tunnel http add --domain [custom-domain] --destination frontend --http 80
    docker restart tunnel

🐳 Docker Utilities

To clean up your Docker environment:

docker rm -f $(docker ps -aq) 
sudo docker rmi -f $(docker images -aq)
docker-compose up --build --force-recreate -d

πŸ” Security Notice

This script sets up a basic configuration. For production use, consider:

  • Changing default passwords
  • Implementing more stringent firewall rules
  • Setting up SSL/TLS certificates
  • Regularly updating and patching the system

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is open source and available under the MIT License.

About

πŸ’» This project provides a comprehensive script for setting up a web server environment with Preact, Java, and PostgreSQL using Docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published