first commit
This commit is contained in:
39
deploy.sh
Normal file
39
deploy.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
$rootdir=$(pwd)
|
||||
$deploydir=$rootdir/deployments/$REPO/$BRANCH
|
||||
|
||||
mkdir -p $deploydir
|
||||
cd $deploydir
|
||||
git clone $CLONE_URL .
|
||||
|
||||
git fetch origin $BRANCH
|
||||
git reset --hard origin/$BRANCH
|
||||
git checkout $COMMIT_HASH
|
||||
|
||||
make build
|
||||
echo "
|
||||
[Unit]
|
||||
Description=Deployment of $REPO/$BRANCH
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=make deploy
|
||||
User=drm
|
||||
WorkingDirectory=$deploydir
|
||||
Restart=on-failure
|
||||
StandardOutput=file:$deploydir/server.log
|
||||
StandardError=file:$deploydir/server.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
" > deploy.service
|
||||
systemctl daemon reload
|
||||
|
||||
$service="deployer-$repo-$branch.service"
|
||||
ln -s $deploydir/deploy.service /etc/systemd/system/$service
|
||||
systemctl stop $service
|
||||
systemctl start $service
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user