Skip to content

Latest commit

 

History

History
394 lines (322 loc) · 16.2 KB

7.2.0.md

File metadata and controls

394 lines (322 loc) · 16.2 KB

Arches 7.2.0 release notes

Major enhancements

None

Additional highlights

  • Updates workflows to handle multiple cardinality-n cards #9005
  • Adds default language selection to advanced search #9028
  • Fixes workflow bug for cards without a resourceinstance_id #9061
  • Checks if bnodeid exists in tile data #8966
  • Updates template preview in Graph Designer #9038
  • Adds security fixes for time-based blind SQL injection #9065
  • Updates webpack production config to preserve Prototype calls #9082

Dependency changes

Python:
    Upgraded:
        None

    Added:
        None

JavaScript:
    Upgraded:
        None

    Added:
        None

Breaking changes

None

Upgrading Arches

If upgrading from 7.0.0+:

  1. You must be upgraded to at least version 7.0.0 before proceeding. If you are on an earlier version, please skip to Upgrading Arches :: If upgrading from version 6.1.x

  2. Be sure to backup your database before proceeding.

  3. Upgrade to Arches 7.2.0

    pip install --upgrade arches==7.2.0
    

If upgrading from version 6.1.0+:

  1. You must be upgraded to at least version 6.1.0 before proceeding.

  2. Remove django-revproxy pip uninstall django-revproxy

  3. Be sure to backup your database before proceeding.

  4. Upgrade to Arches 7.2.0

    pip install --upgrade arches==7.2.0
    
  5. Important: If you are maintaining an Arches package, be sure to export your graphs and resource instance data before re-importing or reloading your package.

  6. Elasticsearch 8 (ES 8) enables a feature called xpack security by default. See the elasticsearch 8 documentation for details on the new features and how you can use them to secure your elasticsearch instance.

    • By default, xpack security turns on SSL with a self-signed certificate and will expect requests to come from an ES user. Elasticsearch users can be created via the elasticsearch-users command. Uncomment and override ELASTICSEARCH_CONNECTION_OPTIONS in settings.py line as needed (with an appropriate password and certificate settings) in your project settings or settings_local files.
    • If you choose to turn off xpack security in your ES 8 instance (not recommended) you will need to override the ELASTICSEARCH_HOSTS setting and change the scheme to "http".

Upgrading an Arches project

If upgrading from 7.0.0+:

  1. Your project must be upgraded to at least version 7.0.0 before proceeding. If you are on an earlier version, please skip to Upgrading an Arches Project :: If upgrading from version 6.1.x:

  2. Be sure to backup your database before proceeding.

  3. In your project's settings.py file:

    • ensure STATIC_URL has a valid value
    • ensure APP_ROOT has a valid value
    • ensure LANGUAGES has at least one uncommented value
    • if not already updated, update the package_settings and settings_local import blocks:
          # 7.0.0
      
          try:
              from .package_settings import *
          except ImportError:
              pass
      
          try:
              from .settings_local import *
          except ImportError:
              pass
      
          # 7.2.0
      
          try:
              from .package_settings import *
          except ImportError:
              try: 
                  from package_settings import *
              except ImportError as e:
                  pass
      
          try:
              from .settings_local import *
          except ImportError as e:
              try: 
                  from settings_local import *
              except ImportError as e:
                  pass
      
    • if it doesn't already exist, add a return to the bottom of the file that NODEJS can parse:
          if __name__ == "__main__":
              print(
                  json.dumps({
                      'ARCHES_NAMESPACE_FOR_DATA_EXPORT': ARCHES_NAMESPACE_FOR_DATA_EXPORT,
                      'STATIC_URL': STATIC_URL,
                      'ROOT_DIR': ROOT_DIR,
                      'APP_ROOT': APP_ROOT,
                      'WEBPACK_DEVELOPMENT_SERVER_PORT': WEBPACK_DEVELOPMENT_SERVER_PORT,
                  })
              )
              sys.stdout.flush()
      
    • ( optional ) by default ARCHES_NAMESPACE_FOR_DATA_EXPORT is assigned the value "http://localhost:8000/". If running your Django server elsewhere, overwrite ARCHES_NAMESPACE_FOR_DATA_EXPORT in your project's settings.py file.
    • ( optional ) by default WEBPACK_DEVELOPMENT_SERVER_PORT is assigned the value 9000. If you want the webpack server to run on a different port, overwrite WEBPACK_DEVELOPMENT_SERVER_PORT in your project's settings.py file.
  4. Within your project, with your Python 3 virtual environment activated:

        python manage.py migrate
        python manage.py updateproject
        python manage.py es reindex_database
    

    NOTE: Running python manage.py updateproject will delete your webpack directory and replace it with an updated version from arches core. It will also copy over .eslintrc.js, .eslintignore, .babelrc, .browserslistrc, .stylelintrc.json from arches core to your project's root directory, overwriting the files if they already exist.

  5. If you have any project-level JavaScript dependencies, ensure they are aliased correctly in webpack/webpack-node-modules-aliases.js

  6. Update your package.json file:

    • ensure dependencies is pointing to the correct version, eg: archesproject/arches#stable/7.2.0
    • ensure devDependencies is pointing to the correct version, eg: archesproject/arches-dev-dependencies#stable/7.2.0
  7. Delete out-of-date yarn configs:

    • delete yarn.lock
    • if it exists, delete your media/node_modules folder
  8. Start your application server.

  9. In a seperate terminal, navigate to the root directory of the project ( you should be on the same level as package.json)

    • run yarn, this will install updated frontend dependencies in /media/node_modules.
    • run yarn build_development or yarn_start. This will regenerate your media/build directory.
      • yarn build_development will build a development bundle for the frontend assests of the application -- this should complete in less than 2 minutes
      • yarn start will build the frontend of the application and then start a webpack development server
  10. If you are running Arches on Apache, be sure to run:

    python manage.py build_production
    

    and restart your server.

    sudo service apache2 reload
    
  11. Finally, If you are running Celery, you should also restart your Celery worker(s). The process for doing this depends on how Celery is being run.

If upgrading from version 6.1.0+:

  1. Be sure to backup your database before proceeding.

  2. in your project's settings.py file:

    • MOBILE_OAUTH_CLIENT_ID must be renamed to OAUTH_CLIENT_ID
    • ensure webpack_loader has been added to INSTALLED_APPS
    • ensure APP_NAME and ARCHES_NAMESPACE_FOR_DATA_EXPORT have been defined
    • ensure the following attributes exist in the file:
      STATIC_ROOT = os.path.join(ROOT_DIR, "staticfiles")
      
      STATIC_URL = "/static/"
      
      STATICFILES_DIRS =  (
          os.path.join(APP_ROOT, 'media', 'build'),
          os.path.join(APP_ROOT, 'media'),
      ) + STATICFILES_DIRS
      
      WEBPACK_LOADER = {
          "DEFAULT": {
              "STATS_FILE": os.path.join(APP_ROOT, "webpack/webpack-stats.json"),
          },
      }
      
    • ensure STATIC_URL has a valid value
    • ensure APP_ROOT has a valid value
    • ensure LANGUAGES has at least one uncommented value
    • update the package_settings and settings_local import blocks:
          # 6.1.0
      
          try:
              from .package_settings import *
          except ImportError:
              pass
      
          try:
              from .settings_local import *
          except ImportError:
              pass
      
          # 7.2.0
      
          try:
              from .package_settings import *
          except ImportError:
              try: 
                  from package_settings import *
              except ImportError as e:
                  pass
      
          try:
              from .settings_local import *
          except ImportError as e:
              try: 
                  from settings_local import *
              except ImportError as e:
                  pass
      
    • add a return to the bottom of the file that NODEJS can parse:
          if __name__ == "__main__":
              print(
                  json.dumps({
                      'ARCHES_NAMESPACE_FOR_DATA_EXPORT': ARCHES_NAMESPACE_FOR_DATA_EXPORT,
                      'STATIC_URL': STATIC_URL,
                      'ROOT_DIR': ROOT_DIR,
                      'APP_ROOT': APP_ROOT,
                      'WEBPACK_DEVELOPMENT_SERVER_PORT': WEBPACK_DEVELOPMENT_SERVER_PORT,
                  })
              )
              sys.stdout.flush()
      
    • ( optional ) By default ARCHES_NAMESPACE_FOR_DATA_EXPORT is assigned the value "http://localhost:8000/". If running your Django server elsewhere, overwrite ARCHES_NAMESPACE_FOR_DATA_EXPORT in your project's settings.py file.
    • ( optional ) By default WEBPACK_DEVELOPMENT_SERVER_PORT is assigned the value 9000. If you want the webpack server to run on a different port, overwrite WEBPACK_DEVELOPMENT_SERVER_PORT in your project's settings.py file.
  3. Within your project with your Python 3 virtual environment activated:

    python manage.py migrate
    python manage.py es reindex_database
    
  4. Run the update project command

    python manage.py updateproject
    

    This will create a /webpack/ directory in your project and copy over the webpack configuration files from arches core. It will also copy over .eslintrc.js, .eslintignore, .babelrc, .browserslistrc, .stylelintrc.json from arches core to your project's root directory, overwriting the files if they already exist.

  5. If you have any project-level JavaScript dependencies, ensure they are aliased correctly in webpack/webpack-node-modules-aliases.js.

  6. Update the project's .gitignore file to include:

    my_project/staticfiles
    my_project/webpack/webpack-stats.json
    node_modules
    
  7. Update the contents of .yarnrc to reference node_modules instead of packages:

    --install.modules-folder "./media/node_modules"
    --add.modules-folder "./media/node_modules"
    
  8. The project's package.json file will need to be manually updated to include updates to dependencies, devDependencies and scripts. It should contain the following:

    "scripts": {
        "build_production": "NODE_PATH=./media/node_modules NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production ./media/node_modules/.bin/webpack --config webpack/webpack.config.prod.js",
        "build_development": "NODE_PATH=./media/node_modules NODE_OPTIONS=--max_old_space_size=8192 ./media/node_modules/.bin/webpack --config webpack/webpack.config.dev.js",
        "build_test": "NODE_PATH=./media/node_modules NODE_OPTIONS=--max_old_space_size=8192 ./media/node_modules/.bin/webpack --config webpack/webpack.config.dev.js --env test=true",
        "start": "NODE_PATH=./media/node_modules NODE_OPTIONS=--max_old_space_size=8192 ./media/node_modules/.bin/webpack serve --config webpack/webpack.config.dev.js"
    },
    
    "dependencies": {
        "arches": "archesproject/arches#stable/7.2.0"
    },
    
    "devDependencies": {
        "arches-dev-dependencies": "archesproject/arches-dev-dependencies#stable/7.2.0"
    },
    
  9. Update the templates in your project:

    • If a template is using the {% load staticfiles %} template tag, it must be updated to {% load static %}
    • If a template is using the {% static '/path/to/file' %} template tag, it must be updated to {% webpack_static '/path/to/file' %}
      • Be sure to include {% load webpack_static from webpack_loader %} at the top of any template where this change is made
  10. The pattern used for JavaScript component template dependencies has changed, and any project components must be updated as well. Consider the following example with our reports/default.js component:

    # 6.1.0
    
    define(['knockout', 'viewmodels/report'], function(ko, ReportViewModel) {
        return ko.components.register('default-report', {
            viewModel: function(params) {
                params.configKeys = [];
    
                ReportViewModel.apply(this, [params]);
            },
            template: { require: 'text!report-templates/default' }
        });
    });
    
    # 7.2.0
    
    define(['knockout', 'viewmodels/report' 'templates/views/report-templates/default.htm'], function(ko, ReportViewModel, defaultReportTemplate) {
        return ko.components.register('default-report', {
            viewModel: function(params) {
                params.configKeys = [];
    
                ReportViewModel.apply(this, [params]);
            },
            template: defaultReportTemplate
        });
    });
    
  11. (optional) If internationalization is important to your project, strings in component templates (eg. any template that is a dependency of a JavaScript file) should be moved to javascript.htm and added as a key-value pair to an arches-translations HTML object. You must then update your component template to use the new string:

    # my_project/my_project/templates/javascript.htm
    
    {% extends "javascript.htm" %}
    
    {% load static %}
    {% load l10n %}
    {% load i18n %}
    
    {% block arches_translations %}
    <div 
        class='arches-translations'
        my-key-name='{% trans "My key value." as myKeyValue %} "{{ myKeyValue|escapejs }}"'
    ></div>
    {% endblock arches_translations %}
    
    
    # my_project/my_project/templates/path/to/component.htm
    
    <span data-bind="text: $root.translations.textKeyOnArchesTranslationObject"></span>
    
    # OR
    
    <select 
        data-bind="placeholder: $root.translations.textKeyOnArchesTranslationObject"
    ></select>
    
    # OR
    
    <input data-bind="attr:{placeholder: $root.translations.textKeyOnArchesTranslationObject}></input>
    

    Note: Keys added to the arches-translations HTML object should be dash-delineated, eg. my-key-name. When referenced in a component template, the key should be camelcase instead, eg. myKeyName.

  12. Update the project's index.htm /package references to /node_modules references, along with any other references to /media/packages in your codebase.

  13. Start your application server.

  14. In a seperate terminal, navigate to the root directory of the project ( you should be on the same level as package.json)

    • manually remove the yarn.lock file, eg. rm yarn.lock
    • if it already exists, delete your media/node_modules folder
    • run yarn, this will install updated frontend dependencies in /media/node_modules.
    • (optional) You can remove /media/packages
  15. In the same terminal window where you ran yarn, yarn build_development or yarn_start. This will generate your media/build directory.

    • yarn build_development will build a development bundle for the frontend assests of the application -- this should complete in less than 2 minutes
    • yarn start will build the frontend of the application and then start a webpack development server
  16. If you are running Arches on Apache, be sure to run:

    python manage.py build_production
    

    and restart your server.

    sudo service apache2 reload
    
  17. Finally, If you are running Celery, you should also restart your Celery worker(s). The process for doing this depends on how Celery is being run.