-
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
70c15dd
commit fffa197
Showing
2 changed files
with
56 additions
and
10 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,59 @@ | ||
## WhatsApp Bot | ||
# WhatsApp Bot | ||
|
||
#### How to start ? | ||
## Development | ||
|
||
1. Install `SQLite` in your Computer | ||
2. Generate OpenAI API key at https://platform.openai.com/account/api-keys | ||
3. Create `.env` file in the root directory | ||
4. And then add variable named `OPENAI_API_KEY` with your OpenAI API key as its value | ||
5. Run `go get` to install required modules | ||
6. Run `start.sh` (Make sure you assign execute permission) | ||
- **Dependencies** : | ||
- Go Programming Language https://go.dev/ | ||
- SQLite Database https://www.sqlite.org/ | ||
- OpenAI API key, generate at https://platform.openai.com/account/api-keys | ||
- **.env Variables**: | ||
- `OPENAI_API_KEY` | ||
- **How to run**: | ||
- `go get` to install required modules | ||
- `start.sh` (Make sure to assign execute permission) | ||
|
||
## Deployment | ||
|
||
#### Features still in development... | ||
#### 1. SSH Configuration | ||
Generate SSH key | ||
```sh | ||
ssh-keygen | ||
``` | ||
At local computer, copy publickey to `~/.ssh/authorized_keys` at remote server | ||
|
||
#### 2. Github Secrets Variables | ||
- `SERVER_IP` remote server IP | ||
- `SERVER_PASS` remote server Password | ||
- `SERVER_PORT` opened port | ||
- `SERVER_USER` remote server user to action | ||
- `SSH_PRIVATE_KEY` generated ssh private key on local computer | ||
|
||
#### 3. Remote Server Configuration | ||
Install dependencies | ||
- Go Programming Language | ||
- SQlite | ||
|
||
Set SystemD configuration | ||
```sh | ||
# Go to SystemD services directory | ||
cd /lib/systemd/system/ | ||
|
||
# Create a SystemD service file | ||
touch whatsappbot.service | ||
``` | ||
At file `/lib/systemd/system/whatsappbot.service`, write this configuration | ||
```sh | ||
[Unit] | ||
Description=Habi-Bot (WhatsApp Bot) | ||
|
||
[Service] | ||
User=root | ||
Type=simple | ||
Restart=always | ||
RestartSec=5s | ||
WorkingDirectory=/root/wabot | ||
ExecStart=/root/wabot/main | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
``` |
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