Sign inSign up

openeuler/uwsgi

Sponsored OSS

By openeuler

Updated 2 days ago

Image
0

4.9K

openeuler/uwsgi repository overview

Quick reference

uWSGI | openEuler

Current uWSGI docker images are built on the openEuler. This repository is free to use and exempted from per-user rate limits.

uWSGI is an open source software application that "aims at developing a full stack for building hosting services". It is named after the Web Server Gateway Interface (WSGI), which was the first plugin supported by the project. uWSGI is maintained by the Italian-based software company unbit.

The tag of each uwsgi docker image is consist of the version of uwsgi and the version of basic image. The details are as follows

TagCurrentlyArchitectures
2.0.31-oe2403sp4uwsgi 2.0.31 on openEuler 24.03-LTS-SP4amd64, arm64
2.0.30-oe2403sp4uwsgi 2.0.30 on openEuler 24.03-LTS-SP4amd64, arm64
2.0.30-oe2403sp2uwsgi 2.0.30 on openEuler 24.03-LTS-SP2amd64, arm64
2.0.29-oe2403sp1uWSGI 2.0.29 on openEuler 24.03-LTS-SP1amd64, arm64

Usage

In this usage, users can select the corresponding {Tag} based on their requirements.

  • Pull the openeuler/uwsgi image from docker

    docker pull openeuler/uwsgi:{Tag}
    
  • Run with an interactive shell

    You can start the container with an interactive shell to use uwsgi.

    docker run -it --rm openeuler/uwsgi:{Tag} bash
    
  • Prepare tne Application

    Create Working Directory

    mkdir /app
    

    Create WSGI Entry File(myapp.py)

    # /app/myapp.py
    def application(environ, start_response):
        status = '200 OK'
        headers = [('Content-type', 'text/plain; charset=utf-8')]
        start_response(status, headers)
        return [b"Hello World from uWSGI!"]
    
  • Set Up Non-Root User & Permissions

    Create Dedicated User & Group

    groupadd -r uwsgi_group
    useradd -r -g uwsgi_group -d /app -s /bin/false uwsgi_user
    

    Set Proper Permissions

    chown -R uwsgi_user:uwsgi_group /app
    chmod -R 755 /app
    
  • Start uWSGI with Recommended Parameters

    Basic Command

    ./uwsgi \
      --http-socket :8000 \
      --processes 4 \
      --threads 2 \
      --chdir /app \
      --wsgi-file myapp.py \
      --master \
      --enable-threads \
      --buffer-size 32768 \
      --uid uwsgi_user \
      --gid uwsgi_group
    

    Parameters Explanation:

    ParameterDescriptionRecommended Value
    --http-socket :8000Bind to TCP port 8000 (HTTP mode):8000 (or any available port)
    --processes 4Number of worker processes4 (adjust based on CPU cores)
    --threads 2Threads per worker2 (for concurrent requests)
    --chdir /appWorking directory/app (where myapp.py resides)
    --wsgi-file myapp.pyWSGI application entry filemyapp.py (must contain application callable)
    --masterEnable master process (manages workers)Always enable in production
    --enable-threadsAllow threading in workersRequired for threaded apps
    --buffer-size 32768Request buffer size (bytes)32768 (32KB, adjust if needed)
    --uid uwsgi_userRun as non-root userDedicated user (e.g., uwsgi_user)
    --gid uwsgi_groupRun with non-root groupDedicated group (e.g., uwsgi_group)

Question and answering

If you have any questions or want to use some special features, please submit an issue or a pull request on openeuler-docker-images.

Tag summary

Content type

Image

Digest

sha256:57aa8a339

Size

257.7 MB

Last updated

2 days ago

docker pull openeuler/uwsgi

This week's pulls

Pulls:

13

Last week