Skip to content

Commit

Permalink
added deploy command, fixed gosec G115 (CWE-190), cleaned package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
smeggmann99 committed Nov 17, 2024
1 parent 0618dfe commit 24497f5
Show file tree
Hide file tree
Showing 7 changed files with 544 additions and 320 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ build
web/prod/basement_floor.jpg
web/prod/first_floor.jpg
web/prod/ground_floor.jpg
web/prod/second_floor.jpg
web/prod/second_floor.jpg
goptivum
7 changes: 3 additions & 4 deletions app/.env.template
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
REDIS_DB_ADDRESS = "localhost:6379"
REDIS_DB_PASSWORD = ""
REDIS_DB_INDEX = "0"
DB_FILE_PATH = "./db"

GIN_MODE = "debug"
GIN_MODE = "release"
DIST_PATH = "./dist"

CONFIG_PATH = "./"
CONFIG_TYPE = "json"
CONFIG_PURPOSE = "prod"

OPENWEATHER_API_KEY = ""
2 changes: 1 addition & 1 deletion core/sse/sse.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (h *Hub) Run() {
select {
case client := <-h.register:
h.mu.Lock()
if int16(len(h.clients)) < h.maxClients {
if len(h.clients) < int(h.maxClients) {
h.clients[client] = true
fmt.Println("client registered, total:", len(h.clients))
} else {
Expand Down
16 changes: 13 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ BUILD_DIR := $(PROJECT_ROOT)/build
CURRENT_BUILD_DIR := $(BUILD_DIR)/$(BINARY_NAME)
DIST_DIR := $(CURRENT_BUILD_DIR)/dist

DEPLOY_HOST := razul-server.local
DEPLOY_USER := goptivum
DEPLOY_DIR := /home/$(DEPLOY_USER)/$(PROJECT_NAME)

.PHONY: all
all: build build-web-install

Expand All @@ -33,11 +37,18 @@ build-web-install: | $(CURRENT_BUILD_DIR)
@mkdir -p $(DIST_DIR)
@cp -r $(FRONTEND_SOURCE_DIR)/dist/* $(DIST_DIR)

.PHONY:
.PHONY: run
run: | $(CURRENT_BUILD_DIR)
@echo "Running the application..."
@cd $(CURRENT_BUILD_DIR) && ./$(BINARY_NAME)

.PHONY: deploy
deploy: all
@echo "Deploying to razul-server.local..."
@rsync -avz --delete $(BUILD_DIR)/$(PROJECT_NAME)/ [email protected]:~/$(PROJECT_NAME)
@ssh [email protected] 'sudo systemctl restart goptivum && sudo systemctl reload nginx'
@echo "Deployment complete."

$(CURRENT_BUILD_DIR):
@mkdir -p $(CURRENT_BUILD_DIR)

Expand All @@ -54,7 +65,6 @@ help:
@echo " make build-web Build the Vue.js frontend without installing NPM dependencies"
@echo " make build-web-install Build the Vue.js frontend and install NPM dependencies"
@echo " make run Run the application"
@echo " make deploy Deploy the application to the remote server"
@echo " make clean Clean up build files"
@echo " make help Show this help message"

.PHONY: build build-web build-web-install run clean help
Loading

0 comments on commit 24497f5

Please sign in to comment.