init.sh Script Documentation
The init.sh script automates the setup process for initializing a development environment. It installs necessary dependencies, sets up Docker containers for PostgreSQL, Odoo, and Nginx, configures network settings, and initializes databases. This documentation provides a detailed explanation of each section and function within the script.
Preamble
- The preamble section includes essential settings and variable definitions.
- set -euopipefail: This line is commented out but typically enables strict error handling in bash scripts.
- IFS=$'\n\t': Sets the Internal Field Separator (IFS) to newline and tab characters to improve parsing of file names.
- Determining Script Directory: This section resolves the directory where the script resides.
- Default Directories:
- FILESTORE: Path to the file storage directory.
- EXTRAADDONS: Path to the directory for extra-addons.
Directory Structure
HOME ├── extra-addons ├── filestore ├── postgres ├── rembin └── wproxy
Checks and Installations
- Python3, Pip3, Tmux, CCZE, Perl Template Toolkit, Pass, Curl, Wget, File, Gotty, and JQ:
- These sections check for the availability of various utilities and install them if missing.
- Docker and Docker-Compose:
- Checks for Docker and Docker-Compose and installs them if not present.
User Permissions
- Disable Sudo Password Prompt:
- Adds a sudoers entry to allow the script to execute commands as root without password prompt.
- Docker Group Membership:
- Checks if the current user is a member of the Docker group and adds them if necessary.
Docker Setup
- Network Creation:
- Creates a Docker network named app_net with a specific subnet.
- Docker Image Download:
- Downloads necessary Docker images for Odoo, PostgreSQL, and Nginx.
- PostgreSQL Setup:
- Creates a Docker Compose file for PostgreSQL and starts the container.
- Odoo Database Initialization:
- Initializes databases for different Odoo versions using Docker containers.
- Web Proxy Setup:
- Creates a Docker Compose file for Nginx web proxy and starts the container.
SSH Key Configuration
- Grabs the SSH public key for a GitLab server and adds it to the known hosts file.
— Nadir Habib 2024/03/29 21:56