Package: weblodge
WebLodgeWebLodgeis a command line aiming to provide anyone with deployment and cloud management capabilities.Full documentationhere.PrerequisitesInstall the command line withpip install weblodge.A PythonFlaskapplication.Arequirements.txtwith the application dependencies.Have anAzure account.Note: By default,WebLodgeusesFree(or almost free)Azure servicesand lets the user specify non-free configurations.Note: Today,WebLodgeis only available forFlaskapplications.Deploying an applicationThe simple way to deploy your local application is by running the command lineweblodge deploy --buildin your application directory.In that case,WebLodgewill assume that your application entry point is namedapp.pyand your dependencies file isrequirements.txt.Behind the scene,WebLodgebuildthendeployyour application.Application structureWebLodgeis 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 withweblodge 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 firstbuildit and specify:The entry point file:main.py.TheFlaskapplication:my_app.# Build the application.
weblodge build --entry-point main.py --flask-app my_app
# Deploy the application.
weblodge deployBuildThebuildoperation collects and prepares the application for deployment on a specific platform.Thebuildoperation can handle the following options:Option nameDescriptionDefault valuesrcFolder containing application sources..distFolder containing the application built.distentry-pointThe application file to be executed withpython.app.pyflask-appThe Flask application object in theentry-pointfile.apprequirementsTherequirements.txtfile path of the application. Ignores if arequirements.txtfile is located at the root of the application.requirements.txtNote: Here, the platform is implicitlyAzure App Service.Example:# Build the local application.
weblodge build

# Build the application in the 'myapp' folder.
weblodge build --src myappDeployThedeployoperation creates the necessary infrastructure and uploads the build package - i.e. your code - on the infrastructure.Option nameDescriptionDefault valuesubdomainThe subdomain of the application on the Internet:<subdomain>.azurewebsites.net. Randomly generated if not provided.<randomly generated>skuThe applicationcomputational power.F1locationThe physical application location.northeuropeenvironmentThe environment of your application.productiondistFolder containing the application built.distExample:# Deploy the local application.
weblodge deploy

# Deploy the local application with a custom subdomain.
weblodge deploy --subdomain myappℹ️ NoteWebLodge considers thesubdomainas the application name.DeleteThedeleteoperation deletes the infrastructure deployed but keeps the build.Option nameDescriptionDefault valuesubdomainThe subdomain of the application to be deleted.<my-subdomain>yesDo not prompt a validation message before deletion.falseExample:# Delete the application previously deployed.
weblodge deleteLogsThelogsoperation streams your application logs. Because it is a stream, logs are truncated.Option nameDescriptionDefault valuesubdomainThe 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 theprintmethod, you can force logs to be written to the console by sending them to thestderroutput or by using theflushoption.If you use theloggingmodule, only logs starting at theWARNINGlevel will be displayed by default. Otherwise, update thelogging levelmodule to the required level.Configuration file:.weblodge.jsonAt the end of a deployment,WebLodgecreates a file named.weblodge.jsonby default.
This file contains the previous configuration, enablingWebLodgeto 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-fileoption.Example:weblodge build --config-file myconfigfile.jsonManage your WebLodge-deployed applicationManaging and updating is a daily infrastructure task with no visible value for the end user.WebLodgeuses an AzurePlatform as a Serviceresource namedAzure App Serviceto 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.FeedbacksFeel free to create issues with bugs, ideas and any constructive feedback.MIT LicenseCopyright (c) 2023 Vuillemot FlorianPermission 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.