#8 .
Merged 4 years ago by jskladan. Opened 4 years ago by jskladan.

file modified
+1 -4
@@ -8,9 +8,7 @@ 

      build-date=""

  

  USER root

- COPY ./oraculum.spec /opt/app-root/src/oraculum/oraculum.spec

  

- # install dependencies defined in RPM spec file

  RUN dnf -y install findutils rpm-build python3-pip python3-mod_wsgi python3-pycurl \

      && dnf -y install python3-alembic \

                        python3-flask \
@@ -19,7 +17,6 @@ 

                        python3-flask-login \

                        python3-flask-oidc \

                        python3-flask-sqlalchemy \

-                       python3-flask-wtf \

                        python3-icalendar \

                        python3-lxml \

                        python3-mod_wsgi \
@@ -61,7 +58,7 @@ 

  # EXPOSE 5005/tcp

  EXPOSE 5005

  

- RUN echo "SECRET_KEY = 'really-a-secret!'" > /etc/oraculum/settings.py

+ RUN echo "SECRET_KEY = '`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1`'" >> /etc/oraculum/settings.py

  RUN echo "SQLALCHEMY_DATABASE_URI = 'sqlite:////var/tmp/oraculum.sqlite'" >> /etc/oraculum/settings.py

  RUN echo "OIDC_CLIENT_SECRETS = '/etc/oraculum/client_secrets.json'" >> /etc/oraculum/settings.py

  

file modified
+9 -8
@@ -1,12 +1,13 @@ 

  # you can use this as a template

  SECRET_KEY = 'not-really-a-secret'

- SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://dbuser:dbpassword@dbhost:dbport/dbname'

+ 

+ SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/oraculum_db.sqlite'

  SHOW_DB_URI = False

- PRODUCTION = True

- MAX_DB_AGE = 1800 # Max cache age allowed in seconds

- SKIP_CACHE_AGE_CHECK = False # Skip checking cache age in runtime, make sure to set up cron with "runcli.py sync" if set to True

  

- FILE_LOGGING = False

- SYSLOG_LOGGING = False

- STREAM_LOGGING = True

- LOGFILE = '/var/log/oraculum/oraculum.log'

+ OIDC_CLIENT_SECRETS = './conf/client_secrets.json.example'

+ OIDC_ID_TOKEN_COOKIE_SECURE = False

+ OIDC_REQUIRE_VERIFIED_EMAIL = False

+ OIDC_SCOPES = ['openid', 'email', 'profile']

+ 

+ SKIP_CACHE_AGE_CHECK = False # Skip checking cache age in runtime, make sure to set up cron with "runcli.py sync" if set to True

+ MAX_DB_AGE = 1800 # Max cache age allowed in seconds (30 minutes)

file modified
+5 -3
@@ -26,7 +26,7 @@ 

  from alembic.migration import MigrationContext

  

  from oraculum import app, db, controllers

- from oraculum.utils import db_utils

+ from oraculum.utils import db_utils, schedule, libkarma

  

  def get_alembic_config():

      # the location of the alembic ini file and alembic scripts changes when
@@ -69,8 +69,10 @@ 

      app.config['MAX_DB_AGE'] = 0

      app.config['SKIP_CACHE_AGE_CHECK'] = False

      db_utils.refresh_data("get_actions", controllers.main.get_actions())

-     db_utils.refresh_data("api_v1_landing_page", controllers.main.api_v1_landing_page())

-     db_utils.refresh_data("api_v1_karma", controllers.main.api_v1_libkarma())

+     db_utils.refresh_data("api_v1_landing_page", controllers.main.get_landing_page_data())

+     db_utils.refresh_data("api_v1_libkarma",

+         libkarma.get_updates(schedule.current_stable(), schedule.current_devel())

+     )

  

  def main():

      possible_commands = ['init_db', 'generate_config', 'upgrade_db', 'sync']

file modified
+2 -2
@@ -40,8 +40,8 @@ 

      OIDC_REQUIRE_VERIFIED_EMAIL = False

      OIDC_SCOPES = ['openid', 'email', 'profile']

  

-     SKIP_CACHE_AGE_CHECK = True

-     MAX_DB_AGE = 30*60  # keep data cached for 30 minutes

+     SKIP_CACHE_AGE_CHECK = False

+     MAX_DB_AGE = 1800  # keep data cached for 30 minutes

  

  

  class ProductionConfig(Config):

file modified
+13 -13
@@ -51,18 +51,12 @@ 

  def api_v1_libkarma():

      cached = db_utils.get_db_data("api_v1_libkarma")

      if cached:

-         return cached

+         return jsonify(cached)

      karma = libkarma.get_updates(schedule.current_stable(), schedule.current_devel(), app.logger)

      db_utils.refresh_data("api_v1_libkarma", karma)

-     return karma

- 

- @app.route('/api/v1/landing_page')

- #@cache.cached(timeout=CACHE_TIMEOUT)

- def api_v1_landing_page():

-     cached = db_utils.get_db_data("api_v1_landing_page")

-     if cached:

-         return cached

+     return jsonify(karma)

  

+ def get_landing_page_data():

      mtgs = fedocal.get_qa_meetings()

      last_qa_meeting = meetbot.get_last_qa_meeting()

      sched = schedule.get_schedule()
@@ -77,7 +71,15 @@ 

          'stable': stable,

          'devel': devel,

      }

+     return resp

  

+ 

+ @app.route('/api/v1/landing_page')

+ def api_v1_landing_page():

+     cached = db_utils.get_db_data("api_v1_landing_page")

+     if cached:

+         return jsonify(cached)

+     resp = get_landing_page_data()

      db_utils.refresh_data("api_v1_landing_page", resp)

      return resp

  
@@ -188,16 +190,14 @@ 

      kanban_config_raw = os.getenv('KANBAN_CONFIG')

      if not kanban_config_raw:

          app.logger.error('KANBAN_CONFIG variable not provided, sending empty dict')

-         return jsonify({})

+         return {}

  

      return json.loads(kanban_config_raw)

  

  

  @app.route('/api/v1/kanban')

  def api_v1_kanban():

-     kanban_config = get_kanban_config()

-     # FIXME ?

-     kanban_config_out = kanban_config.copy()

+     kanban_config_out = get_kanban_config()

      for project in kanban_config_out.values():

          # don't send token to frontend

          project.pop('token')

file modified
+15 -11
@@ -1,15 +1,19 @@ 

- Flask >= 1.1.1

- werkzeug <= 0.16

- requests

- python-bugzilla

- python-dateutil==2.6.0

- icalendar

+ alembic

+ bodhi-client

+ 

+ # the flask and werkzeug freeze is to reflect the state on production

+ Flask == 1.1.1

+ werkzeug == 0.16

+ 

+ Flask-Caching

  Flask-Cors

+ Flask-Login >= 0.3.0

+ Flask-OIDC >= 1.1.1

+ Flask-SQLAlchemy

+ icalendar

  lxml

  pygments

- Flask-Caching

+ python-bugzilla

+ python-dateutil==2.6.0

  pytz

- Flask-OIDC >= 1.1.1

- Flask-Login >= 0.3.0

- Flask-SQLAlchemy

- bodhi-client

+ requests

file modified
+2 -2
@@ -32,13 +32,13 @@ 

        include_package_data=True,

        install_requires=[

            'alembic',

+           'bodhi-client',

+           'Flask',

            'Flask-Caching',

            'Flask-Cors',

            'Flask-Login',

            'Flask-OIDC',

            'Flask-Sqlalchemy',

-           'Flask-Wtf',

-           'Flask',

            'icalendar',

            'lxml',

            'mod_wsgi',

no initial comment

The single > will rewrite /etc/oraculum/settings.py file from previous line

1 new commit added

  • .
4 years ago

rebased onto 3c1cd69

4 years ago

rebased onto 96ae4ec

4 years ago

rebased onto 1606397

4 years ago

Flask == 1.0.4 and werkzeug 0.16 will not be deployed at the same time in production. It's either Flask 1.0.4 and werkzeug 0.14.x (F31) or Flask 1.1.1 and werkzeug 0.16 (F32).

F32 is currently used as a container base.

rebased onto 09d4e78

4 years ago

Works for me, changed, thx for the heads-up

LGTM otherwise, thanks for QoL++ :)

rebased onto 00bf38f

4 years ago

rebased onto 463eed3

4 years ago

Pull-Request has been merged by jskladan

4 years ago