Skip to content

Update docker-compose.md #637

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions docs/docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,60 @@ docker-compose run --rm openvpn ovpn_revokeclient $CLIENTNAME remove
```bash
docker-compose run -e DEBUG=1 -p 1194:1194/udp openvpn
```

## Simple Script
* If you use docker-compose for deployment, this is a simple and practical script. Add a shell script file `manage.sh`. in the same directory as docker-compose.
```bash
#!/bin/bash

echo -e "\nManage Script\n"

while getopts ":a:d: l r v h" opt
do
case $opt in
a)
echo "Generating certificate for $OPTARG"
docker-compose run --rm openvpn easyrsa build-client-full $OPTARG
;;
d)
echo "Revoking certificate for $OPTARG "
docker-compose run --rm openvpn ovpn_revokeclient $OPTARG remove
;;
l)
echo "View user list"
docker-compose run --rm openvpn ovpn_listclients
;;
r)
echo "Update certificate"
docker-compose run --rm openvpn ovpn_getclient_all
echo "openvpn-data/conf/"
;;
v)
echo "Version information"
docker exec openvpn openvpn --version
;;
h)
echo -e "-a Add user. eg: -a wangyanpeng;\n"
echo -e "-d Revocation of user's certificate. eg: -d wangyanpeng;\n"
echo -e "-l View user list. eg: -l; \n"
echo -e "-r Batch generation and update of client configuration files,catalog:openvpn-data/conf/clients . eg: -r;\n"
echo -e "-v View current version. eg: -v;\n"
echo -e "-h Get help information. eg: -h;\n"
;;
?)
echo "Unknown parameter"
echo "-h for help information"
exit 1;;
esac
done

```
* Add run permissions.
```bash
chmod +x ./manage.sh
```
* Let's go !
```bash
./manage.sh -h
```