health
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Health] help


From: Ehsan Irshad
Subject: [Health] help
Date: Fri, 24 May 2024 12:52:43 +0500

Dear Sir Good Day, 
                              I am trying to deploy the thalamus server on three different environment setups which are as follows:
  1. Local system as Test Deployment
  2. Running via UWSGI in Docker Container (DB is installed with thalamus User on Host Windows Machine)
  3. Running on Ubuntu VM Hosted on Windows 11 Machine
But i am unable to run any of the above environments: 

I am referring here the errors which i am getting while deploying via Docker Container:
```
(hr_automation) C:\Users\muhammad.ehsan\hr_automation\Lib\site-packages\thalamus\etc>docker logs thalamus_server [uWSGI] getting INI configuration from /app/thalamus_uwsgi.ini open("./http_plugin.so"): No such file or directory [core/utils.c line 3709] !!! UNABLE to load uWSGI plugin: ./http_plugin.so: cannot open shared object file: No such file or directory !!! open("./python3_plugin.so"): No such file or directory [core/utils.c line 3709] !!! UNABLE to load uWSGI plugin: ./python3_plugin.so: cannot open shared object file: No such file or directory !!! *** Starting uWSGI 2.0.25.1 (64bit) on [Tue May 21 08:36:42 2024] *** compiled with version: 12.2.0 on 21 May 2024 08:14:03 os: Linux-5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 nodename: 43f0bb24e1ce machine: x86_64 clock source: unix detected number of CPU cores: 12 current working directory: /app detected binary path: /usr/local/bin/uwsgi !!! no internal routing support, rebuild with pcre support !!! uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** your memory page size is 4096 bytes detected max file descriptor number: 1048576 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uWSGI http bound on 0.0.0.0:8080 fd 3 uwsgi socket 0 bound to TCP address 0.0.0.0:5000 fd 6 uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** Python version: 3.9.19 (main, May 14 2024, 09:03:15) [GCC 12.2.0] Python main interpreter initialized at 0x55a94cf7f330 uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** python threads support enabled your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 416880 bytes (407 KB) for 8 cores *** Operational MODE: preforking+threaded *** unable to load app 0 (mountpoint='') (callable not found or import error) *** no app loaded. going in full dynamic mode *** uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** *** uWSGI is running in multiple interpreter mode *** spawned uWSGI master process (pid: 1) spawned uWSGI worker 1 (pid: 7, cores: 2) spawned uWSGI worker 2 (pid: 8, cores: 2) spawned uWSGI worker 3 (pid: 9, cores: 2) spawned uWSGI worker 4 (pid: 13, cores: 2) *** Stats server enabled on 127.0.0.1:9191 fd: 18 *** spawned uWSGI http 1 (pid: 15) invalid request block size: 21573 (max 4096)...skip invalid request block size: 21573 (max 4096)...skip invalid request block size: 21573 (max 4096)...skip invalid request block size: 21573 (max 4096)...skip invalid request block size: 21573 (max 4096)...skip invalid request block size: 21573 (max 4096)...skip invalid request block size: 21573 (max 4096)...skip invalid request block size: 21573 (max 4096)...skip invalid request block size: 21573 (max
```
Here are my configuration Files: 
____________________________________________________________________________
thalamus_uwsgi.ini

[uwsgi]
module = thalamus:app
master = true
processes = 4
threads = 2
http-socket = 0.0.0.0:8080
socket = /tmp/uwsgi.sock  # Use socket instead of http
chmod-socket = 660  # Ensure correct socket permissions
vacuum = true
die-on-term = true
stats = 127.0.0.1:9191
plugins = python3
____________________________________________________________________________________
thalamus.cfg
#DB params
#Use UNIX sockets
#You can also specify the hostname as POSTGRESQL_URI = "postgresql://localhost/federation"
POSTGRESQL_URI = "postgresql://thalamus:12345@host.docker.internal:5432/federation"

# Debugging info
DEBUG = True

#Flask Secret Key
SECRET_KEY = 'TheWorldNeedsMoreSocialMedicine'

# File containing the Access Control List and roles
ACL = 'etc/roles.cfg'
_____________________________________________________________________________________

roles.cfg 

[
    {"role": "end_user",
     "permissions": {
        "GET": ["login","person", "book","page","password"],
        "PATCH": ["person","page"],
        "POST": ["page", "password"],
        "DELETE": [],
        "global": "False"
        }
    },

    {"role": "health_professional",
     "permissions": {
        "GET": ["login","people","person","book","page"],
        "PATCH": ["person", "page"],
        "POST": ["person", "page"],
        "DELETE": [],
        "global": "True"
        }
    },

    {"role": "root",
     "permissions": {
        "GET": ["login","people","person","book", "page","password"],
        "PATCH": ["person","page"],
        "POST": ["person","page",  "password"],
        "DELETE": ["person","page"],
        "global": "True"
        }
    }
]
___________________________________________________________________

DockerFile

FROM python:3.9-slim # Set the working directory in the container WORKDIR /app # Install system dependencies and PostgreSQL development libraries RUN apt-get update && apt-get install -y \ libpq-dev \ gcc \ build-essential \ && rm -rf /var/lib/apt/lists/* # Install uWSGI and plugins RUN pip install uwsgi RUN apt-get update && apt-get install -y uwsgi-plugin-python3 # Copy the current directory contents into the container at /app COPY . /app # Install any needed packages specified in requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Expose the port the app runs on EXPOSE 5000 8080 # Run the application with uWSGI CMD ["uwsgi", "--ini", "/app/thalamus_uwsgi.ini"] # Option to run with Gunicorn (comment out the uWSGI line above and uncomment the line below) # CMD ["gunicorn", "-c", "/app/gunicorn.cfg", "thalamus:app"]

_______________________________________________________________________________
here is my thalamus.py endpoint app

thalamus.py

from flask import Flask, jsonify
import requests

app = Flask(__name__)

# Load configuration from thalamus.cfg
app.config.from_pyfile('thalamus.cfg')

# Define the base URL for the Thalamus API
BASE_URL = 'http://localhost:5000'  # Adjusted to match your Docker setup

def get_person_info(person_id, auth):
    # Endpoint to retrieve demographic information of a person
    url = "">   
    # Send a GET request with authentication
    response = requests.get(url, auth=auth, verify=False)
   
    # Check if the request was successful
    if response.status_code == 200:
        return response.json()
    else:
        return {'error': 'Failed to fetch person information'}

@app.route('/')
def index():
    return "Thalamus API is running"

@app.route('/people/<person_id>')
def people(person_id):
    auth = ('ITAPYT999HON', 'gnusolidario')
    person_info = get_person_info(person_id, auth)
    return jsonify(person_info)

if __name__ == '__main__':
    app.run(debug=True)

____________________________________________________

I have provided you all the details can you please tell me where i am doing the mistakes. I shall be grateful if you could anticipate and provide needful help. Thank You


reply via email to

[Prev in Thread] Current Thread [Next in Thread]