weblodge


Nameweblodge JSON
Version 0.6.1 PyPI version JSON
download
home_pagehttps://github.com/florian-vuillemot/weblodge
SummaryA simple command line aiming to provide anyone with deployment and cloud management capabilities.
upload_time2023-10-10 06:52:52
maintainer
docs_urlNone
authorVuillemot Florian
requires_python>=3.8,<3.12
license
keywords deployment azure
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # WebLodge

**WebLodge** is a command line aiming to provide anyone with deployment and cloud management capabilities.

> Full documentation [here](https://weblodge.readthedocs.io/en/latest/).


## Prerequisites

- Install the command line with `pip install weblodge`.
- A Python [Flask](https://flask.palletsprojects.com/en/2.3.x/) application.
- A `requirements.txt` with the application dependencies. 
- Have an [Azure account](https://azure.microsoft.com/en-us/free).

> Note: By default, **WebLodge** uses **Free** (or almost free) [Azure services](https://azure.microsoft.com/en-us/pricing/free-services) and lets the user specify non-free configurations.


> Note: Today, **WebLodge** is only available for **Flask** applications.


## Deploying an application

The simple way to deploy your local application is by running the command line `weblodge deploy --build` in your application directory.

In that case, **WebLodge** will assume that your application entry point is named `app.py` and your dependencies file is `requirements.txt`.

Behind the scene, **WebLodge** *build* then *deploy* your application.

![CLI: weblodge deploy --build](./images/deploy.gif)

## Application structure

**WebLodge** is sensible to the application structure. Applications must follow the pre-defined pattern or specify custom values.

Here is an example of the standard pattern deployable without configuration:
```
$ cat app.py  # The application entry point.
from flask import Flask

app = Flask(__name__)  # The Flask application.

@app.route("/")
def hello_world():
    return "<p>Hello, World!</p>"
```
It can be deployed with `weblodge deploy --build`.

Here is a non-standard example:
```
$ cat main.py  # The application entry point.
from flask import Flask

my_app = Flask(__name__)  # The Flask application.

@app.route("/")
def hello_world():
    return "<p>Hello, World!</p>"
```
To be able to deploy the application, you must first *build* it and specify:
- The entry point file: `main.py`.
- The **Flask** application: `my_app`.
```
# Build the application.
weblodge build --entry-point main.py --flask-app my_app
# Deploy the application.
weblodge deploy
```

## Build

The *build* operation collects and prepares the application for deployment on a specific platform.

The *build* operation can handle the following options:
| Option name | Description | Default value |
|-|-|-|
| src | Folder containing application sources. | `.` |
| dist | Folder containing the application built. | `dist` |
| entry-point | The application file to be executed with `python`. | `app.py` |
| flask-app | The Flask application object in the `entry-point` file. | `app` |
| requirements | The **requirements.txt** file path of the application. Ignores if a `requirements.txt` file is located at the root of the application. | `requirements.txt` |

> Note: Here, the platform is implicitly [Azure App Service](https://azure.microsoft.com/en-us/products/app-service/web).

Example:
```
# Build the local application.
weblodge build

# Build the application in the 'myapp' folder.
weblodge build --src myapp
```

## Deploy

The *deploy* operation creates the necessary infrastructure and uploads the build package - i.e. your code - on the infrastructure.

| Option name | Description | Default value |
|-|-|-|
| subdomain | The subdomain of the application on the Internet: `<subdomain>.azurewebsites.net`. Randomly generated if not provided. | `<randomly generated>` |
| sku | The application [computational power](https://azure.microsoft.com/en-us/pricing/details/app-service/linux/). | `F1` |
| location | The physical application location. | `northeurope` |
| environment | The environment of your application. | `production` |
| dist | Folder containing the application built. | `dist` |

Example:
```
# Deploy the local application.
weblodge deploy

# Deploy the local application with a custom subdomain.
weblodge deploy --subdomain myapp
```

> **ℹ️ Note**
>
> WebLodge considers the `subdomain` as the application name.

## Delete

The *delete* operation deletes the infrastructure deployed but keeps the build.

| Option name | Description | Default value |
|-|-|-|
| subdomain | The subdomain of the application to be deleted. | `<my-subdomain>` |
| yes | Do not prompt a validation message before deletion. | `false` |


Example:
```
# Delete the application previously deployed.
weblodge delete
```


## Logs

The *logs* operation streams your application logs. Because it is a stream, logs are truncated.

| Option name | Description | Default value |
|-|-|-|
| subdomain | The subdomain of the application. | `<my-subdomain>` |

Example:
```
# Print logs of the application previously created.
weblodge logs
```

*** Log buffering ***

Logs can be buffered and never appear in the stream.

If you use the [print](https://docs.python.org/3/library/functions.html#print) method, you can force logs to be written to the console by sending them to the [stderr](https://docs.python.org/3/library/sys.html#sys.stderr) output or by using the `flush` option.

If you use the [logging](https://docs.python.org/3/library/logging.html) module, only logs starting at the `WARNING` level will be displayed by default. Otherwise, update the [logging level](https://docs.python.org/3/library/logging.html#logging.Logger.setLevel) module to the required level.

## Configuration file: `.weblodge.json`

At the end of a deployment, **WebLodge** creates a file named `.weblodge.json` by default.
This file contains the previous configuration, enabling **WebLodge** to update your application with the same parameters. This file can be version-controlled and used in your Continuous Deployment.

You can change the name of this file with the `--config-file` option.

Example:
```
weblodge build --config-file myconfigfile.json
```

## Manage your WebLodge-deployed application

Managing and updating is a daily infrastructure task with no visible value for the end user.
**WebLodge** uses an Azure [Platform as a Service](https://azure.microsoft.com/en-in/resources/cloud-computing-dictionary/what-is-paas/)
resource named [Azure App Service](https://learn.microsoft.com/en-us/azure/app-service/)
to keep your infrastructure as secure, up-to-date and reliable as possible.
This tool keeps your infrastructure at the state-of-the-art, allowing you to focus on your application's functionality.

But whatever your infrastructure tools are, it's your responsibility to keep your application secure and your dependencies up-to-date.

## Feedbacks

Feel free to create issues with bugs, ideas and any constructive feedback.

MIT License

Copyright (c) 2023 Vuillemot Florian

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/florian-vuillemot/weblodge",
    "name": "weblodge",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<3.12",
    "maintainer_email": "",
    "keywords": "deployment,azure",
    "author": "Vuillemot Florian",
    "author_email": "vuillemot.florian@outlook.fr",
    "download_url": "https://files.pythonhosted.org/packages/95/61/a02217f930036e54fd0a4e3272697f7926c3036742833bba41a7372eff8d/weblodge-0.6.1.tar.gz",
    "platform": null,
    "description": "# WebLodge\n\n**WebLodge** is a command line aiming to provide anyone with deployment and cloud management capabilities.\n\n> Full documentation [here](https://weblodge.readthedocs.io/en/latest/).\n\n\n## Prerequisites\n\n- Install the command line with `pip install weblodge`.\n- A Python [Flask](https://flask.palletsprojects.com/en/2.3.x/) application.\n- A `requirements.txt` with the application dependencies. \n- Have an [Azure account](https://azure.microsoft.com/en-us/free).\n\n> Note: By default, **WebLodge** uses **Free** (or almost free) [Azure services](https://azure.microsoft.com/en-us/pricing/free-services) and lets the user specify non-free configurations.\n\n\n> Note: Today, **WebLodge** is only available for **Flask** applications.\n\n\n## Deploying an application\n\nThe simple way to deploy your local application is by running the command line `weblodge deploy --build` in your application directory.\n\nIn that case, **WebLodge** will assume that your application entry point is named `app.py` and your dependencies file is `requirements.txt`.\n\nBehind the scene, **WebLodge** *build* then *deploy* your application.\n\n![CLI: weblodge deploy --build](./images/deploy.gif)\n\n## Application structure\n\n**WebLodge** is sensible to the application structure. Applications must follow the pre-defined pattern or specify custom values.\n\nHere is an example of the standard pattern deployable without configuration:\n```\n$ cat app.py  # The application entry point.\nfrom flask import Flask\n\napp = Flask(__name__)  # The Flask application.\n\n@app.route(\"/\")\ndef hello_world():\n    return \"<p>Hello, World!</p>\"\n```\nIt can be deployed with `weblodge deploy --build`.\n\nHere is a non-standard example:\n```\n$ cat main.py  # The application entry point.\nfrom flask import Flask\n\nmy_app = Flask(__name__)  # The Flask application.\n\n@app.route(\"/\")\ndef hello_world():\n    return \"<p>Hello, World!</p>\"\n```\nTo be able to deploy the application, you must first *build* it and specify:\n- The entry point file: `main.py`.\n- The **Flask** application: `my_app`.\n```\n# Build the application.\nweblodge build --entry-point main.py --flask-app my_app\n# Deploy the application.\nweblodge deploy\n```\n\n## Build\n\nThe *build* operation collects and prepares the application for deployment on a specific platform.\n\nThe *build* operation can handle the following options:\n| Option name | Description | Default value |\n|-|-|-|\n| src | Folder containing application sources. | `.` |\n| dist | Folder containing the application built. | `dist` |\n| entry-point | The application file to be executed with `python`. | `app.py` |\n| flask-app | The Flask application object in the `entry-point` file. | `app` |\n| requirements | The **requirements.txt** file path of the application. Ignores if a `requirements.txt` file is located at the root of the application. | `requirements.txt` |\n\n> Note: Here, the platform is implicitly [Azure App Service](https://azure.microsoft.com/en-us/products/app-service/web).\n\nExample:\n```\n# Build the local application.\nweblodge build\n\n# Build the application in the 'myapp' folder.\nweblodge build --src myapp\n```\n\n## Deploy\n\nThe *deploy* operation creates the necessary infrastructure and uploads the build package - i.e. your code - on the infrastructure.\n\n| Option name | Description | Default value |\n|-|-|-|\n| subdomain | The subdomain of the application on the Internet: `<subdomain>.azurewebsites.net`. Randomly generated if not provided. | `<randomly generated>` |\n| sku | The application [computational power](https://azure.microsoft.com/en-us/pricing/details/app-service/linux/). | `F1` |\n| location | The physical application location. | `northeurope` |\n| environment | The environment of your application. | `production` |\n| dist | Folder containing the application built. | `dist` |\n\nExample:\n```\n# Deploy the local application.\nweblodge deploy\n\n# Deploy the local application with a custom subdomain.\nweblodge deploy --subdomain myapp\n```\n\n> **\u2139\ufe0f Note**\n>\n> WebLodge considers the `subdomain` as the application name.\n\n## Delete\n\nThe *delete* operation deletes the infrastructure deployed but keeps the build.\n\n| Option name | Description | Default value |\n|-|-|-|\n| subdomain | The subdomain of the application to be deleted. | `<my-subdomain>` |\n| yes | Do not prompt a validation message before deletion. | `false` |\n\n\nExample:\n```\n# Delete the application previously deployed.\nweblodge delete\n```\n\n\n## Logs\n\nThe *logs* operation streams your application logs. Because it is a stream, logs are truncated.\n\n| Option name | Description | Default value |\n|-|-|-|\n| subdomain | The subdomain of the application. | `<my-subdomain>` |\n\nExample:\n```\n# Print logs of the application previously created.\nweblodge logs\n```\n\n*** Log buffering ***\n\nLogs can be buffered and never appear in the stream.\n\nIf you use the [print](https://docs.python.org/3/library/functions.html#print) method, you can force logs to be written to the console by sending them to the [stderr](https://docs.python.org/3/library/sys.html#sys.stderr) output or by using the `flush` option.\n\nIf you use the [logging](https://docs.python.org/3/library/logging.html) module, only logs starting at the `WARNING` level will be displayed by default. Otherwise, update the [logging level](https://docs.python.org/3/library/logging.html#logging.Logger.setLevel) module to the required level.\n\n## Configuration file: `.weblodge.json`\n\nAt the end of a deployment, **WebLodge** creates a file named `.weblodge.json` by default.\nThis file contains the previous configuration, enabling **WebLodge** to update your application with the same parameters. This file can be version-controlled and used in your Continuous Deployment.\n\nYou can change the name of this file with the `--config-file` option.\n\nExample:\n```\nweblodge build --config-file myconfigfile.json\n```\n\n## Manage your WebLodge-deployed application\n\nManaging and updating is a daily infrastructure task with no visible value for the end user.\n**WebLodge** uses an Azure [Platform as a Service](https://azure.microsoft.com/en-in/resources/cloud-computing-dictionary/what-is-paas/)\nresource named [Azure App Service](https://learn.microsoft.com/en-us/azure/app-service/)\nto keep your infrastructure as secure, up-to-date and reliable as possible.\nThis tool keeps your infrastructure at the state-of-the-art, allowing you to focus on your application's functionality.\n\nBut whatever your infrastructure tools are, it's your responsibility to keep your application secure and your dependencies up-to-date.\n\n## Feedbacks\n\nFeel free to create issues with bugs, ideas and any constructive feedback.\n\nMIT License\n\nCopyright (c) 2023 Vuillemot Florian\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A simple command line aiming to provide anyone with deployment and cloud management capabilities.",
    "version": "0.6.1",
    "project_urls": {
        "Homepage": "https://github.com/florian-vuillemot/weblodge",
        "Repository": "https://github.com/florian-vuillemot/weblodge"
    },
    "split_keywords": [
        "deployment",
        "azure"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f791f9fd101c973e3be6a7007a1627bad27f1f77aba1779709b9e189a5e57736",
                "md5": "83dc8a13323506d2c691837bcc5295d6",
                "sha256": "c466ad9a21effaeb62ff16dad60bfa7c5383f96548092f132f2d3701598890b3"
            },
            "downloads": -1,
            "filename": "weblodge-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "83dc8a13323506d2c691837bcc5295d6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<3.12",
            "size": 40748,
            "upload_time": "2023-10-10T06:52:49",
            "upload_time_iso_8601": "2023-10-10T06:52:49.515094Z",
            "url": "https://files.pythonhosted.org/packages/f7/91/f9fd101c973e3be6a7007a1627bad27f1f77aba1779709b9e189a5e57736/weblodge-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9561a02217f930036e54fd0a4e3272697f7926c3036742833bba41a7372eff8d",
                "md5": "ea66c8eaf1392b437d997f1054ed5e79",
                "sha256": "eefe3bde579d9466236d5fa60aa5f8cbbe97f38b2df15d52b41ba9ff34b0633b"
            },
            "downloads": -1,
            "filename": "weblodge-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ea66c8eaf1392b437d997f1054ed5e79",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<3.12",
            "size": 30053,
            "upload_time": "2023-10-10T06:52:52",
            "upload_time_iso_8601": "2023-10-10T06:52:52.435540Z",
            "url": "https://files.pythonhosted.org/packages/95/61/a02217f930036e54fd0a4e3272697f7926c3036742833bba41a7372eff8d/weblodge-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-10 06:52:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "florian-vuillemot",
    "github_project": "weblodge",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "weblodge"
}
        
Elapsed time: 0.14117s