Skip to content

Commit

Permalink
Merge pull request #6 from d-lab/deployment-test
Browse files Browse the repository at this point in the history
Update DNS and disable dockerimage build cache
  • Loading branch information
jayhuynh authored Jan 8, 2024
2 parents 09d0caf + 7468037 commit 275c29e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
default_config_file = "prod.yaml"
# default_config_file = "prod_prolific.yaml"
elif env == "test" or env == "sb":
default_config_file = "test.yaml"
# default_config_file = "test.yaml"
default_config_file = "test_prolific.yaml"


def my_screening_unit_generator():
Expand Down
4 changes: 4 additions & 0 deletions app/init_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

mephisto register "$MTURK_TYPE" name="$MTURK_NAME" access_key_id="$MTURK_ACCESS_KEY_ID" secret_access_key="$MTURK_SECRET_ACCESS_KEY"
mephisto register prolific name=prolific api_key="$PROLIFIC_API_KEY"
7 changes: 7 additions & 0 deletions app/pre_deployment_hook.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import os

APP_NAME = os.getenv('APP_NAME', 'temp')
APP_ENV = os.getenv('APP_ENV', 'dev')
def handle(*args):
print("Running pre deployment hook")

if APP_NAME == 'test' or APP_ENV == 'prod':
print("Running on remote server. Executing init_setup.sh")
os.system(f"sh {os.path.dirname(os.path.realpath(__file__))}/init_setup.sh")
7 changes: 5 additions & 2 deletions app/sync_s3.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash
APP_NAME=${1:-temp-app}
S3_BUCKET_NAME=${2:-s3://mephisto-data}
LOG_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

mephisto_data_root="/mephisto/data/results"

echo "[$(date)] Syncing $mephisto_data_root to $S3_BUCKET_NAME/data-v2/$APP_NAME!"
aws s3 sync $mephisto_data_root $S3_BUCKET_NAME/data-v2/$APP_NAME
FOLDER_NAME="$APP_NAME-$LOG_TIME"

echo "[$(date)] Syncing $mephisto_data_root to $S3_BUCKET_NAME/data-v2/$FOLDER_NAME!"
aws s3 sync $mephisto_data_root $S3_BUCKET_NAME/data-v2/$FOLDER_NAME --profile mpt

echo "[$(date)] Sync complete!"
2 changes: 1 addition & 1 deletion mephisto/tools/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def build_custom_bundle(
"The script should be able to be ran with bash"
)

if APP_ENV == 'prod':
if APP_ENV == 'prod' or APP_NAME == 'test':
webpack_complete = subprocess.call(["npm", "run", "build"])
else:
webpack_complete = subprocess.call(["npm", "run", "dev"])
Expand Down

0 comments on commit 275c29e

Please sign in to comment.