Posts

AI - Building APP in lightSAIL AWS instance : Automatic background app start

 Run these on the Lightsail server. 1. Go to app folder cd /var/www/tradingapp ls -la 2. Recreate venv python3 -m venv venv source venv/bin/activate 3. Install packages If you have requirements.txt : pip install --upgrade pip pip install -r requirements.txt If no requirements.txt , install basics: pip install --upgrade pip pip install fastapi uvicorn flask openai python-dotenv pandas requests 4. Recreate start.sh nano start.sh Paste this: #!/bin/bash cd /var/www/tradingapp source venv/bin/activate python3 webapp/app.py Save in nano: Ctrl + O Enter Ctrl + X Make executable: chmod +x start.sh 5. Test manually ./start.sh If app starts, stop with: Ctrl + C 6. Start in background nohup ./start.sh > /tmp/tradingapp.log 2>&1 & Check: ps -ef | grep app.py tail -50 /tmp/tradingapp.log 7. Important: prevent Git deleting these again Add to .gitignore : nano .gitignore Add: venv/ start.sh .env *.log __pycache__/ Then: git status venv should never be committed. start.sh can be c...

Building Platform - Kube Vs Openshift

  The major difference between Kubernetes and OpenShift lies in their  scope and features .   Kubernetes is a foundational container orchestration platform, while OpenShift builds on top of Kubernetes to provide a comprehensive container application platform with added features like integrated developer tools, security enhancements, and simplified deployment.   Elaboration: Kubernetes:   Kubernetes is primarily a container orchestration system that focuses on automating the deployment, scaling, and management of containerized applications.  It provides the core infrastructure for managing containers but requires additional tools and configurations for features like CI/CD, security, and developer tooling.   OpenShift:   OpenShift is built on top of Kubernetes and extends its functionality by offering a complete container application platform.  It includes integrated features such as:   Developer Tools:   OpenShift provides tools for ...

Prediction model using Python

  To use an XGBoost model for predictions in Python, you first need to train the model on your data using the  fit  method.  Then, you can use the  predict  method to make predictions on new data.   Here's a breakdown of the process: 1. Import necessary libraries: Python import xgboost as xgb from sklearn . model_selection import train_test_split from sklearn . metrics import accuracy_score 2. Load and prepare your data: Data loading:   Use libraries like Pandas to load your data from files or databases.   Data preparation:   Split your data into features (X) and target (y).  You might also need to split your data into training and testing sets.   Example: Python # Assuming your data is in a Pandas DataFrame called 'df' X = df.drop( ' target_column ' , axis= 1 ) # Features y = df[ ' target_column ' ] # Target X_train , X_test , y_train , y_test = train_test_split(X, y, test_size= 0.2 , random_state= 42 ) # Split int...