Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(api,ssh): remove refresh and use air #4179

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
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
26 changes: 12 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
.env.override
docker-compose.override.yml

*~
*/tmp
*/node_modules
*.orig

api_private_key
api_public_key
ssh_private_key
/go.sum
/ui/node_modules/
*.orig
.env.override
docker-compose.override.yml
gateway/gateway
api/api
ssh/ssh
agent/agent
agent/shellhub.key
cli/cli

go.work
go.work.sum
connector/.keys
connector/connector
*/tmp
go.sum

cli/cli
agent/shellhub.key

# Directory used by devscripts/run-agent to store binaries
bin/agent
6 changes: 3 additions & 3 deletions agent/.air.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ root = "."
tmp_dir = "tmp"

[build]
pre_cmd = ["rm ./tmp/dlv.sock"]
pre_cmd = []
cmd = "go build -tags docker -ldflags \"-X main.AgentVersion=latest\" -gcflags=\"all=-N -l\" -o ./tmp/main ."
post_cmd = []
bin = ""
full_bin = "dlv exec ./tmp/main"
args_bin = [
"--listen unix:./tmp/dlv.sock",
"--listen=0.0.0.0:2345",
"--headless",
"--continue",
"--accept-multiclient",
]
delay = 1000
delay = 500
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
Expand Down
34 changes: 34 additions & 0 deletions api/.air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
root = "."
tmp_dir = "tmp"

[build]
pre_cmd = []
cmd = "go build -gcflags=\"all=-N -l\" -o ./tmp/main ."
post_cmd = []
bin = ""
full_bin = "dlv exec ./tmp/main"
args_bin = [
"--listen=0.0.0.0:2345",
"--headless",
"--continue",
"--accept-multiclient",
"--",
"server",
]
delay = 500
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
3 changes: 2 additions & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ ARG GOPROXY
ENV GOPROXY ${GOPROXY}

RUN apk add --update openssl build-base docker-cli
RUN go install github.com/markbates/[email protected] && \
RUN go install github.com/air-verse/[email protected] && \
go install github.com/go-delve/delve/cmd/[email protected] && \
go install github.com/golangci/golangci-lint/cmd/[email protected] && \
go install github.com/vektra/mockery/v2/[email protected]

Expand Down
2 changes: 1 addition & 1 deletion api/entrypoint-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ fi

ln -sf $PWD/api /api

refresh run
air
32 changes: 32 additions & 0 deletions gateway/.air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
root = "."
tmp_dir = "tmp"

[build]
pre_cmd = []
cmd = "go build -gcflags=\"all=-N -l\" -o ./tmp/main ."
post_cmd = []
bin = ""
full_bin = "dlv exec ./tmp/main"
args_bin = [
"--listen=0.0.0.0:2345",
"--headless",
"--continue",
"--accept-multiclient",
]
delay = 500
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
3 changes: 2 additions & 1 deletion gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ RUN mkdir -p /var/run/openresty /etc/letsencrypt && \
curl -sSL https://ssl-config.mozilla.org/ffdhe2048.txt -o /etc/shellhub-gateway/dhparam.pem

RUN apk add --update openssl build-base
RUN go install github.com/markbates/[email protected] && \
RUN go install github.com/air-verse/[email protected] && \
go install github.com/go-delve/delve/cmd/[email protected] && \
go install github.com/golangci/golangci-lint/cmd/[email protected] && \
go install github.com/vektra/mockery/v2/[email protected]

Expand Down
2 changes: 1 addition & 1 deletion gateway/entrypoint-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

ln -sf $PWD/gateway /gateway

refresh run
air
14 changes: 0 additions & 14 deletions gateway/refresh.yml

This file was deleted.

32 changes: 32 additions & 0 deletions ssh/.air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
root = "."
tmp_dir = "tmp"

[build]
pre_cmd = []
cmd = "go build -gcflags=\"all=-N -l\" -o ./tmp/main ."
post_cmd = []
bin = ""
full_bin = "dlv exec ./tmp/main"
args_bin = [
"--listen=0.0.0.0:2345",
"--headless",
"--continue",
"--accept-multiclient",
]
delay = 500
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
3 changes: 2 additions & 1 deletion ssh/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ ARG GOPROXY
ENV GOPROXY ${GOPROXY}

RUN apk add --update openssl
RUN go install github.com/markbates/[email protected] && \
RUN go install github.com/air-verse/[email protected] && \
go install github.com/go-delve/delve/cmd/[email protected] && \
go install github.com/golangci/golangci-lint/cmd/[email protected] && \
go install github.com/vektra/mockery/v2/[email protected]

Expand Down
2 changes: 1 addition & 1 deletion ssh/entrypoint-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ if [ ! -f /var/run/secrets/ssh_private_key ]; then
openssl genrsa -out /var/run/secrets/ssh_private_key 2048
fi

refresh run
air
Loading