This project provides a comprehensive script for setting up a web server environment with Preact, Java, and PostgreSQL using Docker.
- Features
- Prerequisites
- Installation
- Usage
- Directory Structure
- User Management
- Backup
- Tunnel Configuration
- Docker Utilities
- Security Notice
- π³ 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
- A Debian-based Linux system (e.g., Ubuntu)
- Root access to the server
- Internet connection for package installation
-
Clone the repository:
git clone https://github.com/yourusername/web-server-config.git cd web-server-config
-
Make the script executable:
chmod +x setup_script.sh
-
Run the script with root privileges:
sudo ./setup_script.sh
The script will automatically:
- Install necessary dependencies
- Create users and groups
- Set up directory structure and permissions
- Configure the firewall
- Set up automated backups
- Start the web server using Docker Compose
After running the script, your server will be set up and running.
/var/www/frontend
: Frontend files (Preact)/var/www/backend
: Backend files (Java)/var/db
: Database files/backupdb
: Database backups
The script creates the following users:
frontend
: For frontend developmentbackend
: For backend developmentdbadmin
: For database administrationsysadmin
: For system administration
Important: Change the default passwords after setup!
Database backups are automated using cron, occurring every minute. Backups are stored in /backupdb
.
To set up a Packetriot tunnel for remote access:
- Register at https://packetriot.com/
- Activate a domain and create a CNAME record pointing to your tunnel server
- 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
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
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
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.