Skip to content

Commit

Permalink
[improvement] Add options in makefile + documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
atb00ker committed Jul 20, 2019
1 parent f1d1ca6 commit 48dc91d
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 14 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ jobs:
include:
- stage: tests
script:
- echo "127.0.0.1 dashboard.openwisp.org controller.openwisp.org radius.openwisp.org topology.openwisp.org" | sudo tee -a /etc/hosts
- make compose-build
- make runtests
- make travis-runtests
56 changes: 48 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Makefile to create all the docker-images
# Find documentation in README.md under
# the heading "Makefile Options".

SHELL := /bin/bash

default: compose-build

# Build
compose-build: build-base
docker-compose build
python build.py default-secret-key
python-build: build.py
python build.py change-secret-key

build-base: python-build-script
build-base:
docker build --tag openwisp/openwisp-base:intermedia-system \
--file ./build/openwisp_base/Dockerfile \
--target SYSTEM ./build/
Expand All @@ -17,11 +19,49 @@ build-base: python-build-script
docker build --tag openwisp/openwisp-base:latest \
--file ./build/openwisp_base/Dockerfile ./build/

python-build-script: build.py
python build.py change-secret-key
compose-build: python-build build-base
docker-compose build --parallel
python build.py default-secret-key

publish-build: build-base
docker-compose build --parallel

# Test
runtests:
runtests: develop-runtests
docker-compose stop

develop-runtests: publish-build
docker-compose up -d
source ./tests/tests.sh && init_dashoard_tests

travis-runtests: publish-build
docker-compose up -d
echo "127.0.0.1 dashboard.openwisp.org controller.openwisp.org" \
"radius.openwisp.org topology.openwisp.org" | sudo tee -a /etc/hosts
source ./tests/tests.sh && init_dashoard_tests logs

# Development
develop: publish-build
docker-compose up -d
docker-compose logs -f

# Clean
clean:
docker-compose stop
docker-compose down --remove-orphans --volumes --rmi all
docker-compose rm -svf
docker rmi --force openwisp/openwisp-base:latest \
openwisp/openwisp-base:intermedia-system \
openwisp/openwisp-base:intermedia-python \
`docker images -f "dangling=true" -q` || true

# Publish
publish: publish-build develop-runtests
docker push openwisp/openwisp-base:latest
docker push openwisp/openwisp-nginx:latest
docker push openwisp/openwisp-dashboard:latest
docker push openwisp/openwisp-radius:latest
docker push openwisp/openwisp-controller:latest
docker push openwisp/openwisp-topology:latest
docker push openwisp/openwisp-websocket:latest
docker push openwisp/openwisp-postfix:latest
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ Note:
Guide to build images again with modification or with different environment variables.

1. Install docker-compose.
2. In the root of the repository, run `make`.
3. Run `docker-compose up`, when the containers are ready, you can test them out by going to the domain name of the modules.
2. In the root of the repository, run `make develop`, when the containers are ready, you can test them out by going to the domain name of the modules.

Now you'll need to do steps (2) and (3) everytime you make a changes and want to build the images again. Consider using `docker-compose up -d` that may save you sometime if you need to build a container again and again.
Now you'll need to do steps (2) everytime you make a changes and want to build the images again.

**Note:**
- Default username & password are `admin`.
Expand All @@ -142,3 +141,19 @@ To disable an openwisp service container and plug your own service like database
- Change the [email configuration variables](docs/ENV.md) to point to your instances.
- openwisp-nginx:
- Configurations in `build/openwisp_nginx/` are helpful to replicate in your own instance.

# Makefile Options

**Right now, this is only tentative guide. Errata may exist. Please report errors on the [gitter channel](https://gitter.im/openwisp/general).**

The Makefile has following options, that are useful for developers & users. Default action is `compose-build`.

- `build-base`: Build openwisp-base image. It is the base image used in other images. It takes the most time to build.
- `compose-build`: Build the openwisp images. This option must be used in most usecases, example when a user is building custom images.
- `publish-build`: Similar to `compose-build` except the produced can be used for manually testing before publishing official images and publishing the official images using the `publish` option.
- `runtests`: Run testcases to ensure all the services are working.
- `develop-runtests`: Similar to `runtests`, it runs the testcases except doesn't stop the containers after running the tests which maybe desired for debugging & analyzing failing container's logs.
- `travis-runtests`: Similar to `runtests`, it runs the testcases except used in travis builds because it doesn't clean up after running the tests and prints all the container's logs when an error occurs in the tests.
- `clean`: Purge everything produced during building the images.
- `develop`: Useful for development. Bundles all the commands required to build the images and run containers during development. With this option, you can interact with the interface and APIs and the logs will be printed on the terminal for debugging on the debugging level you select from the `.env` file.
- `publish`: Build, test and publish the latest Official images.
1 change: 1 addition & 0 deletions build/openwisp_radius/module_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
DJANGO_FREERADIUS_RADIUSPOSTAUTH_MODEL = 'openwisp_radius.RadiusPostAuth'
DJANGO_FREERADIUS_RADIUSBATCH_MODEL = 'openwisp_radius.RadiusBatch'
DJANGO_FREERADIUS_RADIUSGROUP_MODEL = 'openwisp_radius.RadiusGroup'
DJANGO_FREERADIUS_RADIUSTOKEN_MODEL = 'openwisp_radius.RadiusToken'

SOCIALACCOUNT_PROVIDERS = {
'facebook': {
Expand Down

0 comments on commit 48dc91d

Please sign in to comment.