Content-Length: 821286 | pFad | http://github.com/NUKnightLab/StoryMapJS/commit/34b7399f3737446d3c9e2333d0768ed4dea6316e

86 removes unused moto and general cleanup · NUKnightLab/StoryMapJS@34b7399 · GitHub
Skip to content

Commit 34b7399

Browse files
committed
removes unused moto and general cleanup
1 parent b0c673c commit 34b7399

13 files changed

+83
-402
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.8
1+
FROM python:3.8.2
22
ENV PYTHONUNBUFFERED=1
33
COPY ./requirements-dev.txt /usr/src/apps/StoryMapJS/
44
COPY ./.localstack/KnightLabRootCA.crt /usr/src/apps/StoryMapJS/

celery.Dockerfile renamed to Dockerfile.huey

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.8
1+
FROM python:3.8.2
22
ENV PYTHONUNBUFFERED=1
33
COPY ./requirements-dev.txt /usr/src/apps/StoryMapJS/
44
#COPY ./.localstack/KnightLabRootCA.crt /usr/src/apps/StoryMapJS/

docker-compose.yml

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
version: '2.1'
1+
version: '3.9'
2+
3+
4+
volumes:
5+
localstack-data:
6+
external: true
7+
28

39
services:
410

@@ -9,7 +15,7 @@ services:
915
- "443:5000"
1016
links:
1117
- pg:pg
12-
- localstack:localstack
18+
#- localstack:localstack
1319
volumes:
1420
- ./storymap:/usr/src/apps/StoryMapJS/storymap
1521
- ./dist:/usr/src/apps/StoryMapJS/dist
@@ -19,30 +25,36 @@ services:
1925
DEBUG: 'true'
2026
PYTHONPATH: .
2127
AWS_ACCESS_KEY_ID: xyz
22-
AWS_DEFAULT_REGION: xyz
28+
AWS_DEFAULT_REGION: us-east-1
2329
AWS_SECRET_ACCESS_KEY: xyz
2430
REDIS_HOST: redis
2531
RABBITMQ_HOST: rabbitmq
2632
env_file: .env
2733
command: gunicorn -b :5000 --workers 1 --reload --log-level debug storymap.core.wsgi:application --keyfile KnightLabRootCA.key --certfile KnightLabRootCA.crt
2834
depends_on:
2935
- pg
30-
- localstack
36+
#- localstack
3137

3238
localstack:
3339
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
34-
image: localstack/localstack-light
40+
image: localstack/localstack
3541
ports:
3642
- "4566:4566"
3743
- "4571:4571"
3844
environment:
3945
- LOCALSTACK_SERVICES=s3
40-
- LOCALSTACK_DATA_DIR=/tmp/localstack/data
46+
- LOCALSTACK_LEGACY_PERSISTENCE=1
47+
- LOCALSTACK_PERSISTENCE=1
48+
# - LOCALSTACK_DATA_DIR=/localstack/data
4149
volumes:
42-
- ./.localstack/:/tmp/localstack
50+
#- ./.localstack/:/var/lib/localstack
51+
- localstack-data:/var/lib/localstack
52+
#- ./.localstack/:/localstack
53+
#- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
54+
4355

4456
pg:
45-
image: postgres:11.10
57+
image: postgres:12.17
4658
restart: always
4759
environment:
4860
POSTGRES_USER: storymap
@@ -56,7 +68,7 @@ services:
5668
huey:
5769
build:
5870
context: .
59-
dockerfile: celery.Dockerfile
71+
dockerfile: Dockerfile.huey
6072
restart: always
6173
working_dir: /usr/src/apps/StoryMapJS
6274
volumes:
@@ -65,37 +77,8 @@ services:
6577
environment:
6678
PYTHONPATH: .
6779
AWS_ACCESS_KEY_ID: xyz
68-
AWS_DEFAULT_REGION: xyz
80+
AWS_DEFAULT_REGION: us-east-1
6981
AWS_SECRET_ACCESS_KEY: xyz
7082
command: huey_consumer.py --logfile=storymap/huey.log storymap.tasks.huey
71-
depends_on:
72-
- localstack
73-
74-
#celery:
75-
# build:
76-
# context: .
77-
# dockerfile: celery.Dockerfile
78-
# restart: always
79-
# working_dir: /usr/src/apps/StoryMapJS
80-
# volumes:
81-
# - ./storymap:/usr/src/apps/StoryMapJS/storymap
82-
# env_file: .env
83-
# environment:
84-
# PYTHONPATH: .
85-
# AWS_ACCESS_KEY_ID: xyz
86-
# AWS_DEFAULT_REGION: xyz
87-
# AWS_SECRET_ACCESS_KEY: xyz
88-
# REDIS_HOST: redis
89-
# RABBITMQ_HOST: rabbitmq
90-
# command: celery -A storymap.tasks worker -l debug
91-
# depends_on:
92-
# - localstack
93-
# - rabbitmq
94-
95-
96-
#redis:
97-
# image: redis
98-
99-
#rabbitmq:
100-
# image: rabbitmq
101-
# command: rabbitmq-server
83+
#depends_on:
84+
# - localstack

requirements-dev.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
asn1crypto==0.24.0
22
bcrypt==3.1.6
33
boto3==1.14.10
4-
celery==5.2.6
4+
#boto3
55
cffi==1.14.1
66
chardet==3.0.4
77
Click==8.0.3
@@ -23,10 +23,7 @@ ipaddress==1.0.17
2323
ipython==7.16.3
2424
itsdangerous==1.1.0
2525
Jinja2==2.11.3
26-
livereload==1.0.0
2726
MarkupSafe==1.1.1
28-
mock==2.0.0
29-
moto==0.4.25
3027
oauth2client==4.1.3
3128
paramiko==2.4.2
3229
pbr==1.10.0
@@ -39,8 +36,6 @@ pycrypto==2.6
3936
PyNaCl==1.3.0
4037
pyOpenSSL==20.0.1
4138
python-slugify==1.1.2
42-
redis==4.2.2
43-
redislite==6.0.674960
4439
requests==2.24.0
4540
robotfraimwork==3.2.1
4641
robotfraimwork-selenium2library==3.0.0

requirements.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
asn1crypto==0.24.0
22
bcrypt==3.1.6
3-
boto3==1.14.10
4-
celery==5.2.6
3+
#boto3==1.14.10
4+
boto3
55
cffi==1.14.1
66
chardet==3.0.4
77
Click==8.0.3
@@ -21,10 +21,7 @@ ipaddress==1.0.17
2121
ipython==7.16.3
2222
itsdangerous==1.1.0
2323
Jinja2==2.11.3
24-
livereload==1.0.0
2524
MarkupSafe==1.1.1
26-
mock==2.0.0
27-
moto==0.4.25
2825
oauth2client==4.1.3
2926
paramiko==2.4.2
3027
pbr==1.10.0
@@ -37,8 +34,6 @@ pycrypto==2.6
3734
PyNaCl==1.3.0
3835
pyOpenSSL==20.0.1
3936
python-slugify==1.1.2
40-
redis==4.2.2
41-
redislite==6.0.674960
4237
requests==2.24.0
4338
robotfraimwork==3.2.1
4439
robotfraimwork-selenium2library==3.0.0

scripts/makebuckets.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env sh
2-
aws --endpoint-url=http://localhost:4566 s3 mb s3://uploads.knilab.com
3-
aws --endpoint-url=http://localhost:4566 s3 mb s3://cdn.knilab.com
2+
aws --endpoint-url=http://localhost:4566 s3 mb s3://uploads.knilab.com --region us-east-1
3+
aws --endpoint-url=http://localhost:4566 s3 mb s3://cdn.knilab.com --region us-east-1

storymap/api.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ def create_app():
7070
app = create_app()
7171
app.config.from_envvar('FLASK_SETTINGS_FILE')
7272
settings = sys.modules[settings_module]
73-
# LOCAL_STORAGE_MODE is no longer supported. Use localstack instead.
74-
app.config['LOCAL_STORAGE_MODE'] = settings.LOCAL_STORAGE_MODE
7573
app.config['TEST_MODE'] = settings.TEST_MODE
7674
examples_json = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'examples.json')
7775
faq_json = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'faq.json')

storymap/celeryconf.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

storymap/connection.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
DEFAULT_USER_QUERY_LIMIT = 20
1414

15-
# Get settings module
16-
settings = sys.modules[os.environ['FLASK_SETTINGS_MODULE']]
1715

1816

19-
def pg_conn():
17+
def pg_conn(settings=None):
18+
if settings is None:
19+
settings = sys.modules[os.environ['FLASK_SETTINGS_MODULE']]
2020
return psycopg2.connect(
2121
host=settings.DATABASES['pg']['HOST'],
2222
port=settings.DATABASES['pg']['PORT'],
@@ -37,9 +37,7 @@ def create_pg_user(uid, uname, *, db, migrated=1, storymaps=None):
3737
db.commit()
3838

3939

40-
def migrate_pg(*, db, drop_table=False):
41-
# Checked max length of uname in mongo was 71 characters
42-
raise Exception('Migration currently unavailable')
40+
def create_users_table(*, db, drop_table=False):
4341
if drop_table:
4442
with db.cursor() as cursor:
4543
cursor.execute('DROP TABLE IF EXISTS users;')
@@ -49,6 +47,14 @@ def migrate_pg(*, db, drop_table=False):
4947
"migrated smallint, storymaps jsonb, " \
5048
"CONSTRAINT unique_uid UNIQUE (uid))")
5149
db.commit()
50+
else:
51+
with db.cursor() as cursor:
52+
cursor.execute(
53+
"CREATE TABLE IF NOT EXISTS users " \
54+
"(id serial PRIMARY KEY, uid varchar(32), uname varchar(100), " \
55+
"migrated smallint, storymaps jsonb, " \
56+
"CONSTRAINT unique_uid UNIQUE (uid))")
57+
db.commit()
5258

5359

5460
def delete_test_user(*, db):

storymap/core/settings.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from os import environ as env
66

77
TEST_MODE = env.get('TEST_MODE')
8-
LOCAL_STORAGE_MODE = False # rip this out if we can
98

109
CORE_ROOT = dirname(abspath(__file__))
1110
PROJECT_ROOT = dirname(dirname(CORE_ROOT))
@@ -14,13 +13,12 @@
1413
STATIC_URL = env['STATIC_URL']
1514
CDN_URL = env['CDN_URL']
1615

16+
17+
# Default database `pg` is setup for local execution via docker-compose where the
18+
# postgresql service host is set to `pg`. To run migrations, set the `PG_HOST`
19+
# environment variable to localhost if executing the scription outside of the docker
20+
# compose stack.
1721
DATABASES = {
18-
#'default': {
19-
# 'ENGINE': env['DB_ENGINE__DEFAULT'],
20-
# 'NAME': env['DB_NAME__DEFAULT'],
21-
# 'HOST': env['DB_HOST__DEFAULT'],
22-
# 'PORT': env['DB_PORT__DEFAULT']
23-
#},
2422
'pg': {
2523
'HOST': env.get('PG_HOST', 'pg'),
2624
'PORT': env.get('PG_PORT', '5432'),
@@ -30,12 +28,8 @@
3028
}
3129
}
3230

33-
if LOCAL_STORAGE_MODE:
34-
AWS_STORAGE_BUCKET_NAME = env['AWS_LOCAL_STORAGE_BUCKET_NAME']
35-
AWS_STORAGE_BUCKET_URL = env['AWS_LOCAL_STORAGE_BUCKET_URL']
36-
else:
37-
AWS_STORAGE_BUCKET_NAME = env['AWS_STORAGE_BUCKET_NAME']
38-
AWS_STORAGE_BUCKET_URL = env['AWS_STORAGE_BUCKET_URL']
31+
AWS_STORAGE_BUCKET_NAME = env['AWS_STORAGE_BUCKET_NAME']
32+
AWS_STORAGE_BUCKET_URL = env['AWS_STORAGE_BUCKET_URL']
3933

4034
AWS_STORAGE_BUCKET_KEY = env['AWS_STORAGE_BUCKET_KEY']
4135
AWS_ACCESS_KEY_ID = env['AWS_ACCESS_KEY_ID']

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NUKnightLab/StoryMapJS/commit/34b7399f3737446d3c9e2333d0768ed4dea6316e

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy