Skip to content

Commit

Permalink
Merge pull request #47 from flant/rc-1.7.0
Browse files Browse the repository at this point in the history
Release 1.7.0
  • Loading branch information
pashcovich authored Oct 5, 2021
2 parents ace42f7 + 77c0fbb commit 9fa3c44
Show file tree
Hide file tree
Showing 13 changed files with 431 additions and 132 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
release:
types: [created]

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/386, darwin/amd64
goos: [linux]
goarch: ["386", amd64]
steps:
- name: checkout code
uses: actions/checkout@v2
- name: build binaries
uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
ldflags: '-linkmode external -extldflags "-static" -s -w'
pre_command: bash ./install-deps.sh
binary_name: "ovpn-admin"
asset_name: ovpn-admin-${{ matrix.goos }}-${{ matrix.goarch }}.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ COPY frontend/ /app
RUN cd /app && npm install && npm run build

FROM golang:1.14.2-buster AS backend-builder
RUN go get -u github.com/gobuffalo/packr/v2/packr2
COPY --from=frontend-builder /app/static /app/frontend/static
COPY . /app
RUN go get -u github.com/gobuffalo/packr/v2/packr2 && cd /app && packr2 && env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags='-linkmode external -extldflags "-static" -s -w' -o ovpn-admin && packr2 clean
RUN cd /app && packr2 && env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags='-linkmode external -extldflags "-static" -s -w' -o ovpn-admin && packr2 clean

FROM alpine:3.13
WORKDIR /app
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ cd ovpn-admin

### 3. Prebuilt binary (WIP)

You can also download & use prebuilt binaries from the [releases](https://github.com/flant/ovpn-admin/releases) page — just choose a relevant tar.gz file.
You can also download and use prebuilt binaries from the [releases](https://github.com/flant/ovpn-admin/releases) page — just choose a relevant tar.gz file.

## Usage

Expand All @@ -86,6 +86,10 @@ Flags:
network for openvpn server
--ovpn.server=HOST:PORT:PROTOCOL ...
comma separated addresses for openvpn servers
--ovpn.server.behindLB ovpn behind cloud loadbalancer
--ovpn.service="openvpn-external"
ovpn behind cloud loadbalancer k8s service name
--mgmt=main=127.0.0.1:8989 ...
comma separated (alias=address) for openvpn servers mgmt interfaces
--metrics.path="/metrics" URL path for surfacing collected metrics
Expand Down
2 changes: 1 addition & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

mkdir -p {easyrsa,ccd}

Expand Down
5 changes: 3 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
#!/usr/bin/env bash

PATH=$PATH:~/go/bin
# go get -u github.com/gobuffalo/packr/v2/packr2

#go get -u github.com/gobuffalo/packr/v2/packr2

cd frontend && npm install && npm run build && cd ..

Expand Down
4 changes: 3 additions & 1 deletion frontend/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,15 @@ new Vue({
data.append('username', _this.u.newUserName);
data.append('password', _this.u.newUserPassword);

_this.username = _this.u.newUserName;

axios.request(axios_cfg('api/user/create', data, 'form'))
.then(function(response) {
_this.$notify({title: 'New user ' + _this.username + ' created', type: 'success'})
_this.u.modalNewUserVisible = false;
_this.u.newUserName = '';
_this.u.newUserPassword = '';
_this.getUserData();
_this.$notify({title: 'New user ' + _this.username + ' created', type: 'success'})
})
.catch(function(error) {
_this.u.newUserCreateError = error.response.data;
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ require (
github.com/prometheus/common v0.15.0 // indirect
github.com/rogpeppe/go-internal v1.7.0 // indirect
github.com/sirupsen/logrus v1.8.0 // indirect
github.com/spf13/cobra v1.1.3 // indirect
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20210225080010-8e9945a5478f // indirect
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
golang.org/x/tools v0.1.0 // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/apimachinery v0.20.4
k8s.io/client-go v0.20.4
)
223 changes: 201 additions & 22 deletions go.sum

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ func parseDateToUnix(layout,datetime string) int64 {
}

func runBash(script string) string {
fmt.Println(script)
if *debug {
log.Println(script)
}
cmd := exec.Command("bash", "-c", script)
stdout, err := cmd.CombinedOutput()
if err != nil {
Expand Down Expand Up @@ -98,7 +100,7 @@ func fDownload(path, url string, basicAuth bool) error {
}

if resp.StatusCode != 200 {
log.Printf("WARNING: Download file operation for url %s finished with status code %d", url, resp.StatusCode )
log.Printf("WARNING: Download file operation for url %s finished with status code %d\n", url, resp.StatusCode )
}
defer resp.Body.Close()

Expand Down
13 changes: 13 additions & 0 deletions install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

apt-get update
apt-get install -y npm nodejs

PATH=$PATH:~/go/bin

go get -u github.com/gobuffalo/packr/v2/packr2

cd frontend && npm install && npm run build && cd ..

packr2

Loading

0 comments on commit 9fa3c44

Please sign in to comment.