-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
292bd49
commit ba01020
Showing
1,846 changed files
with
199,408 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Git files | ||
.git | ||
.gitignore | ||
|
||
# Python cache files | ||
__pycache__/ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
*.pyo | ||
|
||
# Virtual environments | ||
venv/ | ||
env/ | ||
|
||
# Environment variables | ||
.env | ||
|
||
# Pytest cache | ||
.pytest_cache/ | ||
|
||
# Log files | ||
logs/ | ||
*.log | ||
|
||
# Distribution / Packaging | ||
dist/ | ||
build/ | ||
*.egg-info/ | ||
|
||
# Database files | ||
*.sqlite3 | ||
*.db | ||
*.db-journal | ||
*.sqlite | ||
*.sqlite-journal | ||
*.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Log files | ||
logs/ | ||
*.log | ||
|
||
# Python cache files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# Virtual environments | ||
venv/ | ||
env/ | ||
|
||
# Environment variables | ||
.env | ||
|
||
# Pytest | ||
.pytest_cache/ | ||
.coverage | ||
htmlcov/ | ||
|
||
# Distribution / Packaging | ||
dist/ | ||
build/ | ||
*.egg-info/ | ||
|
||
# Databases | ||
*.sqlite3 | ||
*.db | ||
*.db-journal | ||
*.sqlite | ||
*.sqlite-journal | ||
*.sql | ||
|
||
# Swap files | ||
*.swp | ||
|
||
# Docker Compose files | ||
docker-compose.yml | ||
docker-compose.yaml | ||
|
||
# Application-specific | ||
instance/ | ||
apps/log/app.log | ||
|
||
# Backups | ||
apps/backups |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM python:3.9 | ||
|
||
ENV TZ="Australia/Sydney" | ||
WORKDIR /home/project/app | ||
COPY requirements.txt /home/project/app | ||
RUN pip3 install -r requirements.txt | ||
RUN apt-get update | ||
RUN apt-get install -y sshpass | ||
|
||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ | ||
apt-get install -y python3-pip sshpass git openssh-client libhdf5-dev libssl-dev libffi-dev && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
apt-get clean | ||
|
||
RUN pip3 install --upgrade pip cffi && \ | ||
pip install ansible==7.5.0 && \ | ||
pip install mitogen==0.2.10 ansible-lint==6.15.0 jmespath && \ | ||
pip install --upgrade pywinrm && \ | ||
rm -rf /root/.cache/pip | ||
|
||
RUN mkdir /ansible && \ | ||
mkdir -p /etc/ansible && \ | ||
echo 'localhost' > /etc/ansible/hosts | ||
|
||
# Set the command to run your application | ||
CMD [ "gunicorn", "-w", "10", "-b", ":8000", "run:app", "--timeout", "3600" ] | ||
|
||
COPY . /home/project/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
build: | ||
docker-compose up --build -d | ||
|
||
clean: | ||
docker-compose down | ||
docker system prune -fa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Welcome to Deployaroo | ||
|
||
<img src="apps/static/logo/deployaroo_text_lightgrey.png" alt="Deployaroo Logo" width="400px" style="display: block; margin-left: auto; margin-right: auto;"> | ||
|
||
**Deployaroo** is a sleek and intuitive web interface for deploying VMware vSphere virtual machine templates using Ansible. | ||
|
||
--- | ||
|
||
## 🚀 Key Features | ||
|
||
- **✅ Easy VM Creation**: Streamline the process of creating both domain-joined and non-domain virtual machines. | ||
- **📊 Statistics Home Dashboard**: View all statistics related to template deployments. | ||
- **📜 Deployment History**: Access records of all running, completed, and failed deployments. View Ansible log for each deployment. | ||
- **🔍 Detailed Logs**: Detailed logs on all events within the application. | ||
- **👥 User Management**: Manage user access and permissions. | ||
- **💾 Backup & Restore**: Create backups and restore them as needed. | ||
- **🖼️ VM Image Management**: Manage your "VM Images" and upload your custom image Ansible playbooks for deployment. | ||
- **⚙️ Flexible Deployment Options**: Deploy Deployaroo as a Docker container or on a Linux machine. | ||
|
||
--- | ||
|
||
## 🏁 Getting Started | ||
|
||
To get started with Deployaroo, see the [Documentation](https://deployaroo.io). | ||
|
||
--- | ||
|
||
## 📚 Links | ||
|
||
- [Github Repo](https://github.com/blink-zero/deployaroo) | ||
- [Documentation](https://deployaroo.io) | ||
- [Deployaroo Images](https://github.com/blink-zero/deployaroo-images) | ||
|
||
--- | ||
|
||
## 🤝 Contributing | ||
|
||
I welcome contributions! | ||
|
||
--- | ||
|
||
## 📺 Screenshots | ||
|
||
See some visuals of Deployaroo [here](https://deployaroo.io/screenshots). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
from datetime import datetime, timedelta | ||
import os | ||
from flask import Flask, render_template | ||
from flask_login import LoginManager | ||
from importlib import import_module | ||
from flask_sqlalchemy import SQLAlchemy | ||
|
||
# Set the application start time in environment variables | ||
if not os.getenv('APP_START_TIME'): | ||
os.environ['APP_START_TIME'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S') | ||
|
||
# Initialize Flask extensions | ||
db = SQLAlchemy() | ||
login_manager = LoginManager() | ||
|
||
# Function to register Flask extensions | ||
def register_extensions(app): | ||
db.init_app(app) | ||
login_manager.init_app(app) | ||
|
||
# Function to configure database | ||
def configure_database(app): | ||
|
||
@app.before_first_request | ||
def initialize_database(): | ||
db.create_all() | ||
|
||
@app.teardown_request | ||
def shutdown_session(exception=None): | ||
db.session.remove() | ||
|
||
# Function to set the secret key for Flask app | ||
def set_secret_key(app): | ||
app.secret_key = 'my_secret_key' | ||
|
||
# Function to set the session timeout | ||
def set_session_timeout(app): | ||
app.permanent_session_lifetime = timedelta(minutes=30) | ||
|
||
# Function to register Flask blueprints | ||
def register_blueprints(app): | ||
# Import and register blueprints from various modules | ||
for module_name in ('auth', 'settings', 'home', 'vmware'): | ||
module = import_module('apps.{}.routes'.format(module_name)) | ||
app.register_blueprint(module.blueprint) | ||
|
||
# Function to create Flask application | ||
def create_app(config): | ||
# Create Flask app instance | ||
app = Flask(__name__) | ||
# Load configuration from config object | ||
app.config.from_object(config) | ||
# Register Flask extensions | ||
register_extensions(app) | ||
# Set session timeout | ||
set_session_timeout(app) | ||
# Set secret key | ||
set_secret_key(app) | ||
# Register Flask blueprints | ||
register_blueprints(app) | ||
# Configure database | ||
configure_database(app) | ||
# Return Flask app instance | ||
return app | ||
|
||
# Define a custom unauthorized handler function for Flask-Login | ||
@login_manager.unauthorized_handler | ||
def unauthorized(): | ||
# Customize the unauthorized page here | ||
return render_template('error/403.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from flask import Blueprint | ||
|
||
blueprint = Blueprint( | ||
'auth_blueprint', | ||
__name__, | ||
url_prefix='' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import logging | ||
from datetime import datetime | ||
from flask import Blueprint, redirect, render_template, request, url_for, session | ||
from flask_login import login_user, logout_user, login_required, current_user | ||
from apps.auth import blueprint | ||
from apps.models import User | ||
import json | ||
|
||
def log_json(level, message, **kwargs): | ||
log_entry = { | ||
"level": level, | ||
"timestamp": datetime.now().strftime('%Y-%m-%d %H:%M:%S'), | ||
"user": session.get('username', 'anonymous'), | ||
"message": message, | ||
**kwargs | ||
} | ||
logging.getLogger('json_logger').info(json.dumps(log_entry)) | ||
|
||
@blueprint.route('/', methods=['GET', 'POST']) | ||
@blueprint.route('/login', methods=['GET', 'POST']) | ||
def login(): | ||
error = None | ||
|
||
if request.method == 'POST': | ||
username = request.form['user_id'] | ||
password = request.form['password'] | ||
user = User.query.filter_by(username=username).first() | ||
|
||
if user is None or not user.check_password(password): | ||
error = 'Invalid username or password' | ||
log_json('WARNING', 'Failed login attempt', username=username) | ||
else: | ||
login_user(user) | ||
session['username'] = user.username | ||
log_json('INFO', 'User logged in', username=user.username) | ||
return redirect(url_for('home_blueprint.home')) | ||
|
||
return render_template('accounts/login.html', error=error) | ||
|
||
@blueprint.route('/logout') | ||
@login_required | ||
def logout(): | ||
username = session.get('username', 'anonymous') | ||
logout_user() | ||
log_json('INFO', 'User logged out', username=username) | ||
session.pop('username', None) | ||
return redirect(url_for('auth_blueprint.login')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import os | ||
|
||
# Base configuration class | ||
class Config(object): | ||
# Secret key for cryptographic operations | ||
# Randomly generated key, replace with your own key if you are using this in production or Add Environment Variable | ||
SECRET_KEY = os.environ.get('SECRET_KEY') or 'default_secret_key' | ||
|
||
# Encryption key for cryptographic operations relating to password storage | ||
# Randomly generated key, replace with your own key if you are using this in production or add Environment Variable | ||
ENCRYPTION_KEY = os.environ.get('ENCRYPTION_KEY') or 'default_encryption_key' | ||
|
||
# Database URI, defaulting to SQLite if not provided | ||
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///db.sqlite3' | ||
|
||
# Controls SQLAlchemy's modification tracking, set to False for better performance | ||
SQLALCHEMY_TRACK_MODIFICATIONS = False | ||
|
||
# Indicates whether session cookies should be sent only over HTTPS | ||
SESSION_COOKIE_SECURE = True | ||
|
||
# Default retention period for logs in days, Currently not used | ||
LOG_RETENTION_DAYS = 30 | ||
|
||
# Default admin user credentials | ||
APP_ADMIN_USER = os.environ.get('APP_ADMIN_USER', 'admin') | ||
APP_ADMIN_PASSWORD = os.environ.get('APP_ADMIN_PASSWORD', 'password') | ||
|
||
# Configuration class for development environment | ||
class DevelopmentConfig(Config): | ||
DEBUG = True | ||
SESSION_COOKIE_SECURE = False | ||
|
||
class ProductionConfig(Config): | ||
DEBUG = False | ||
SESSION_COOKIE_SECURE = False # Need to change this to True when deploying to production but for now we will leave it as False | ||
|
||
# Dictionary mapping configuration mode names to their respective configuration classes | ||
config_dict = { | ||
'Production': ProductionConfig, | ||
'Debug': DevelopmentConfig | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from flask import Blueprint | ||
|
||
blueprint = Blueprint( | ||
'home_blueprint', | ||
__name__, | ||
url_prefix='' | ||
) | ||
|
||
stream = Blueprint( | ||
'stream', | ||
__name__, | ||
template_folder='templates' | ||
) |
Oops, something went wrong.