-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fffa197
commit bd672b0
Showing
6 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"yaml.schemas": { | ||
"https://json.schemastore.org/yamllint.json": "*.yaml" | ||
}, | ||
"editor.semanticTokenColorCustomizations": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
SERVICE_FILE="whatsappbot.service" | ||
SERVICE_DIR="/lib/systemd/system" | ||
|
||
# Go to project directory | ||
cd /root/wabot | ||
|
||
# Install modules and build Golang | ||
go get | ||
go build main.go | ||
# Check if there is a systemd service for golang program | ||
if [ -f "${SERVICE_DIR}/${SERVICE_FILE}" ]; then | ||
echo "The service file '${SERVICE_FILE}' exists in ${SERVICE_DIR}" | ||
systemctl restart $SERVICE_FILE | ||
else | ||
echo -e \ | ||
"\ | ||
The file '${SERVICE_FILE}' does not exist in ${SERVICE_DIR} \n\ | ||
SystemD service will be created now\ | ||
" | ||
cp ${SERVICE_FILE} ${SERVICE_DIR}/ | ||
systemctl daemon-reload | ||
systemctl start $SERVICE_FILE | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
# Remote server information | ||
SERVER_USER="root" | ||
SERVER_HOST="203.194.113.211" | ||
SSH_PORT=22 | ||
|
||
# Define SSH private key | ||
SSH_PRIVATE_KEY="~/.ssh/habi" | ||
|
||
# Project directory on the remote server | ||
PROJECT_DIR="/root/wabot" | ||
|
||
# Send project to the remote server | ||
rsync -avz \ | ||
--exclude=".git" \ | ||
--exclude=".github" \ | ||
"ssh -p ${SSH_PORT} -i ${SSH_PRIVATE_KEY}" \ | ||
./ $SERVER_USER@$SERVER_HOST:$PROJECT_DIR | ||
|
||
# Run a remote script on a local machine over ssh | ||
ssh -p $SSH_PORT -i $SSH_PRIVATE_KEY \ | ||
$SERVER_USER@$SERVER_HOST \ | ||
'bash' $PROJECT_DIR/deploy/build-on-server.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Habi-Bot (WhatsApp Bot) | ||
|
||
[Service] | ||
User=root | ||
Type=simple | ||
Restart=on-failure | ||
WorkingDirectory=/root/wabot | ||
ExecStart=/root/wabot/main | ||
|
||
[Install] | ||
WantedBy=multi-user.target |