Skip to content

Commit

Permalink
minimal phoenix with keycloak support (#210)
Browse files Browse the repository at this point in the history
* minimal phoenix with keycloak support
  • Loading branch information
cehbrecht authored Feb 4, 2020
1 parent 1fd0754 commit 622ca05
Show file tree
Hide file tree
Showing 195 changed files with 757 additions and 4,162 deletions.
8 changes: 0 additions & 8 deletions .docker.cfg

This file was deleted.

2 changes: 0 additions & 2 deletions .dockerignore

This file was deleted.

41 changes: 0 additions & 41 deletions .editorconfig

This file was deleted.

5 changes: 0 additions & 5 deletions .env

This file was deleted.

14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ python:
#- "3.7"
sudo: false
install:
# Python 3.x is default
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
# Prepare env with Python version
- conda create -n pyramid-phoenix python=$TRAVIS_PYTHON_VERSION
# Update now the env with our environment
- conda env update -f environment.yml
- source activate pyramid-phoenix
- make install
- make start
before_script:
Expand Down
48 changes: 0 additions & 48 deletions Dockerfile

This file was deleted.

144 changes: 10 additions & 134 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,12 @@
VERSION := 0.4.0

# Include custom config if it is available
-include Makefile.config

# Application
APP_ROOT := $(CURDIR)
APP_NAME := $(shell basename $(APP_ROOT))

# guess OS (Linux, Darwin, ...)
OS_NAME := $(shell uname -s 2>/dev/null || echo "unknown")
CPU_ARCH := $(shell uname -m 2>/dev/null || uname -p 2>/dev/null || echo "unknown")

# Python
SETUPTOOLS_VERSION := 41
CONDA_VERSION := 4.5
BUILDOUT_VERSION := 2.13.1

# Anaconda
ANACONDA_HOME ?= $(HOME)/anaconda
CONDA_ENV ?= $(APP_NAME)
CONDA_ENVS_DIR ?= $(HOME)/.conda/envs
CONDA_ENV_PATH := $(CONDA_ENVS_DIR)/$(CONDA_ENV)

# Configuration used by update-config
HOSTNAME ?= localhost
HTTP_PORT ?= 8094
OUTPUT_PORT ?= 8090

# choose anaconda installer depending on your OS
ANACONDA_URL = https://repo.continuum.io/miniconda
ifeq "$(OS_NAME)" "Linux"
FN := Miniconda3-latest-Linux-x86_64.sh
else ifeq "$(OS_NAME)" "Darwin"
FN := Miniconda3-latest-MacOSX-x86_64.sh
else
FN := unknown
endif

# Buildout files and folders
DOWNLOAD_CACHE := $(APP_ROOT)/downloads
BUILDOUT_FILES := parts eggs develop-eggs bin .installed.cfg .mr.developer.cfg *.egg-info bootstrap-buildout.py *.bak.* $(DOWNLOAD_CACHE)
Expand All @@ -53,25 +23,16 @@ help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " help to print this help message. (Default)"
@echo " version to print version number of this Makefile."
@echo " info to print information about $(APP_NAME)."
@echo " install to install $(APP_NAME) by running 'bin/buildout -c custom.cfg'."
@echo " sysinstall to install system packages from requirements.sh. You can also call 'bash requirements.sh' directly."
@echo " install to install app by running 'bin/buildout -c custom.cfg'."
@echo " update to update your application by running 'bin/buildout -o -c custom.cfg' (buildout offline mode)."
@echo " clean to delete all files that are created by running buildout."
@echo "\nTesting targets:"
@echo " test to run tests (but skip long running tests)."
@echo " testall to run all tests (including long running tests)."
@echo " pep8 to run pep8 code style checks."
@echo "\nSphinx targets:"
@echo " docs to generate HTML documentation with Sphinx."
@echo " linkcheck to check all external links in documentation for integrity."
@echo " doc8 to run doc8 documentation style checks."
@echo "\nSupporting targets:"
@echo " envclean to remove the conda enviroment $(CONDA_ENV)."
@echo " srcclean to remove all *.pyc files."
@echo " distclean to remove *all* files that are not controlled by 'git'. WARNING: use it *only* if you know what you do!"
@echo " passwd to generate password for 'phoenix-password' in custom.cfg."
@echo " export to export the conda environment. Caution! You always need to check it the enviroment.yml is working."
@echo "\nSupervisor targets:"
@echo " start to start supervisor service."
@echo " stop to stop supervisor service."
Expand All @@ -82,18 +43,6 @@ help:
version:
@echo "Version: $(VERSION)"

.PHONY: info
info:
@echo "Informations about your Bird:"
@echo " OS_NAME $(OS_NAME)"
@echo " CPU_ARCH $(CPU_ARCH)"
@echo " Anaconda Home $(ANACONDA_HOME)"
@echo " Conda Environment $(CONDA_ENV). Use \`source activate $(CONDA_ENV)' to activate it."
@echo " Conda Prefix $(CONDA_ENV_PATH)"
@echo " APP_NAME $(APP_NAME)"
@echo " APP_ROOT $(APP_ROOT)"
@echo " DOWNLOAD_CACHE $(DOWNLOAD_CACHE)"

## Helper targets ... ensure that Makefile etc are in place

.PHONY: backup
Expand All @@ -117,80 +66,31 @@ bootstrap-buildout.py:
@echo "Update buildout bootstrap-buildout.py ..."
@test -f boostrap-buildout.py || curl https://bootstrap.pypa.io/bootstrap-buildout.py --insecure --silent --output bootstrap-buildout.py

## Anaconda targets

.PHONY: anaconda
anaconda:
@echo "Installing Anaconda ..."
@test -d $(ANACONDA_HOME) || curl $(ANACONDA_URL)/$(FN) --silent --insecure --output "$(DOWNLOAD_CACHE)/$(FN)"
@test -d $(ANACONDA_HOME) || bash "$(DOWNLOAD_CACHE)/$(FN)" -b -p $(ANACONDA_HOME)
@echo "Add '$(ANACONDA_HOME)/bin' to your PATH variable in '.bashrc'."

.PHONY: conda_config
conda_config: anaconda
@echo "Update ~/.condarc"
@-"$(ANACONDA_HOME)/bin/conda" install -y conda=$(CONDA_VERSION) requests
@"$(ANACONDA_HOME)/bin/conda" config --add envs_dirs $(CONDA_ENVS_DIR)
@"$(ANACONDA_HOME)/bin/conda" config --set ssl_verify true
@"$(ANACONDA_HOME)/bin/conda" config --set channel_priority true
@"$(ANACONDA_HOME)/bin/conda" config --set auto_update_conda false
@"$(ANACONDA_HOME)/bin/conda" config --add channels defaults
@"$(ANACONDA_HOME)/bin/conda" config --append channels birdhouse
@"$(ANACONDA_HOME)/bin/conda" config --append channels conda-forge

.PHONY: conda_env
conda_env: anaconda conda_config
@echo "Update conda environment $(CONDA_ENV) ..."
@test -d $(CONDA_ENV_PATH) || "$(ANACONDA_HOME)/bin/conda" env create -n $(CONDA_ENV) -f environment.yml
"$(ANACONDA_HOME)/bin/conda" install -y -n $(CONDA_ENV) setuptools=$(SETUPTOOLS_VERSION)

.PHONY: export
export:
@echo "Exporting conda enviroment ..."
@test -d $(CONDA_ENV_PATH) && "$(ANACONDA_HOME)/bin/conda" env export -n $(CONDA_ENV) -f environment.yml

## Build targets

.PHONY: bootstrap
bootstrap: init conda_env bootstrap-buildout.py
bootstrap: init bootstrap-buildout.py
@echo "Bootstrap buildout ..."
@test -f bin/buildout || bash -c "source $(ANACONDA_HOME)/bin/activate $(CONDA_ENV);python bootstrap-buildout.py -c custom.cfg --allow-site-packages --setuptools-version=$(SETUPTOOLS_VERSION) --buildout-version=$(BUILDOUT_VERSION)"

.PHONY: sysinstall
sysinstall:
@echo "\nInstalling system packages for bootstrap ..."
@bash bootstrap.sh -i
@echo "\nInstalling system packages for your application ..."
@-test -f requirements.sh && bash requirements.sh
@test -f bin/buildout || bash -c "python bootstrap-buildout.py -c custom.cfg --allow-site-packages --setuptools-version=$(SETUPTOOLS_VERSION) --buildout-version=$(BUILDOUT_VERSION)"

.PHONY: install
install: bootstrap
@echo "Installing application with buildout ..."
@-bash -c "source $(ANACONDA_HOME)/bin/activate $(CONDA_ENV);bin/buildout buildout:anaconda-home=$(ANACONDA_HOME) -c custom.cfg"
@-bash -c "bin/buildout -c custom.cfg"
@echo "\nStart service with \`make start'"

.PHONY: update
update:
@echo "Update application config with buildout (offline mode) ..."
@-bash -c "source $(ANACONDA_HOME)/bin/activate $(CONDA_ENV);bin/buildout buildout:anaconda-home=$(ANACONDA_HOME) -o -c custom.cfg"

.PHONY: update-config
update-config:
@echo "Update application config with buildout (offline mode) and environment variables..."
@-bash -c "source $(ANACONDA_HOME)/bin/activate $(CONDA_ENV);bin/buildout buildout:anaconda-home=$(ANACONDA_HOME) settings:hostname=$(HOSTNAME) settings:output-port=$(OUTPUT_PORT) settings:http-port=$(HTTP_PORT) -o -c custom.cfg"
@-bash -c "bin/buildout -o -c custom.cfg"

.PHONY: clean
clean: srcclean envclean
clean: srcclean
@echo "Cleaning buildout files ..."
@-for i in $(BUILDOUT_FILES); do \
test -e $$i && rm -v -rf $$i; \
done

.PHONY: envclean
envclean: stop
@echo "Removing conda env $(CONDA_ENV)"
@-test -d $(CONDA_ENV_PATH) && "$(ANACONDA_HOME)/bin/conda" remove -n $(CONDA_ENV) --yes --all

.PHONY: srcclean
srcclean:
@echo "Removing *.pyc files ..."
Expand All @@ -200,46 +100,22 @@ srcclean:
distclean: backup clean
@echo "Cleaning distribution ..."
@git diff --quiet HEAD || echo "There are uncommited changes! Not doing 'git clean' ..."
@-git clean -dfx -e *.bak -e custom.cfg -e Makefile.config

.PHONY: passwd
passwd: custom.cfg
@echo "Generate Phoenix password ..."
@echo "Enter a password with at least 8 characters."
@bash -c "source $(ANACONDA_HOME)/bin/activate $(CONDA_ENV); python -c 'from IPython.lib import passwd; pw = passwd(algorithm=\"sha256\"); lines = [\"phoenix-password = \" + pw + \"\\n\" if line.startswith(\"phoenix-password\") else line for line in open(\"custom.cfg\", \"r\")]; file = open(\"custom.cfg\", \"w\"); file.writelines(lines); file.close()'"
@echo ""
@echo "Run \`make update restart' to activate this password."
@-git clean -dfx -e *.bak -e custom.cfg

.PHONY: test
test:
@echo "Running tests (skip slow and online tests) ..."
bash -c "source $(ANACONDA_HOME)/bin/activate $(CONDA_ENV); bin/py.test -v -m 'not slow and not online'"
bash -c "bin/py.test -v -m 'not slow and not online'"

.PHONY: testall
testall:
@echo "Running all tests (including slow and online tests) ..."
bash -c "source $(ANACONDA_HOME)/bin/activate $(CONDA_ENV); bin/py.test -v"
bash -c "bin/py.test -v"

.PHONY: pep8
pep8:
@echo "Running pep8 code style checks ..."
$(CONDA_ENV_PATH)/bin/flake8

.PHONY: docs
docs:
@echo "Generating docs with Sphinx ..."
$(MAKE) -C $@ clean html
@echo "open your browser: firefox docs/build/html/index.html"

.PHONY: linkcheck
linkcheck:
@echo "Run link checker on docs..."
$(MAKE) -C docs linkcheck

.PHONY: doc8
doc8:
@echo "Running doc8 doc style checks ..."
$(CONDA_ENV_PATH)/bin/doc8 docs/
flake8

## Supervisor targets

Expand Down
3 changes: 0 additions & 3 deletions Makefile.config.example

This file was deleted.

2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Phoenix (the bird)
*Phoenix is a long-lived bird that is cyclically regenerated or reborn.* (`Wikipedia <https://en.wikipedia.org/wiki/Phoenix_%28mythology%29>`_). [..]

Pyramid Phoenix is a web-application build with the Python web-framework `Pyramid <http://www.pylonsproject.org/>`_.
Phoenix makes it easy to interact with Web Processing Services (WPS).
Phoenix has a user-interface to interact with Web Processing Services (WPS).

For installation and configuration read the `documentation on ReadTheDocs <http://pyramid-phoenix.readthedocs.io/en/latest/index.html>`_.

Expand Down
Loading

0 comments on commit 622ca05

Please sign in to comment.