diff --git a/backend/deploy/deploy.bash b/backend/deploy/deploy.bash index db7b099d..c0ad2e06 100755 --- a/backend/deploy/deploy.bash +++ b/backend/deploy/deploy.bash @@ -3,20 +3,25 @@ # Deployment script - intended to run on Moonstream servers # Main -APP_DIR="${APP_DIR:-/home/ubuntu/app}" +APP_DIR="${APP_DIR:-/home/ubuntu/moonstream}" AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION:-us-east-1}" -PYTHON_ENV_DIR="${PYTHON_ENV_DIR:-/home/ubuntu/app-env}" +PYTHON_ENV_DIR="${PYTHON_ENV_DIR:-/home/ubuntu/moonstream-env}" PYTHON="${PYTHON_ENV_DIR}/bin/python" PIP="${PYTHON_ENV_DIR}/bin/pip" SCRIPT_DIR="$(realpath $(dirname $0))" PARAMETERS_SCRIPT="${SCRIPT_DIR}/parameters.py" -SECRETS_DIR="${SECRETS_DIR:-/home/ubuntu/app-secrets}" +SECRETS_DIR="${SECRETS_DIR:-/home/ubuntu/moonstream-secrets}" PARAMETERS_ENV_PATH="${SECRETS_DIR}/app.env" AWS_SSM_PARAMETER_PATH="${AWS_SSM_PARAMETER_PATH:-/moonstream/prod}" SERVICE_FILE="${SCRIPT_DIR}/moonstream.service" set -eu +echo +echo +echo "Updating pip and setuptools" +"${PIP}" install -U pip setuptools + echo echo echo "Updating Python dependencies" diff --git a/backend/deploy/moonstream.service b/backend/deploy/moonstream.service index f92c48e4..f7b565aa 100644 --- a/backend/deploy/moonstream.service +++ b/backend/deploy/moonstream.service @@ -5,9 +5,9 @@ After=network.target [Service] User=ubuntu Group=www-data -WorkingDirectory=/home/ubuntu/app -EnvironmentFile=/home/ubuntu/secrets/app.env -ExecStart=/home/ubuntu/server-env/bin/uvicorn --host 0.0.0.0 --port 7481 --workers 8 moonstream.api:app +WorkingDirectory=/home/ubuntu/moonstream +EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env +ExecStart=/home/ubuntu/moonstream-env/bin/uvicorn --host 0.0.0.0 --port 7481 --workers 8 moonstream.api:app SyslogIdentifier=moonstream [Install] diff --git a/crawlers/.gitignore b/crawlers/.gitignore index 49a73033..6ecbec4f 100644 --- a/crawlers/.gitignore +++ b/crawlers/.gitignore @@ -162,4 +162,6 @@ cython_debug/ # Custom dev.env prod.env +prod.env.ps1 +dev.env.ps1 .venv diff --git a/crawlers/sample.env b/crawlers/sample.env index 7d907c50..14599f44 100644 --- a/crawlers/sample.env +++ b/crawlers/sample.env @@ -1,2 +1,3 @@ export MOONSTREAM_IPC_PATH=null -export MOONSTREAM_CRAWL_WORKERS_RAW=4 +export MOONSTREAM_CRAWL_WORKERS=4 +export EXPLORATION_DB_URI="" diff --git a/db/alembic.sh b/db/alembic.sh new file mode 100755 index 00000000..9ca8b9b8 --- /dev/null +++ b/db/alembic.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +PYTHONPATH=".:$PYTHONPATH" alembic "$@" diff --git a/db/alembic/env.py b/db/alembic/env.py index 45fd93f2..695e4078 100644 --- a/db/alembic/env.py +++ b/db/alembic/env.py @@ -17,7 +17,7 @@ fileConfig(config.config_file_name) # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata -from db.models import Base as ExplorationBase +from moonstreamdb.models import Base as ExplorationBase target_metadata = ExplorationBase.metadata @@ -25,7 +25,7 @@ target_metadata = ExplorationBase.metadata # can be acquired: # my_important_option = config.get_main_option("my_important_option") # ... etc. -from db.models import EthereumBlock, EthereumTransaction, EthereumPendingTransaction +from moonstreamdb.models import EthereumBlock, EthereumTransaction, EthereumPendingTransaction def include_symbol(tablename, schema):