Skip to content

Commit

Permalink
install npm as sudo, we'll change the owner in a minute anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
fgregg committed Nov 2, 2023
1 parent a5de1b6 commit 4f47ff5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/after_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ mv $PROJECT_DIR/configs/.env.$DEPLOYMENT_GROUP_NAME $PROJECT_DIR/.env
echo -e "\nDEPLOYMENT_ID=$DEPLOYMENT_ID" >> $PROJECT_DIR/.env

# Create a deployment specific virtual environment
sudo -H -u datamade python3 -m venv $VENV_DIR
python3 -m venv $VENV_DIR

# Upgrade pip and setuptools. This is needed because sometimes python packages
# that we rely upon will use more recent packaging methods than the ones
# understood by the versions of pip and setuptools that ship with the operating
# system packages.
sudo -H -u datamade $VENV_DIR/bin/pip install --upgrade pip
sudo -H -u datamade $VENV_DIR/bin/pip install --upgrade setuptools
$VENV_DIR/bin/pip install --upgrade pip
$VENV_DIR/bin/pip install --upgrade setuptools

# Install the project requirements into the deployment specific virtual
# environment.
sudo -H -u datamade $VENV_DIR/bin/pip install -r $PROJECT_DIR/requirements.txt --upgrade
VENV_DIR/bin/pip install -r $PROJECT_DIR/requirements.txt --upgrade

# Install JS dependencies
( cd $PROJECT_DIR && npm install )

# OPTIONAL Run migrations and other management commands that should be run with
# every deployment
sudo -H -u datamade env $(cat $PROJECT_DIR/.env | xargs) $VENV_DIR/bin/python $PROJECT_DIR/manage.py migrate
sudo -H -u datamade env $(cat $PROJECT_DIR/.env | xargs) $VENV_DIR/bin/python $PROJECT_DIR/manage.py createcachetable
sudo -H -u datamade env $(cat $PROJECT_DIR/.env | xargs) $VENV_DIR/bin/python $PROJECT_DIR/manage.py collectstatic --no-input
sudo -H -u datamade env $(cat $PROJECT_DIR/.env | xargs) $VENV_DIR/bin/python $PROJECT_DIR/manage.py compress
env $(cat $PROJECT_DIR/.env | xargs) $VENV_DIR/bin/python $PROJECT_DIR/manage.py migrate
env $(cat $PROJECT_DIR/.env | xargs) $VENV_DIR/bin/python $PROJECT_DIR/manage.py createcachetable
env $(cat $PROJECT_DIR/.env | xargs) $VENV_DIR/bin/python $PROJECT_DIR/manage.py collectstatic --no-input
env $(cat $PROJECT_DIR/.env | xargs) $VENV_DIR/bin/python $PROJECT_DIR/manage.py compress

# Set the ownership of the project files and the virtual environment
chown -R datamade.www-data $PROJECT_DIR
Expand Down

0 comments on commit 4f47ff5

Please sign in to comment.