Fix dockerfile being able to pass in params
Change config directory to local config_app one
This commit is contained in:
parent
acf242f241
commit
13293ecdea
14 changed files with 45 additions and 30 deletions
|
@ -1,3 +1,3 @@
|
|||
app: PYTHONPATH="../" gunicorn -c conf/gunicorn_local.py config_application:application
|
||||
# webpack: npm run watch-config-app
|
||||
webpack: npm run watch-config-app
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@ import re
|
|||
import subprocess
|
||||
|
||||
|
||||
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
# Note: this currently points to the directory above, since we're in the quay config_app dir. When extracting, revert
|
||||
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
CONF_DIR = os.getenv("QUAYCONF", os.path.join(ROOT_DIR, "conf/"))
|
||||
STATIC_DIR = os.path.join(ROOT_DIR, 'static/')
|
||||
STATIC_LDN_DIR = os.path.join(STATIC_DIR, 'ldn/')
|
||||
|
@ -11,9 +12,6 @@ STATIC_FONTS_DIR = os.path.join(STATIC_DIR, 'fonts/')
|
|||
TEMPLATE_DIR = os.path.join(ROOT_DIR, 'templates/')
|
||||
|
||||
|
||||
# TODO(config): Remove this external folder dependency
|
||||
EXTERNAL_REPO_REQUIRE_PATH = os.path.dirname(ROOT_DIR)
|
||||
|
||||
|
||||
def _get_version_number_changelog():
|
||||
try:
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import os
|
||||
import logging
|
||||
from flask import Flask
|
||||
from _init_config import CONF_DIR
|
||||
from _init_config import ROOT_DIR
|
||||
from config_app.config_util.config import get_config_provider
|
||||
from util.ipresolver import NoopIPResolver
|
||||
|
||||
|
||||
from util.config.superusermanager import SuperUserManager
|
||||
|
@ -11,7 +12,8 @@ app = Flask(__name__)
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
OVERRIDE_CONFIG_DIRECTORY = os.path.join(CONF_DIR, 'stack/')
|
||||
# OVERRIDE_CONFIG_DIRECTORY = os.path.join(ROOT_DIR, 'stack/')
|
||||
OVERRIDE_CONFIG_DIRECTORY = os.path.join(ROOT_DIR, 'config_app/conf/stack')
|
||||
|
||||
|
||||
is_testing = 'TEST' in os.environ
|
||||
|
@ -33,3 +35,4 @@ else:
|
|||
# Load the override config via the provider.
|
||||
config_provider.update_app_config(app.config)
|
||||
superusers = SuperUserManager(app)
|
||||
ip_resolver = NoopIPResolver()
|
|
@ -10,7 +10,7 @@ from config_app.config_util.workers import get_worker_count
|
|||
|
||||
|
||||
logconfig = logfile_path(debug=True)
|
||||
bind = '127.0.0.1:5000'
|
||||
bind = '0.0.0.0:5000'
|
||||
workers = get_worker_count('local', 2, minimum=2, maximum=8)
|
||||
worker_class = 'gevent'
|
||||
daemon = False
|
||||
|
|
|
@ -3,7 +3,7 @@ from uuid import uuid4
|
|||
import os.path
|
||||
import requests
|
||||
|
||||
from _init_config import ROOT_DIR, CONF_DIR, EXTERNAL_REPO_REQUIRE_PATH
|
||||
from _init_config import ROOT_DIR, CONF_DIR
|
||||
|
||||
|
||||
def build_requests_session():
|
||||
|
@ -48,7 +48,7 @@ class ImmutableConfig(object):
|
|||
# Status tag config
|
||||
STATUS_TAGS = {}
|
||||
for tag_name in ['building', 'failed', 'none', 'ready', 'cancelled']:
|
||||
tag_path = os.path.join(EXTERNAL_REPO_REQUIRE_PATH, 'buildstatus', tag_name + '.svg')
|
||||
tag_path = os.path.join(ROOT_DIR, 'buildstatus', tag_name + '.svg')
|
||||
with open(tag_path) as tag_svg:
|
||||
STATUS_TAGS[tag_name] = tag_svg.read()
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from flask import abort, request
|
|||
|
||||
from config_app.config_endpoints.api.suconfig_models_pre_oci import pre_oci_model as model
|
||||
from config_app.config_endpoints.api import resource, ApiResource, verify_not_prod, nickname, validate_json_request
|
||||
from config_app.c_app import app, config_provider, superusers, OVERRIDE_CONFIG_DIRECTORY
|
||||
from config_app.c_app import app, config_provider, superusers, OVERRIDE_CONFIG_DIRECTORY, ip_resolver
|
||||
|
||||
from auth.auth_context import get_authenticated_user
|
||||
from data.users import get_federated_service_name, get_users_handler
|
||||
|
@ -15,8 +15,7 @@ from data.database import configure
|
|||
from data.runmigration import run_alembic_migration
|
||||
from util.config.configutil import add_enterprise_config_defaults
|
||||
from util.config.database import sync_database_with_config
|
||||
# TODO(config) re-add this import when we get the app extracted from validators
|
||||
# from util.config.validator import validate_service_for_config
|
||||
from util.config.validator import validate_service_for_config, ValidatorContext
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -64,9 +63,6 @@ class SuperUserConfig(ApiResource):
|
|||
def get(self):
|
||||
""" Returns the currently defined configuration, if any. """
|
||||
config_object = config_provider.get_config()
|
||||
logger.debug(config_object)
|
||||
logger.debug(config_provider)
|
||||
# Todo: do we even need this endpoint? Since we'll be loading the config in browser
|
||||
return {
|
||||
'config': config_object
|
||||
}
|
||||
|
@ -350,6 +346,10 @@ class SuperUserConfigValidate(ApiResource):
|
|||
# if not config_provider.config_exists() or SuperUserPermission().can():
|
||||
if not config_provider.config_exists():
|
||||
config = request.get_json()['config']
|
||||
return validate_service_for_config(service, config, request.get_json().get('password', ''))
|
||||
validator_context = ValidatorContext.from_app(app, config, request.get_json().get('password', ''),
|
||||
ip_resolver=ip_resolver,
|
||||
config_provider=config_provider)
|
||||
return validate_service_for_config(service, validator_context)
|
||||
|
||||
|
||||
abort(403)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
from _init_config import CONF_DIR
|
||||
from config_app._init_config import CONF_DIR
|
||||
|
||||
|
||||
def logfile_path(jsonfmt=False, debug=False):
|
||||
|
|
11
config_app/init/service/gunicorn_web/run
Executable file
11
config_app/init/service/gunicorn_web/run
Executable file
|
@ -0,0 +1,11 @@
|
|||
#! /bin/bash
|
||||
|
||||
echo 'Starting gunicon'
|
||||
|
||||
QUAYPATH=${QUAYPATH:-"."}
|
||||
QUAYCONF=${QUAYCONF:-"$QUAYPATH/conf"}
|
||||
|
||||
cd ${QUAYDIR:-"/"}
|
||||
PYTHONPATH=$QUAYPATH venv/bin/gunicorn -c $QUAYDIR/config_app/conf/gunicorn_local.py config_application:application
|
||||
|
||||
echo 'Gunicorn exited'
|
|
@ -324,8 +324,5 @@ angular.module('quay-config').factory('ApiService', ['Restangular', '$q', 'UtilS
|
|||
};
|
||||
};
|
||||
|
||||
// todo: remove hacks
|
||||
apiService.scRegistryStatus = () => new Promise(() => { hello: true });
|
||||
|
||||
return apiService;
|
||||
}]);
|
||||
|
|
|
@ -196,6 +196,7 @@ const templateUrl = require('./setup.html');
|
|||
};
|
||||
|
||||
$scope.isStep = function(step) {
|
||||
console.log('current step is', step);
|
||||
for (var i = 1; i < arguments.length; ++i) {
|
||||
if (arguments[i] == step) {
|
||||
return true;
|
||||
|
|
Reference in a new issue