Skip to content

Commit

Permalink
Release 0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkLark86 committed May 6, 2021
1 parent 48a9ef6 commit e1572b8
Show file tree
Hide file tree
Showing 18 changed files with 198 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# SAMS Changelog

## [0.2.3] 2021-05-06
### Improvements
- fix(run): Allow apps to be started without gunicorn (#91cdb3a)

### Fixes
- fix(file_server): Allow python modules for config (#48a9ef6)

## [0.2.2] 2021-05-06
### Improvements
- Support Python 3.8
Expand Down
2 changes: 2 additions & 0 deletions examples/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
api: gunicorn -c api/gunicorn_config.py wsgi_api
file_server: gunicorn -c file_server/gunicorn_config.py wsgi_file_server
Empty file added examples/api/__init__.py
Empty file.
13 changes: 13 additions & 0 deletions examples/api/gunicorn_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os

from api.settings import HOST, PORT, WORKERS, TIMEOUT

bind = '{}:{}'.format(HOST, PORT)
workers = WORKERS

accesslog = '-'
access_log_format = '%(m)s %(U)s status=%(s)s time=%(T)ss size=%(B)sb'

reload = 'SAMS_RELOAD' in os.environ

timeout = TIMEOUT
36 changes: 36 additions & 0 deletions examples/api/logging_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python
# -*- coding: utf-8; -*-
#
# This file is part of SAMS.
#
# Copyright 2020 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

version: 1
disable_existing_loggers: True
formatters:
simple:
format: '%(asctime)s level=%(levelname)s pid=%(process)d function=%(name)s:%(module)s:%(funcName)s %(message)s'
handlers:
console:
class: logging.StreamHandler
stream : ext://sys.stdout
formatter: simple
loggers:
sams:
handlers: [console]
level: DEBUG
propagate: no
werkzeug:
handlers: [console]
level: DEBUG
propagate: no
superdesk:
handlers: [console]
level: DEBUG
propagate: no
root:
handlers: [console]
29 changes: 29 additions & 0 deletions examples/api/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import multiprocessing
from os import path
from pathlib import Path

from sams.default_settings import env

ABS_PATH = str(Path(__file__).resolve().parent)

#: hostname the API runs on
HOST = env('SAMS_API_HOST', 'localhost')

#: port the API runs on
PORT = int(env('SAMS_API_PORT', '5700'))

#: full url for this API
SERVER_URL = env('SAMS_API_URL', f'http://{HOST}:{PORT}')

#: Gunicorn workers/timeout
WORKERS = int(env('SAMS_API_WORKERS', env('WEB_CONCURRENCY', multiprocessing.cpu_count() + 1)))
TIMEOUT = int(env('SAMS_API_TIMEOUT', env('WEB_TIMEOUT', 30)))

#: Type of authentication to use
SAMS_AUTH_TYPE = 'sams.auth.public'

#: Location of the log file
LOG_CONFIG_FILE = path.join(ABS_PATH, 'logging_config.yml')

#: Maximum upload size of an Asset
MAX_ASSET_SIZE = int(env('SAMS_MAX_ASSET_SIZE', '0'))
Empty file.
13 changes: 13 additions & 0 deletions examples/file_server/gunicorn_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os

from file_server.settings import HOST, PORT, WORKERS, TIMEOUT

bind = '{}:{}'.format(HOST, PORT)
workers = WORKERS

accesslog = '-'
access_log_format = '%(m)s %(U)s status=%(s)s time=%(T)ss size=%(B)sb'

reload = 'SAMS_RELOAD' in os.environ

timeout = TIMEOUT
36 changes: 36 additions & 0 deletions examples/file_server/logging_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python
# -*- coding: utf-8; -*-
#
# This file is part of SAMS.
#
# Copyright 2020 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

version: 1
disable_existing_loggers: True
formatters:
simple:
format: '%(asctime)s level=%(levelname)s pid=%(process)d function=%(name)s:%(module)s:%(funcName)s %(message)s'
handlers:
console:
class: logging.StreamHandler
stream : ext://sys.stdout
formatter: simple
loggers:
sams:
handlers: [console]
level: DEBUG
propagate: no
werkzeug:
handlers: [console]
level: DEBUG
propagate: no
superdesk:
handlers: [console]
level: DEBUG
propagate: no
root:
handlers: [console]
27 changes: 27 additions & 0 deletions examples/file_server/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import multiprocessing
from os import path
from pathlib import Path

from sams.default_settings import env

ABS_PATH = str(Path(__file__).resolve().parent)

#: hostname the FileServer runs on
HOST = env('SAMS_PUBLIC_HOST', '0.0.0.0')

#: port the FileServer runs on
PORT = int(env('SAMS_PUBLIC_PORT', '5750'))

#: full url for the FileServer
SERVER_URL = env('SAMS_API_URL', f'http://{HOST}:{PORT}')

#: Gunicorn workers/timeout
WORKERS = int(env('SAMS_PUBLIC_WORKERS', env('WEB_CONCURRENCY', multiprocessing.cpu_count() + 1)))
TIMEOUT = int(env('SAMS_PUBLIC_TIMEOUT', env('WEB_TIMEOUT', 30)))

#: Type of authentication to use
SAMS_AUTH_TYPE = 'sams.auth.basic'
CLIENT_API_KEYS = env('SAMS_PUBLIC_API_KEYS') # Comma separated list of API Keys

#: Location of the log file
LOG_CONFIG_FILE = path.join(ABS_PATH, 'logging_config.yml')
3 changes: 3 additions & 0 deletions examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gunicorn>=20.0.4,<20.1
honcho==1.0.1
sams-server>=0.2.2,<0.3
19 changes: 19 additions & 0 deletions examples/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from sams.default_settings import env

# Common settings across both apps

#: full mongodb connection uri
MONGO_URI = env('SAMS_MONGO_URI', 'mongodb://localhost/sams')

#: elastic url
ELASTICSEARCH_URL = env('SAMS_ELASTICSEARCH_URL', 'http://localhost:9200')

#: elastic index name
ELASTICSEARCH_INDEX = env('SAMS_ELASTICSEARCH_INDEX', 'sams')

#: Public URL used in `api` HATEOAS responses for downloading from the `file_server`
SAMS_PUBLIC_URL = env('SAMS_PUBLIC_URL', 'http://localhost:5750')

# Configure the StorageDestinations
STORAGE_DESTINATION_1 = 'MongoGridFS,files,mongodb://localhost/sams_files'
STORAGE_DESTINATION_2 = 'MongoGridFS,media,mongodb://localhost/sams_media'
4 changes: 4 additions & 0 deletions examples/wsgi_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from sams.apps.api.app import get_app
from api import settings

application = get_app(__name__, config=settings)
4 changes: 4 additions & 0 deletions examples/wsgi_file_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from sams.apps.file_server.app import get_app
from api import settings

application = get_app(__name__, config=settings)
2 changes: 1 addition & 1 deletion src/clients/python/sams_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@

from .client import SamsClient # noqa

__version__ = '0.2.2'
__version__ = '0.2.3'
__all__ = 'SamsClient'
2 changes: 1 addition & 1 deletion src/clients/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

setup(
name='sams-client',
version='0.2.2',
version='0.2.3',
description='Super Asset Management Service Client',
long_description=LONG_DESCRIPTION,
author='Tanuj Soni',
Expand Down
2 changes: 1 addition & 1 deletion src/server/sams/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

__version__ = '0.2.2'
__version__ = '0.2.3'
4 changes: 2 additions & 2 deletions src/server/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

install_requires = [
'superdesk-core>=2.2.0',
'sams-client>=0.2.2,<0.3',
'sams-client>=0.2.3,<0.3',
]

setup(
name='sams-server',
version='0.2.2',
version='0.2.3',
description='Super Asset Management Service',
long_description=LONG_DESCRIPTION,
author='Mark Pittaway',
Expand Down

0 comments on commit e1572b8

Please sign in to comment.