On Mon, Apr 06, 2020 at 10:56:09AM -0500, Federico Capoano wrote:
> I think it's time to invest in the automation of the initial setup of the
> development environment.
>
> Here's what I do.
Hi Federico,
this is a good idea. To continue the brainstorming, I'll describe what we
use here.
Our OWM (OpenWISP Manager) consists of the following pieces:
- a file 'modules':
contains a list of the names of all OpenWISP repositories and, for
each repository, the following shell variables
- URL of our fork of the repository
- URL of the upstream repository, for pull requests
- branch to use, e.g. master
- sha of the commit to use
- a Pipfile which installs local copies of the repositories in the modules
file, plus development packages and any additional packages
- a directory 'django' which contains:
- manage.py
- a directory 'openwisp2' with the files settings.py, urls.py, wsgi.py
and __init__.py
- a makefile with the following targets (commands):
- prepare: create a build directory, clone all repositories specified
in the modules file into build/sources - using the given URL, branch
and commit; copy Pipfile, manage.py and the directory 'openwisp2'
into build/
- build: with pipenv, create a virtual environment in the build/
directory, install the packages from the Pipfile and thus all deps;
with manage.py, do makemigrations, migrate and createsuperuser
- run: with manage.py, launch runserver using the given settings.py
and urls.py
- clean: remove the virtual environment, delete the build directory
- a directory 'scripts' with scripts which do the work:
- create directories, copy the files
- clone the repositories and add remotes "origin" and "pullrequest"
- create and install the virtual environment, create and fill the
database
- run the application
- remove virtual environment and build directory
To be able to easily handle customizations and pending pull requests, we
have another directory 'patches' with subdirectories for the various
OpenWISP repositories. It contains patches which get applied by
"make prepare", after the repositories have been cloned.
I'm looking forward to hear your thoughts about our dev environment.
Greetings,
Oliver