GithubHelp home page GithubHelp logo

Comments (9)

lcrilly avatar lcrilly commented on July 17, 2024 1

I actually meant something different but then realised that it's not possible to have ambiguous module names.

So @ac000 's original example looks ideal.

from unit.

ac000 avatar ac000 commented on July 17, 2024

The language modules and versions are handily stored in the languages array member of the nxt_runtime_t structure...

We have access to the following information

typedef struct {                                                                
    nxt_app_type_t            type;                                             
    u_char                    *version;                                         
    char                      *file;                                            
    nxt_app_module_t          *module;                                          
    nxt_array_t               *mounts;    /* of nxt_fs_mount_t */               
} nxt_app_lang_module_t;

Would showing the path (e.g /opt/unit/modules/python.unit.so) to the module be useful? Might be handy for debugging to make sure it's loading the modules you expect it to...

from unit.

avahahn avatar avahahn commented on July 17, 2024

Would showing the path (e.g /opt/unit/modules/python.unit.so) to the module be useful?

I have wished for this information several times in fact! :)
I think having this will better enable our users to roll their own docker images and to compile Unit for themselves.

from unit.

lcrilly avatar lcrilly commented on July 17, 2024

Given that we have the type and version as separate entities in the struct, it makes sense to have an array of objects instead of the simple naive array I was envisaging.

I wasn't sure about the information disclosure of the path. And I didn't have a use case for it. But now I think about it, knowing exactly which module is loaded seems like a good idea.

from unit.

ac000 avatar ac000 commented on July 17, 2024

I have an initial version that will return something like

{
    "modules": {
        "python": {
            "version": "3.12.2",
            "lib": "/opt/unit/modules/python.unit.so"
        },
        "wasm": {
            "version": "0.1",
            "lib": "/opt/unit/modules/wasm.unit.so"
        },
        "wasm-wasi-component": {
            "version": "0.1",
            "lib": "/opt/unit/modules/wasm_wasi_component.unit.so"
        }
    },
...
}

from unit.

lcrilly avatar lcrilly commented on July 17, 2024

I look forward to trying it :)

I suggested an array of objects because we may find multiple versions of the same language module installed (especially for PHP and Python).

from unit.

ac000 avatar ac000 commented on July 17, 2024

Are you saying you want the JSON formatted differently?

Currently it's modelled on the "applications" section

	"applications": {
		"luw-echo-request": {
			"processes": {
				"running": 1,
				"starting": 0,
				"idle": 1
			},

			"requests": {
				"active": 0
			}
		},

		"luw-upload-reflector": {
			"processes": {
				"running": 1,
				"starting": 0,
				"idle": 1
			},

			"requests": {
				"active": 0
			}
		},

		"echo-request-raw": {
			"processes": {
				"running": 1,
				"starting": 0,
				"idle": 1
			},

			"requests": {
				"active": 0
			}
		},

		"rust-echo-request": {
			"processes": {
				"running": 1,
				"starting": 0,
				"idle": 1
			},

			"requests": {
				"active": 0
			}
		},

		"rust-upload-reflector": {
			"processes": {
				"running": 1,
				"starting": 0,
				"idle": 1
			},

			"requests": {
				"active": 0
			}
		},

		"rust-hello-world": {
			"processes": {
				"running": 1,
				"starting": 0,
				"idle": 1
			},

			"requests": {
				"active": 0
			}
		},

		"sc-test": {
			"processes": {
				"running": 1,
				"starting": 0,
				"idle": 1
			},

			"requests": {
				"active": 0
			}
		},

		"large-upload": {
			"processes": {
				"running": 1,
				"starting": 0,
				"idle": 1
			},

			"requests": {
				"active": 0
			}
		},

		"rust-large-upload": {
			"processes": {
				"running": 1,
				"starting": 0,
				"idle": 1
			},

			"requests": {
				"active": 0
			}
		}
	}

from unit.

callahad avatar callahad commented on July 17, 2024

I think Liam probably means:

{
    "modules": {
        "python": [
            {
                "version": "3.12.2",
                "lib": "/opt/unit/modules/python3.12.unit.so"
            },
            {
                "version": "3.11.0",
                "lib": "/opt/unit/modules/python3.11.unit.so"
            }
        ],
        "wasm": [ ... ]
}

from unit.

lcrilly avatar lcrilly commented on July 17, 2024

Excellent! Well done @ac000

from unit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.