- install postgres
- go to
sudo vim /etc/postgresql/x.y/main/pg_hba.conflocal all postgres trustsudo service postgres restartsudo -u postgres psqlALTER USER postgres PASSWORD '<password>';
sudo -u postgres createdb denebsudo -u postgres psqlCREATE USER voyager with PASSWORD '<password>';grant ALL ON DATABASE deneb TO voyager ;
pipenv --python <path-to-3.7>make install-devcp .env_example .env- fill in data for
.envspotifySPOTIPY_CLIENT_IDSPOTIPY_CLIENT_SECRETSPOTIPY_REDIRECT_URISPOTIPY_SCOPE
db dataDB_NAMEDB_USERDB_PASSWORDDB_HOST
deploymentSSH_USERSSH_HOST
fb notifyFB_API_URLFB_API_KEY
sentry loggingSENTRY_URL
This project is containerized.
docker rm $(docker ps --filter=status=exited --filter=status=created -q)
docker rmi $(docker images -a --filter=dangling=true -q)
docker rmi $(docker images -a -q)docker build -t deneb .docker run -i deneb /bin/shdocker run --network host --env-file .env deneb pipenv run python -m deneb full-run --user <username> --notify --all-markets
docker run --network host --env-file .env deneb pipenv run python -m deneb update-playlists-yearly-liked --user <username> --notify- Update poetry packages if the case
Make test- Add
CHANGELOGentry with version deployed & changelog - Update
deneb/config.pyapp version - Update
pyproject.tomlapp version - Update
.envapp version (production also)
git tag -a <version> -m "release <version>"git push --tagsmake migratemake VERSION=<version> sentrymake VERSION=<version> deploy
or for the last 7 steps
make VERSION=<version> full-deploy
- Change version in code
- Commit change with message
bump to {version}
git tag -a {version} -m "release {version}"git push --tags
make VERSION={version} deploy- deploy on serverpipenv run fab full-run- run whole script on server with predefined parameters; see bellow--notify=False- don't send any fb messages--force=False- dont update artist if not the case
make VERSION=version sentryThere's a cli tool available to use the tool easier.
pipenv run python -m denebfull-run(runs all commands bellow)--force- ignore artist synced_at timestamp (for:update-followed)--notify- send fb users what tracks were added to playlist--dry-run- dont'a add tracks to spotify playlist (for: all)--user <spotify_id>- full run for specific spotify id (for: all)--all-markets- will query all markets instead of 12/24 hour ones (for:update-followed,update-playlists)--year <year>- collect liked tracks from specific year (for:update-playlists-yearly-liked)
update-followed(collect user followed artists and albums (from current year) from spotify )--force- ignore artist synced_at timestamp--user <spotify_id>- full run for specific spotify id--all-markets- will query all markets instead of 12/24 hour ones
update-playlists(update current week realeased tracks playlist from followed artists)--notify- send fb users what tracks were added to playlist--dry-run- dont'a add tracks to spotify playlist--user <spotify_id>- full run for specific spotify id--all-markets- will query all markets instead of 12/24 hour ones
update-playlists-yearly-liked(update liked songs from released specific year playlist)--notify- send fb users what tracks were added to playlist--dry-run- dont'a add tracks to spotify playlist--user <spotify_id>- full run for specific spotify id--year <year>- collect liked tracks from specific year
docker pull postgres
mkdir -p $HOME/docker/volumes/postgres
docker run --rm --name pg-docker -e POSTGRES_PASSWORD=$DB_PASSWORD -e POSTGRES_USER=$DB_USER -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgresAre done by using alembic:
pipenv run alembic upgrade head- migrate to last statepipenv run alembic revision -m "Revision Message"- create a new db revisionpipenv run alembic downgrade base- destroy all (AHTUNG!)
make test