Skip to content

Commit

Permalink
Mount passphrase file into containers under /run/secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
gbenson committed Nov 20, 2023
1 parent f1535e0 commit 34e2e4d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/setup-miner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ apt-get update
apt-get install -y docker.io

service=xmrig
secret_name=config_passphrase
secret_src=/etc/tor-miner/$secret_name
secret_dst=/run/secrets/tor_miner_${secret_name}

cat <<EOF >/lib/systemd/system/$service.service
[Unit]
Description=XMRig Monero miner
Expand All @@ -26,7 +30,14 @@ After=docker.service
[Service]
Type=simple
ExecStart=docker run --privileged --pull=always --rm --name=$service gbenson/$service
ExecStart=docker run \\
--privileged \\
--pull=always \\
--rm \\
--name=$service \\
--mount type=tmpfs,target=/run \\
--mount type=bind,source=$secret_src,target=$secret_dst,readonly \\
gbenson/$service
ExecStop=docker stop $service
Restart=always
RestartSec=30s
Expand Down

0 comments on commit 34e2e4d

Please sign in to comment.