Skip to content

Commit

Permalink
Merge pull request #111 from ebridges/feature/deploy-refinements
Browse files Browse the repository at this point in the history
feature/deploy refinements
  • Loading branch information
ebridges authored Jul 24, 2020
2 parents dc18911 + 07bbd58 commit 9d40600
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 182 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ temp-requirements.txt
project/test-db.sqlite3
requirements.txt
.doit.db
build-tmp/
deploy-tmp/
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,3 @@
[submodule "application/js/javascript-load-image"]
path = application/js/javascript-load-image
url = https://github.com/blueimp/JavaScript-Load-Image.git

[submodule "functions/thumbnails"]
path = functions/thumbnails
url = https://github.com/ebridges/thumbnailer.git
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from doit.action import CmdAction
from doit.tools import result_dep

from elektrum.build.task_actions import (
from elektrum.deploy.task_actions import (
envfile,
environment,
config_action,
Expand All @@ -17,10 +17,10 @@
ApplicationServiceInfo,
)

VERBOSITY = 1
DOIT_CONFIG = {'verbosity': 1}


# Hack @todo -- still needed?
# HACK: Handles first time case where envfile does not exist,
# causes config tasks to be run 2x
if not isfile(envfile()):
actions = config_action()
for action in actions:
Expand All @@ -42,14 +42,14 @@ def task_config():
'targets': [envfile()],
'file_dep': file_deps,
'actions': action,
'verbosity': VERBOSITY,
'verbosity': 2,
}


def task_application_service_version():
"""Returns version of application for current environment."""
i = ApplicationServiceInfo()
return {'actions': [environment, i.version], 'verbosity': 1}
return {'actions': [environment, i.version]}


def task_application_service_deploy():
Expand All @@ -58,7 +58,6 @@ def task_application_service_deploy():
return {
'file_dep': i.deploy_deps(),
'actions': i.deploy_actions(),
'verbosity': 1,
'uptodate': [result_dep('application_service_version')],
}

Expand All @@ -85,7 +84,7 @@ def task_application_service_migrations():
def task_thumbnail_service_version():
"""Returns version of thumbnailer for current environment."""
i = ThumbnailServiceInfo()
return {'actions': [environment, i.version], 'verbosity': 1}
return {'actions': [environment, i.version]}


def task_thumbnail_service_deploy():
Expand All @@ -94,15 +93,14 @@ def task_thumbnail_service_deploy():
return {
'file_dep': i.deploy_deps(),
'actions': i.deploy_actions(),
'verbosity': 1,
'uptodate': [result_dep('thumbnail_service_version')],
}


def task_processor_service_version():
"""Returns version of processor for current environment."""
i = ProcessorServiceInfo()
return {'actions': [environment, i.version], 'verbosity': 1}
return {'actions': [environment, i.version]}


def task_processor_service_deploy():
Expand All @@ -111,7 +109,6 @@ def task_processor_service_deploy():
return {
'file_dep': i.deploy_deps(),
'actions': i.deploy_actions(),
'verbosity': 1,
'uptodate': [result_dep('processor_service_version')],
}

Expand All @@ -123,5 +120,4 @@ def task_processor_service_config():
'task_dep': ['processor_service_deploy'],
'file_dep': i.config_deps(),
'actions': i.config_action(),
'verbosity': VERBOSITY,
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

from doit.action import CmdAction

from elektrum.build_util import download_github_release, slurp, get_encrypted_field, decrypt_value
from elektrum.deploy_util import download_github_release, slurp, get_encrypted_field, decrypt_value

ELEKTRUM_APPLICATION_VERSION = {'development': '0.1.0', 'staging': '0.1.0', 'production': '0.1.0'}
ELEKTRUM_APPLICATION_VERSION = {'development': '0.2.1', 'staging': '0.2.1', 'production': '0.2.1'}
ELEKTRUM_PROCESSOR_VERSION = {'development': '1.1.2', 'staging': '1.1.2', 'production': '1.1.2'}
ELEKTRUM_THUMBNAIL_VERSION = {'development': '1.2.3', 'staging': '1.2.3', 'production': '1.2.3'}

Expand Down Expand Up @@ -49,7 +49,7 @@ def config_action(tags='iam,vpc,rds,sss,acm,cdn,dns,ses,cfg'):
class ApplicationServiceInfo:
def __init__(self):
self.name = f'{service()}-application'
self.downloaddir = f'./build-tmp/{self.name}'
self.downloaddir = f'./deploy-tmp/{self.name}'
self.archive = f'{self.name}-{environment()}-{self.version()}.zip'
self.target = f'{self.downloaddir}/{self.archive}'
self.github_auth_token = environ['GITHUB_OAUTH_TOKEN']
Expand Down Expand Up @@ -122,7 +122,7 @@ def static_actions(self):
return [CmdAction('make static', cwd='application')]

def static_deps(self):
deps = [f for f in glob(f'{self.appdir}/static/**', recursive=True) if isfile(f)]
deps = [f for f in glob(f'application/static/**', recursive=True) if isfile(f)]
return deps

def migration_actions(self):
Expand All @@ -132,7 +132,7 @@ def migration_actions(self):
class ProcessorServiceInfo:
def __init__(self):
self.name = f'{service()}-processor'
self.downloaddir = f'./build-tmp/{self.name}'
self.downloaddir = f'./deploy-tmp/{self.name}'
self.archive = f'{self.name}-{self.version()}.zip'
self.target = f'{self.downloaddir}/{self.archive}'
self.github_auth_token = environ['GITHUB_OAUTH_TOKEN']
Expand Down Expand Up @@ -186,7 +186,7 @@ def config_action(self):
class ThumbnailServiceInfo:
def __init__(self):
self.name = 'thumbnailer'
self.downloaddir = f'./build-tmp/{self.name}'
self.downloaddir = f'./deploy-tmp/{self.name}'
self.archive = f'{service()}-thumbnails-{self.version()}.zip'
self.target = f'{self.downloaddir}/{self.archive}'
self.github_auth_token = environ['GITHUB_OAUTH_TOKEN']
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions application/media_items/tests/test_media_item_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from users.tests.factories import USER_PASSWORD
from media_items.models import MediaItem
from base.tests.util import match_image_key
from elektrum.build_util import download_github_release
from elektrum.build.task_actions import ELEKTRUM_PROCESSOR_VERSION
from elektrum.deploy_util import download_github_release
from elektrum.deploy.task_actions import ELEKTRUM_PROCESSOR_VERSION
import sys


Expand Down
2 changes: 1 addition & 1 deletion build → deploy
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ export PYTHONPATH="$(pwd)/${root_dir}:$PYTHONPATH"
export PATH=${PATH}:${VIRTUAL_ENV}/bin
export ANSIBLE_FORCE_COLOR=1

doit --file=${root_dir}/elektrum/build/build.py --dir=$(pwd) --failure-verbosity=2 ${@}
doit --file=${root_dir}/elektrum/deploy/deploy.py --dir=$(pwd) --failure-verbosity=2 ${@}
98 changes: 0 additions & 98 deletions etc/bin/publish_release.py

This file was deleted.

22 changes: 0 additions & 22 deletions etc/bin/set_project_version.py

This file was deleted.

1 change: 0 additions & 1 deletion functions/thumbnails
Submodule thumbnails deleted from 858662
Loading

0 comments on commit 9d40600

Please sign in to comment.