https://github.com/luis122448/smart-shell-bash
Este repositorio tiene como objetivo documentar, estandarizar y automatizar el despliegue del proyecto Smart-Shell ( Facturador Electronico ), integrado por cinco repositorios independientes en un mismo servidor.
https://github.com/luis122448/smart-shell-bash
bash bash-scripting cerbot nginx nginx-proxy ssh-key
Last synced: 3 months ago
JSON representation
Este repositorio tiene como objetivo documentar, estandarizar y automatizar el despliegue del proyecto Smart-Shell ( Facturador Electronico ), integrado por cinco repositorios independientes en un mismo servidor.
- Host: GitHub
- URL: https://github.com/luis122448/smart-shell-bash
- Owner: luis122448
- License: other
- Created: 2023-12-04T02:14:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-09-15T05:12:09.000Z (9 months ago)
- Last Synced: 2025-09-15T05:43:26.768Z (9 months ago)
- Topics: bash, bash-scripting, cerbot, nginx, nginx-proxy, ssh-key
- Language: Shell
- Homepage: https://smart-shell.luis122448.com/
- Size: 101 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README

# Smart Shell - Deployment Automation
This repository provides a collection of scripts and configurations to automate the deployment of the Smart-Shell project. It offers multiple deployment strategies, including a script-based approach for local development, a Docker Compose setup for single-server deployments, and Kubernetes manifests for scalable environments.
The automation handles environment variable configuration, repository cloning, SSL certificate generation, and reverse proxy setup to streamline both development and production workflows.
## Repositories
### Main Repository
- [Smart-Shell-Bash](https://github.com/luis122448/smart-shell-bash)
### Related Repositories
- [Smart-Shell-Postgres](https://github.com/luis122448/smart-shell-postgres)
PostgreSQL: Database for storing structured data.
- [Smart-Shell-Mongo](https://github.com/luis122448/smart-shell-mongo)
MongoDB: Database for storing unstructured data.
- [Smart-Shell-Redis](https://github.com/luis122448/smart-shell-redis)
Redis: Database for storing key-value data.
- [Smart-Shell-SpringBoot](https://github.com/luis122448/smart-shell-springboot)
SpringBoot: Backend for the business logic.
- [Smart-Shell-Angular](https://github.com/luis122448/smart-shell-angular)
Angular: Frontend for the user interface.
## Development Environment Setup
This describes the setup for a local development environment, where each service runs in its own Docker container.
### Installation
1. **Create a new directory**
```bash
sudo mkdir -p /var/www/smart-shell/configurations
```
2. **Change the owner of the directory**
```bash
sudo chown -R $USER:$USER /var/www/smart-shell
```
3. **Clone the repository**
```bash
cd /var/www/smart-shell/configurations
git clone https://github.com/luis122448/smart-shell-bash.git
cd smart-shell-bash
```
4. **Run the installation script with required parameters**
You must provide the database username and password as parameters. Ports for each service have defaults, but can be overridden with flags.
**Required parameters:**
- `-u `: Database username
- `-p `: Database password
**Optional port parameters:**
- `-pp `: PostgreSQL port (default: 10001)
- `-rp `: Redis port (default: 10002)
- `-mp `: MongoDB port (default: 10003)
- `-sp `: SpringBoot port (default: 10004)
- `-ap `: Angular port (default: 10005)
**Example usage:**
```bash
bash install.sh -u myuser -p mypass
```
Override ports if needed:
```bash
bash install.sh -u myuser -p mypass -pp 5432 -rp 6379 -mp 27017 -sp 8080 -ap 4200
```
**Note:** The password provided will be used for all database configurations.
5. **Execute the installation script**
See above for required parameters.
6. **Verify the installation**
This will clone all the related project repositories into the `deployments` directory.
```bash
tree /var/www/smart-shell/deployments
```
### Local Development Workflow
1. **Execute the deployment script**
This script builds and starts the Docker containers for each service.
```bash
bash deploy.sh
```
2. **Verify the deployment**
```bash
sudo docker ps
```
## Deployment Options
This project offers two main ways to deploy the application stack for production or staging environments: Docker Compose and Kubernetes.
### Docker Compose Deployment
The `docker/` directory contains the necessary files to deploy the entire application stack using Docker Compose. This is a straightforward method for single-server deployments.
1. **Navigate to the docker directory:**
```bash
cd docker
```
2. **Configure Environment Variables:**
The configuration is managed via a `.env` file. You should use the provided `backup.env` as a starting point.
```bash
# 1. Copy the backup file to a new .env file
cp backup.env .env
# 2. Open the .env file and customize it
nano .env
```
Inside the `.env` file, you must set the passwords for the databases and can customize ports, domains for CORS, and other parameters.
3. **Deploy:**
Use the `deploy.sh` script within the `docker` directory to manage the deployment.
```bash
bash deploy.sh
```
This script will handle the creation of necessary directories and start the services defined in `docker-compose.yml`.
### Kubernetes Deployment
For scalable and resilient deployments, you can use the Kubernetes manifests located in the `kubernetes/` directory.
1. **Navigate to the kubernetes directory:**
```bash
cd kubernetes
```
2. **Configure the Deployment:**
- **Domains:** Open the `configmap.yml` file to configure the `INGRESS_HOST` (your domain) and other service-related URLs like `CORS_ALLOWED_ORIGINS`.
- **Passwords:** The database passwords are not set here. They will be passed securely as a parameter to the deployment script.
3. **Run the Deployment Script:**
A convenience script, `deploy.sh`, is provided to apply all the manifests in the correct order. You must provide a password for the databases using the `-p` flag.
```bash
bash deploy.sh -p
```
This script will:
- Create the namespace `smart-shell-production`.
- Create a secret with the provided database password.
- Apply the ConfigMap with your domain configuration.
- Deploy all databases and applications.
- Dynamically configure and apply the Ingress resource based on the settings in the `configmap.yml`.
## Production SSL and Nginx Configuration
For production deployments that are not on Kubernetes, you may need to configure Nginx as a reverse proxy with SSL.
Review the `README.md` file in `./scripts/ssh/` to generate SSL certificates for your domain. Additionally, review the instructions in `./scripts/proxy/README.md` for configuring Nginx.
```
smart-shell-bash/
├── scripts/
│ ├── ssh/
│ │ ├── README.md
│ │ └── ...
│ ├── proxy/
│ │ ├── luis122448.com.conf (Example for Frontend)
│ │ ├── luis122448.dev.conf (Example for Backend)
│ │ ├── options-ssl-nginx.conf
│ │ ├── README.md
│ │ └── ...
│ └── ...
└── ...
```
## Contributing
All contributions are welcome. For more information, please refer to the [CONTRIBUTING](./CONTRIBUTING.md) file.
## License
This project is licensed under the terms of the [Creative Commons Attribution-NonCommercial 4.0 License](./LICENSE).