Skip to content

Commit 83837ab

Browse files
committed
Update
1 parent 2ea5c4e commit 83837ab

File tree

3 files changed

+27
-239
lines changed

3 files changed

+27
-239
lines changed

Diff for: deploy.sh

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
#!/bin/bash
22

3-
# Add GitHub to the known hosts
4-
mkdir -p ~/.ssh
5-
ssh-keyscan github.com >> ~/.ssh/known_hosts
6-
7-
# Clone your repository
3+
# Go to the user's home directory
84
cd /home/$AWS_USERNAME
5+
6+
# If the repository directory doesn't exist, clone it
97
if [ ! -d "$APP_NAME" ]; then
108
git clone $REPOSITORY_URL
119
fi
1210

13-
# Pull the latest changes
11+
# Navigate to the repository directory (which is now guaranteed to exist)
1412
cd $APP_NAME
13+
14+
# Pull the latest changes
1515
git pull
1616

17-
# Build your Go application
18-
go build -o $APP_EXECUTABLE
17+
# Build the Go application
18+
go build -o $APP_EXECUTABLE .
1919

20-
# Create a new systemd service
20+
# Check if systemd service exists, if not, create one
2121
if [ ! -e "/etc/systemd/system/$APP_NAME.service" ]; then
22-
sudo bash -c 'cat > /etc/systemd/system/$APP_NAME.service <<EOF
23-
[Unit]
24-
Description=$APP_NAME Service
25-
After=network.target
26-
27-
[Service]
28-
ExecStart=/home/$AWS_USERNAME/$APP_NAME/$APP_EXECUTABLE
29-
WorkingDirectory=/home/$AWS_USERNAME/$APP_NAME
30-
User=$AWS_USERNAME
31-
Group=$AWS_USERNAME
32-
Restart=always
33-
34-
[Install]
35-
WantedBy=multi-user.target
36-
EOF'
22+
sudo bash -c 'cat > /etc/systemd/system/$APP_NAME.service' <<EOF
23+
[Unit]
24+
Description=$APP_NAME Service
25+
After=network.target
26+
27+
[Service]
28+
ExecStart=/home/$AWS_USERNAME/$APP_NAME/$APP_EXECUTABLE
29+
WorkingDirectory=/home/$AWS_USERNAME/$APP_NAME
30+
User=$AWS_USERNAME
31+
Group=$AWS_USERNAME
32+
Restart=always
33+
34+
[Install]
35+
WantedBy=multi-user.target
36+
EOF
3737
fi
3838

3939
# Start the application service
@@ -42,5 +42,5 @@ sudo systemctl start $APP_NAME
4242
# Enable the application service
4343
sudo systemctl enable $APP_NAME
4444

45-
# Check the status of your service
45+
# Check the status of the service
4646
sudo systemctl status $APP_NAME

Diff for: go.mod

+2-37
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,19 @@ require (
77
go.mongodb.org/mongo-driver v1.14.0
88
)
99

10-
require (
11-
cloud.google.com/go/auth v0.3.0 // indirect
12-
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
13-
cloud.google.com/go/compute/metadata v0.3.0 // indirect
14-
github.com/felixge/httpsnoop v1.0.4 // indirect
15-
github.com/go-logr/logr v1.4.1 // indirect
16-
github.com/go-logr/stdr v1.2.2 // indirect
17-
github.com/gofiber/utils v0.0.10 // indirect
18-
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
19-
github.com/golang/protobuf v1.5.4 // indirect
20-
github.com/google/go-cmp v0.6.0 // indirect
21-
github.com/google/s2a-go v0.1.7 // indirect
22-
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
23-
github.com/gorilla/schema v1.1.0 // indirect
24-
go.opencensus.io v0.24.0 // indirect
25-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
26-
go.opentelemetry.io/otel v1.24.0 // indirect
27-
go.opentelemetry.io/otel/metric v1.24.0 // indirect
28-
go.opentelemetry.io/otel/trace v1.24.0 // indirect
29-
golang.org/x/net v0.24.0 // indirect
30-
golang.org/x/oauth2 v0.19.0 // indirect
31-
google.golang.org/api v0.176.1 // indirect
32-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
33-
google.golang.org/grpc v1.63.2 // indirect
34-
google.golang.org/protobuf v1.33.0 // indirect
35-
)
10+
require github.com/google/go-cmp v0.6.0 // indirect
3611

3712
require (
38-
github.com/andybalholm/brotli v1.0.5 // indirect
3913
github.com/dgrijalva/jwt-go v3.2.0+incompatible
40-
github.com/gofiber/fiber v1.14.6
4114
github.com/golang/snappy v0.0.1 // indirect
42-
github.com/google/uuid v1.6.0 // indirect
15+
github.com/google/uuid v1.6.0
4316
github.com/klauspost/compress v1.17.0 // indirect
44-
github.com/mattn/go-colorable v0.1.13 // indirect
45-
github.com/mattn/go-isatty v0.0.20 // indirect
46-
github.com/mattn/go-runewidth v0.0.15 // indirect
4717
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
48-
github.com/rivo/uniseg v0.2.0 // indirect
49-
github.com/valyala/bytebufferpool v1.0.0 // indirect
50-
github.com/valyala/fasthttp v1.51.0 // indirect
51-
github.com/valyala/tcplisten v1.0.0 // indirect
5218
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
5319
github.com/xdg-go/scram v1.1.2 // indirect
5420
github.com/xdg-go/stringprep v1.0.4 // indirect
5521
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
5622
golang.org/x/crypto v0.22.0 // indirect
5723
golang.org/x/sync v0.7.0 // indirect
58-
golang.org/x/sys v0.19.0 // indirect
5924
golang.org/x/text v0.14.0 // indirect
6025
)

0 commit comments

Comments
 (0)