Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
acec5e7
Basic flask app, need to hup nginx and start a wsgi server in a minute.
joshuamckenty Apr 16, 2013
5a39a4a
Added reqs and a wsgi file, will deploy using uwsgi
joshuamckenty Apr 16, 2013
2c3dc52
Adding uwsgi config.
joshuamckenty Apr 16, 2013
de34f02
Don't run the app, let the wsgi layer do that.
joshuamckenty Apr 16, 2013
8bf5049
change to test uwsgi test.
joshuamckenty Apr 16, 2013
45435a3
Sudo required for uwsgi update.
joshuamckenty Apr 16, 2013
fa77e49
Adding toast css
joshuamckenty Apr 16, 2013
0597a56
A little more detail.
joshuamckenty Apr 17, 2013
222d82d
Adding sqlite db for the data store.
joshuamckenty Apr 17, 2013
2d09b9c
Run pip install from fabfile.
joshuamckenty Apr 17, 2013
cae89bd
Removing silly dead req.
joshuamckenty Apr 17, 2013
b34c800
Adding sql init to fabfile.
joshuamckenty Apr 17, 2013
4898b79
Moving schema.sql to the module.
joshuamckenty Apr 17, 2013
b3a450d
Adding sqlalchemy bindings and models.
joshuamckenty Apr 17, 2013
b74fb8c
Fixin spaces
joshuamckenty Apr 17, 2013
897d332
Ypto
joshuamckenty Apr 17, 2013
af3b586
Ypto
joshuamckenty Apr 17, 2013
0aaead5
Added schema migrations and an admin view
joshuamckenty Jun 30, 2013
212c260
Adding cloud model
joshuamckenty Jun 30, 2013
7786681
Merge fix
joshuamckenty Jun 30, 2013
e952ab5
Fixed requirements
joshuamckenty Jun 30, 2013
de82c74
Merge branch 'master' of github.com:joshuamckenty/refstack
joshuamckenty Jun 30, 2013
167fca6
fixed git reqs luine
joshuamckenty Jul 1, 2013
0063005
Removing postgres library req
joshuamckenty Jul 1, 2013
5e0630a
Fixin requirements versions again.
joshuamckenty Jul 1, 2013
f170d96
Adding Users model to alembic, and the openid templates.
joshuamckenty Jul 3, 2013
8e1ad97
Merge conflict in requirements.
joshuamckenty Jul 3, 2013
e5fb95f
Admin views are auth'd against the openid accounts.
joshuamckenty Jul 4, 2013
5a36a00
Go directly to launchpad, do not pass go.
joshuamckenty Jul 4, 2013
80cd5d7
Freeze pip reqs.
joshuamckenty Sep 3, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ nosetests.xml
.mr.developer.cfg
.project
.pydevproject

*.db
*.DS_Store
manifest.yml
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn refstack.web:app
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ Vendor-facing API for registration of interop-compliance endpoints and credentia
Running at http://refstack.org
See (living) documentation at https://etherpad.openstack.org/RefStackBlueprint

http://ci.openstack.org/stackforge.html
http://ci.openstack.org/devstack-gate.html
https://github.com/openstack-infra/config/
http://pythonhosted.org/WSME/index.html
50 changes: 50 additions & 0 deletions alembic.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# A generic, single database configuration.

[alembic]
# path to migration scripts
script_location = alembic

# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s

# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false

sqlalchemy.url = driver://user:pass@localhost/dbname


# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = WARN
handlers = console
qualname =

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine

[logger_alembic]
level = INFO
handlers =
qualname = alembic

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
1 change: 1 addition & 0 deletions alembic/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Generic single-database configuration.
79 changes: 79 additions & 0 deletions alembic/env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
from __future__ import with_statement

import os
import sys
sys.path.append("./")


from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
from refstack.web import app

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
cur_db_uri = config.get_section_option('alembic', 'sqlalchemy.url')
my_db_uri = app.config.get('SQLALCHEMY_DATABASE_URI', cur_db_uri)
config.set_section_option('alembic', 'sqlalchemy.url', my_db_uri)

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
# target_metadata = None
from refstack.web import db
target_metadata = db.metadata


def run_migrations_offline():
"""Run migrations in 'offline' mode.

This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.

Calls to context.execute() here emit the given string to the
script output.

"""
url = config.get_main_option("sqlalchemy.url")
context.configure(url=url)

with context.begin_transaction():
context.run_migrations()

def run_migrations_online():
"""Run migrations in 'online' mode.

In this scenario we need to create an Engine
and associate a connection with the context.

"""
engine = engine_from_config(
config.get_section(config.config_ini_section),
prefix='sqlalchemy.',
poolclass=pool.NullPool)

connection = engine.connect()
context.configure(
connection=connection,
target_metadata=target_metadata
)

try:
with context.begin_transaction():
context.run_migrations()
finally:
connection.close()

if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()

22 changes: 22 additions & 0 deletions alembic/script.py.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""${message}

Revision ID: ${up_revision}
Revises: ${down_revision}
Create Date: ${create_date}

"""

# revision identifiers, used by Alembic.
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}

from alembic import op
import sqlalchemy as sa
${imports if imports else ""}

def upgrade():
${upgrades if upgrades else "pass"}


def downgrade():
${downgrades if downgrades else "pass"}
33 changes: 33 additions & 0 deletions alembic/versions/2e26571834ea_first_step.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""First step

Revision ID: 2e26571834ea
Revises: None
Create Date: 2013-06-30 15:07:31.746984

"""

# revision identifiers, used by Alembic.
revision = '2e26571834ea'
down_revision = None

from alembic import op
import sqlalchemy as sa


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('vendor',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('vendor_name', sa.String(length=80), nullable=True),
sa.Column('contact_email', sa.String(length=120), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('contact_email'),
sa.UniqueConstraint('vendor_name')
)
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table('vendor')
### end Alembic commands ###
52 changes: 52 additions & 0 deletions alembic/versions/40d4c6d389ec_adding_cloud_and_use.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""Adding Cloud and User models

Revision ID: 40d4c6d389ec
Revises: 2e26571834ea
Create Date: 2013-07-02 15:02:46.951119

"""

# revision identifiers, used by Alembic.
revision = '40d4c6d389ec'
down_revision = '2e26571834ea'

from alembic import op
import sqlalchemy as sa


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('user',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=60), nullable=True),
sa.Column('email', sa.String(length=200), nullable=True),
sa.Column('openid', sa.String(length=200), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('openid')
)
op.create_table('cloud',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('vendor_id', sa.Integer(), nullable=True),
sa.Column('endpoint', sa.String(length=120), nullable=True),
sa.Column('test_user', sa.String(length=80), nullable=True),
sa.Column('test_key', sa.String(length=80), nullable=True),
sa.Column('admin_endpoint', sa.String(length=120), nullable=True),
sa.Column('admin_user', sa.String(length=80), nullable=True),
sa.Column('admin_key', sa.String(length=80), nullable=True),
sa.ForeignKeyConstraint(['vendor_id'], ['vendor.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('admin_endpoint'),
sa.UniqueConstraint('admin_key'),
sa.UniqueConstraint('admin_user'),
sa.UniqueConstraint('endpoint'),
sa.UniqueConstraint('test_key'),
sa.UniqueConstraint('test_user')
)
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table('cloud')
op.drop_table('user')
### end Alembic commands ###
23 changes: 23 additions & 0 deletions fabfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from fabric.api import env, roles, run, cd

# Define sets of servers as roles
env.roledefs = {
'web': ['refstack.org'],
}

# Set the user to use for ssh
env.user = 'refstack'

@roles('web')
def get_version():
run('cat /etc/issue')


@roles('web')
def deploy():
with cd('/var/www/refstack'):
run('git checkout master')
run('git pull')
run('sudo pip install -r requirements.txt')
run('alembic upgrade head')
run('sudo uwsgi --reload /tmp/project-master_refstack.pid')
3 changes: 3 additions & 0 deletions refstack.wsgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import os
# os.environ['YOURAPPLICATION_CONFIG'] = '/var/www/yourapplication/application.cfg'
from refstack import web
Empty file added refstack/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions refstack/runserver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from web import app

app.run()
3 changes: 3 additions & 0 deletions refstack/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE TABLE IF NOT EXISTS VENDORS
( vendor_id integer primary key asc autoincrement,
vendor_name TEXT NOT NULL);
Binary file added refstack/static/openid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions refstack/static/refstack.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
body {
font-family: 'Georgia', serif;
font-size: 16px;
margin: 30px;
padding: 0;
}

a {
color: #335E79;
}

p.message {
color: #335E79;
padding: 10px;
background: #CADEEB;
}

p.error {
color: #783232;
padding: 10px;
background: #EBCACA;
}

.navigation li { display: inline;}

input {
font-family: 'Georgia', serif;
font-size: 16px;
border: 1px solid black;
color: #335E79;
padding: 2px;
}

input[type="submit"] {
background: #CADEEB;
color: #335E79;
border-color: #335E79;
}

input[name="openid"] {
background: url(openid.png) 4px no-repeat;
padding-left: 24px;
}

h1, h2 {
font-weight: normal;
}
Loading