Skip to content

Instantly share code, notes, and snippets.

@xgenvn
Last active November 18, 2023 18:40
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xgenvn/bc4544a51bde2b0751011a8c8f3c15d2 to your computer and use it in GitHub Desktop.
Save xgenvn/bc4544a51bde2b0751011a8c8f3c15d2 to your computer and use it in GitHub Desktop.
BlackD Formatter as service
# /etc/systemd/system/blackd.service
# sudo systemctl start blackd
# sudo systemctl enable blackd
# sudo systemctl status blackd
[Unit]
Description=Black Formatter Service
[Service]
ExecStart=/home/brian/bin/miniconda3/bin/blackd --bind-host=127.0.0.1
[Install]
WantedBy=multi-user.target

Using docker

docker container run \
    --restart unless-stopped \
    --name blackd-service \
    -d \
    -p 45484:45484 \
    --entrypoint /usr/local/bin/blackd \
    pyfound/black \
    --bind-host 0.0.0.0 \
    --bind-port 45484
@pawnhearts
Copy link

it would run on 0.0.0.0 which is kinda not safe. you should add --bind-host=127.0.0.1

@xgenvn
Copy link
Author

xgenvn commented May 3, 2021

it would run on 0.0.0.0 which is kinda not safe. you should add --bind-host=127.0.0.1

Thanks. I didn't know it'll bind to 0.0.0.0. Updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment