GithubHelp home page GithubHelp logo

foreman's Introduction

Masonite Foreman

Still under development. This project currently only works with Macs. Windows and Linux support coming soon.

Build Python Version Downloads License Coverage

Requirements:

  • Python 3.6 +
  • Mac

Introduction

Masonite foreman is a way to automatically serve all (or some) of your python applications without needing to worry about activating virtual environments and running serve commands.

You can register a directory where your python projects live and all Python projects in that directory will be served under a {your app}.test domain. The .test tld can be changed.

Getting Started

First install Masonite foreman using the terminal.

$ pip3 install masonite-foreman --user

Make sure you use your python3 pip installation.

Once pip installed you will need to run the install commands:

$ foreman install

This will add a few required packages by brew installing them.

Registering Directories

One of the powerful features of Foreman is allowing you to register entire directories. Python applications will be found inside the directory and be served automatically.

Let's take a directory structure like this:

~/sites/
    app1/
        .. Masonite application ..
    app2/
        .. Masonite application ..
    app3/
        .. Django application ..

You can go to this directory and register it:

$ cd ~/sites
$ foreman register

This will register that directory and immediately start serving all python applications under that {app}.test domain:

You can then go to app1.test, app2.test and app3.test and see your applications. This is all done without needing to run each server.

This will also detect changes in your application as well so no needing to wait to reload the server.

Starting Applications

When you first start your system up you can run all the applications inside registered directories again by running:

$ foreman start

Starting Individual Applications

Sometimes you will not want to run all applicatons but just the ones you want to work on. You can do this by going to your application and running the start . command:

$ cd ~/sites/app1
$ foreman start .

This will only serve that application at app1.test but not any other apps.

Registering Virtual Environments

Foreman will do its best to detect the virtual environment if it is inside the project directory but virtual environments can be literally anywhere.

If your virtual environment is not inside your project directory you can register it specifically.

First activate your virtual environment and thn run the virtual environment register command.

$ cd ~/sites/app1
$ source /virtualenvs/app1/bin/activate
$ foreman venv:register

This will register that virtual environment with that application with foreman. Then you can start that project:

$ foreman start .

Deregister Directories

Just like registering directories you can register them as well:

$ foreman deregister

foreman's People

Contributors

deepsourcebot avatar josephmancuso avatar lazyguru avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

foreman's Issues

Coverage report on build is broken

The test coverage report on builds is broken. It needs to have the following added to the workflow config:

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

However, the coverage is also being reported wrong.

Add a "default" driver

If we can't determine what driver to use, we should fallback to a default one (Maybe this is Masonite? Or should it be something else?)

Need to better handle brew package upgrades

When running foreman install and a package (eg Nginx) is already installed but with an outdated version, the following occurs:

Installing NGINX ..
==> Downloading https://homebrew.bintray.com/bottles/nginx-1.19.5.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/aff0c071bc1b2e8e84e0dd99ffe01a6a29fc6fc933372099bb2aa55d312
######################################################################## 100.0%
Error: nginx 1.19.4 is already installed
To upgrade to 1.19.5, run `brew upgrade nginx`.

  CalledProcessError

  Command '['/usr/local/bin/brew', 'install', 'nginx']' returned non-zero exit status 1.

  at ~/.pyenv/versions/3.7.9/lib/python3.7/subprocess.py:512 in run
       508│             raise
       509│         retcode = process.poll()
       510│         if check and retcode:
       511│             raise CalledProcessError(retcode, process.args,
    →  512│                                      output=stdout, stderr=stderr)
       513│     return CompletedProcess(process.args, retcode, stdout, stderr)
       514│
       515│
       516│ def list2cmdline(seq):

We should handle this more gracefully

Don't overwrite Nginx config

It should not be needed to completely overwrite the nginx config file. We should be able to just patch it or add our configuration in a non-destructive way

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.