Skip to content

Commit

Permalink
Merge pull request #36 from al4/master
Browse files Browse the repository at this point in the history
Support for Python3, fix for /versions, bump to 0.2 and more
  • Loading branch information
al4 authored Jun 17, 2016
2 parents fd6fd8a + 1cb59cc commit 7c0ae2f
Show file tree
Hide file tree
Showing 41 changed files with 729 additions and 290 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ orlo/_version.py
.vagrant
*.swp
*.deb

# OSX
.DS_Store
27 changes: 15 additions & 12 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Vagrant.configure(2) do |config|

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64"
config.vm.box = "ubuntu/xenial64"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
Expand All @@ -38,6 +38,7 @@ Vagrant.configure(2) do |config|
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
Expand Down Expand Up @@ -70,6 +71,9 @@ Vagrant.configure(2) do |config|
# sudo apt-get install -y apache2
# SHELL
config.vm.provision "shell", inline: <<-SHELL
# ubuntu 16.04 fix see https://github.com/mitchellh/vagrant/issues/7288
echo 127.0.0.1 `hostname` |sudo tee -a /etc/hosts
# sudo sed -i 's/archive.ubuntu.com/nl.archive.ubuntu.com/g' /etc/apt/sources.list
apt-get update
apt-get -y install python-pip python-dev postgresql postgresql-server-dev-all
Expand All @@ -80,32 +84,31 @@ Vagrant.configure(2) do |config|
apt-get install -y python-dev libldap2-dev libsasl2-dev libssl-dev
# Build tools
apt-get -y install build-essential git-buildpackage debhelper python-dev dh-systemd python-virtualenv
apt-get -y install build-essential git-buildpackage debhelper python-dev \
python3-dev dh-systemd python-virtualenv
wget -P /tmp/ \
'https://launchpad.net/ubuntu/+archive/primary/+files/dh-virtualenv_0.11-1_all.deb'
dpkg -i /tmp/dh-virtualenv_0.11-1_all.deb
apt-get -f install -y
pip install --upgrade pip
pip install virtualenv
pip install --upgrade pip setuptools
pip install --upgrade virtualenv
# Virtualenv is to avoid conflict with Debian's python-six
virtualenv /home/vagrant/virtualenv/orlo
source /home/vagrant/virtualenv/orlo/bin/activate
echo "source ~/virtualenv/orlo/bin/activate" >> /home/vagrant/.profile
virtualenv /home/ubuntu/virtualenv/orlo
source /home/ubuntu/virtualenv/orlo/bin/activate
echo "source ~/virtualenv/orlo/bin/activate" >> /home/ubuntu/.profile
pip install -r /vagrant/requirements.txt
pip install -r /vagrant/requirements_testing.txt
pip install -r /vagrant/docs/requirements.txt
# Flask-Testing hasn't been released to pip in ages :(
pip install --upgrade git+https://github.com/jarus/flask-testing.git
sudo chown -R vagrant:vagrant /home/vagrant/virtualenv
sudo chown -R ubuntu:ubuntu /home/ubuntu/virtualenv
# Create the database
python /vagrant/create_db.py
python /vagrant/setup.py develop
mkdir /etc/orlo
chown vagrant:root /etc/orlo
chown ubuntu:root /etc/orlo
SHELL
end
File renamed without changes.
98 changes: 98 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,101 @@
orlo (0.2.0.pre5) UNRELEASED; urgency=medium

[ Alex Forbes ]
* Add dependant python virtualenv package to Vagrantfile
* Add outline for Deploy process
* Use release object instead of re-declaring, add live server test

[ Ivan Coppa ]
* Support for Release metadata attributes, Deploy endpoint
* disabling debug

[ Alex Forbes ]
* Add integrated dummy deployer test
* Use relative path for deployer.rb

[ Marcel Kuiper ]
* Added POC for Token based AUthentication

[ Ivan Coppa ]
* enable deploy api call

[ Marcel Kuiper ]
* processed flake8 recommendations on user_auth.py

[ ivancoppa ]
* create base data

[ Alex Forbes ]
* Add last minute changes to create script
* Add last minute hacks to make everything work
* Add orlo_release to deployer env
* Create configuration for auth +
* Make URL a parameter for auth tests
* Only apply login_required when security is enabled
* Rename test classes to start with "Test"
* Move auth config into setup/teardown
* Add root page, test fixes
* Skip deploy test for now
* Move route_api to route_releases, rename metadatas => metadata
* Make token lifetime configurable, update orlo.ini with new options
* Bump version of Flask-HTTPAuth
* Add status code to OrloAuthError and add OrloConfigError
* Remove login_handler in favour or separate TokenAuth module
* Seperate token auth from http basic auth
* Only require auth when configured
* Implement deployer.py test deployer script
* Bump orloclient version, use py.test for travis
* Add pytz to requirements.txt
* Add requirements_testing.txt
* Move pytest to requirements_testing
* Use /bin/true in deploy shell test

[ Dustin Nguyen ]
* Added ldap auth
* Added ldap mock test

[ Alex Forbes ]
* Misc changes to deploy
* Tidy up example deployer
* Bump to pre-release 0.2
* Tidy comments in example deployer
* Use absolute path for version file
* Use orlo.cli as entry point instead of custom script
* Update Vagrantfile
* Fix silly bug, read config from file after set
* Move debian packaging files in to debian dir
* Explicitly set synced_folder to virtualbox provider
* [lintian] fix description
* Add /version url and test
* Add --version option to command line
* Handle getting an invalid release id gracefully
* Reduce test verbosity by disabling debug and removing prints
* [debian] Add prerm script to stop service
* Separate post_releases_start and post_releases_deploy
* Log output of deploy
* Use json.dumps instead of str() for reliable conversion
* Return output of deploy to client
* Add .DS_Store to gitignore
* Add payload of arguments to error
* Add configuration to documentation
* Break out ExecStart command into multiple lines for clarity
* Add note to test_auth file
* Make config file configurable by environment variable
* Include logger name in logs
* Update requirements for py3, use >= where possible
* Remove indirect dependencies
* Update Vagrantfile to Ubuntu Xenial
* Remove indirect imports
* [py3] fix import errors
* Fix tests to run under python3
* Fix for python2 again
* Add own fork of flask-testing
* Fix /versions sometimes returning wrong version

[ Ubuntu ]

-- Alex Forbes <[email protected]> Thu, 14 Apr 2016 16:17:34 +0000

orlo (0.1.1) stable; urgency=medium

* Cast package_rollback as a boolean
Expand Down
8 changes: 5 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ Build-Depends: debhelper (>= 9), python, dh-virtualenv, gcc, python-dev, postgre
Standards-Version: 3.9.5

Package: orlo
Architecture: all
Depends: ${python:Depends}, ${misc:Depends}
Description: An API for tracking deployments, written with Python, Flask and SqlAlchemy.
Architecture: amd64
Depends: ${misc:Depends}
Description: API for tracking deployments
Written with Python, Flask and SQLAlchemy
See http://orlo.readthedocs.org/en/latest/


4 changes: 2 additions & 2 deletions debian/install
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
bin/orlo usr/bin
debian/bin/orlo usr/bin
etc/orlo.ini /etc/orlo
systemd/orlo.service /lib/systemd/system
debian/systemd/orlo.service /lib/systemd/system
19 changes: 19 additions & 0 deletions debian/orlo.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Obviously, many of these are legitimate packaging problems and should be resolved.
# Most though, are by virtue of dh-virtualenv
#
orlo binary: wrong-path-for-interpreter
# Python is packaged in:
orlo binary: python-script-but-no-python-dep
# Several pip packages cause this:
orlo binary: executable-not-elf-or-script
orlo binary: souce-is-missing docs/
# Werkzeug, sphinx:
orlo binary: embedded-javascript-library
orlo binary: package-installs-python-egg usr/share/python/orlo/lib/python2.7/site-packages/flask/testsuite/test_apps/lib/python2.5/site-packages/SiteEgg.egg

# Binary files within the virtualenv:
orlo binary: arch-dependent-file-in-usr-share usr/share/python/orlo/bin/python
orlo binary: arch-dependent-file-in-usr-share usr/share/python/orlo/lib/python2.7/site-packages/_ldap.so

# Can't be overridden, would be nice if dh-virtualenv handled this
orlo binary: package-installs-python-bytecode
2 changes: 2 additions & 0 deletions debian/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ touch /var/log/orlo/app.log
chown -R orlo:orlo /var/{lib,log}/orlo
chmod 755 /var/{lib,log}/orlo
chmod 664 /var/log/orlo/app.log

#DEBHELPER#
3 changes: 3 additions & 0 deletions debian/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

systemctl stop orlo.service
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
dh $@ --with systemd --with python-virtualenv

override_dh_virtualenv:
dh_virtualenv --no-test
dh_virtualenv --no-test --python /usr/bin/python
1 change: 1 addition & 0 deletions debian/source.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
orlo source: source-is-missing docs/*
21 changes: 21 additions & 0 deletions debian/systemd/orlo.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Systemd unit file for orlo

[Unit]
Description=orlo
After=network.target
ConditionPathExists=/usr/share/python/orlo/bin/gunicorn

[Service]
Type=simple
User=orlo
Group=orlo
ExecStart=/usr/share/python/orlo/bin/gunicorn \
-w 4 -b 127.0.0.1:8080 \
--access-logfile /var/log/orlo/gunicorn-access.log \
--log-level debug \
--error-logfile /var/log/orlo/gunicorn-error.log \
--log-file /var/log/orlo/gunicorn.log \
orlo:app

[Install]
WantedBy=multi-user.target
70 changes: 70 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Configuration
=============

[main]
``````

:debug_mode: `true` or `false`. Default `false`. Enables Flask's debug mode.
:propagate_exceptions: `true` or `false`. Default `true`. Sets
'PROPAGATE_EXCEPTIONS` in Flask. See
`Flask documentation <http://flask.pocoo.org/docs/0.10/config/#builtin-configuration-values>`_
for details.
:time_format: A `strftime <https://docs.python.org/2/library/time.html#time.strftime>`_
string. Default `%Y-%m-%dT%H:%M:%SZ`.
:time_zone: Local time zone, as understood by pytz. Internally,
all timestamps are stored in UTC. The timestamp is interpreted by Arrow when
timestamps are given by the user (e.g. on recording a release), this
setting merely reflects what time zone is given back to GET requests.
Default `UTC`.
:strict_slashes: `true` or `false`. Default `false`. By default, Werkzeug
(what Flask uses underneath), will automatically "handle" trailing slashes,
with the result that /foo/ and /foo are the same url. This disables that
behaviour. It is recommended that you leave this set to false. See the
`Werkzeug documentation <http://werkzeug.pocoo.org/docs/0.11/routing/#maps-rules-and-adapters>`_
for more information.
:base_url: The external url which points to your web app. Required for
callbacks. Default `http://localhost:8080`.

[security]
``````````

:enabled: `true` or `false`. Enables security.
:passwd_file: Path to a `htpasswd <https://httpd.apache.org/docs/2.2/programs/htpasswd.html>`_
file to use for authentication.
:secret_key: A secret key to use for token encryption. Default `change_me`.
If security is enabled and this is still set to `change_me`, Orlo will
refuse to start.
:token_ttl: The length of times that tokens should live for in seconds.
Tokens automatically expire after this. Default `3600`.
:ldap_server: Ldap server to use for ldap requests. Default `localhost
.localdomain`
:ldap_port: Ldap port to use for ldap requests. Default `389`.
:user_base_dn: Ldap dn in which to search for users. Default `ou=people,
ou=example,ou=test`


[db]
````

:uri: Database uri for SQLAlchemy. See `Flask-SQLAlchemy <http://flask-sqlalchemy.pocoo.org/2.1/config/?highlight=sqlalchemy_database_uri>`_
docs for details. Default `postgres://orlo:password@localhost:5432/orlo`
:echo_queries: Whether or not to echo sql queries to log. Default `false`.

[logging]
`````````

:level: Logging level, valid values `debug`, `info`, `warning`, `error`.
Default `info`.
:file: Log file to use. If not set, logging only goes to stdout.

[deploy]
````````

:timeout: How long to wait for the deploy script to complete in seconds. If it
does not complete within this time, the deploy is considered failed and
an exception is raised. Default `3600`.

[deploy_shell]
``````````````

:command_path: Path to the deployment script. Defaults to Orlo's test deployer.
7 changes: 4 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
contain the root `toctree` directive.
Orlo
======
====

Orlo is an API for tracking deployments, written with Python, Flask and SqlAlchemy.

Expand All @@ -18,11 +18,12 @@ Contents
:maxdepth: 2

install
config
rest


About Orlo
------------
----------

Orlo aims to cover the needs of all eCG platforms with respect to gathering information about deployments, while being simple to integrate with existing deployment software and scripts. This currently includes:

Expand All @@ -39,7 +40,7 @@ With this information, it will be possible to build dashboards and more intellig
The API should also be agnostic to release process, server container or packaging format - all platforms do things differently. It should be forgiving and "do the right thing" in the case of missing data, as not all platforms will use every field.

Why "orlo"?
-------------
-----------

Originally this project was called "Sponge", because sponges are absorbent. But it turns out that name was already in use on readthedocs.org, so it was renamed. In English, orlo means "a plinth supporting the base of a column".

Expand Down
Loading

0 comments on commit 7c0ae2f

Please sign in to comment.