-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Hossara/dev
Dev
- Loading branch information
Showing
90 changed files
with
4,739 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.idea | ||
config.json | ||
vendor | ||
|
||
# Added by goreleaser init: | ||
dist/ | ||
|
||
*.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# This is an example .goreleaser.yml file with some sensible defaults. | ||
# Make sure to check the documentation at https://goreleaser.com | ||
|
||
# The lines below are called `modelines`. See `:help modeline` | ||
# Feel free to remove those if you don't want/need to use them. | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj | ||
|
||
version: 2 | ||
|
||
before: | ||
hooks: | ||
# You may remove this if you don't use go modules. | ||
- go mod tidy | ||
# you may remove this if you don't need go generate | ||
- go generate ./... | ||
|
||
builds: | ||
- main: ./cmd/cli | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
|
||
archives: | ||
- format: tar.gz | ||
# this name template makes the OS and Arch compatible with the results of `uname`. | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- title .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
# use zip for windows archives | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
nfpms: | ||
- id: deb | ||
formats: | ||
- deb | ||
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
maintainer: "Hossein Araghi <hoseinaraghi84@gmail.com>" | ||
description: "A simple chatroom client/server based on Nats and implemented using Golang." | ||
license: MIT | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
|
||
release: | ||
footer: >- | ||
--- | ||
Released by [GoReleaser](https://github.com/goreleaser/goreleaser). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Variables | ||
ROOT_DIR := ./build | ||
|
||
NETWORK_NAME=linkin-chat-network | ||
|
||
DEV_COMPOSE:= \ | ||
-f $(ROOT_DIR)/nats/docker-compose.yaml \ | ||
-f $(ROOT_DIR)/redis/docker-compose.dev.yaml \ | ||
-f $(ROOT_DIR)/postgres/docker-compose.dev.yaml \ | ||
|
||
PROD_COMPOSE:= \ | ||
-f $(ROOT_DIR)/nats/docker-compose.yaml \ | ||
-f $(ROOT_DIR)/redis/docker-compose.prod.yaml \ | ||
-f $(ROOT_DIR)/postgres/docker-compose.prod.yaml \ | ||
-f $(ROOT_DIR)/server/docker-compose.yaml | ||
|
||
# Functions | ||
ensure-network: | ||
@echo "Ensuring project network is exists..." | ||
@if [ -z "$$(docker network ls --filter name=$(NETWORK_NAME) --format '{{.Name}}')" ]; then \ | ||
echo "Network $(NETWORK_NAME) does not exist. Creating..."; \ | ||
docker network create $(NETWORK_NAME); \ | ||
fi | ||
|
||
# CLI | ||
create_release: | ||
goreleaser release --snapshot --clean | ||
|
||
.PHONY: create_release | ||
|
||
# Server Development | ||
dev_up: ensure-network | ||
@docker compose --project-directory $(ROOT_DIR) $(DEV_COMPOSE) up -d | ||
|
||
dev_uplog: ensure-network | ||
@docker compose --project-directory $(ROOT_DIR) $(DEV_COMPOSE) up | ||
|
||
dev_down: ensure-network | ||
docker compose --project-directory $(ROOT_DIR) $(DEV_COMPOSE) down | ||
|
||
dev_build: ensure-network | ||
@docker compose --project-directory $(ROOT_DIR) $(DEV_COMPOSE) build $(FLAGS) $(CONTAINER) | ||
|
||
dev_logs: ensure-network | ||
@docker compose --project-directory $(ROOT_DIR) $(DEV_COMPOSE) logs -f | ||
|
||
dev_rebuild: ensure-network | ||
@docker compose --project-directory $(ROOT_DIR) $(DEV_COMPOSE) up --build | ||
|
||
.PHONY: dev_up dev_uplog dev_down dev_build dev_logs dev_rebuild | ||
|
||
# Server Deployment | ||
deploy: ensure-network | ||
docker compose --project-directory $(ROOT_DIR) $(PROD_COMPOSE) up -d | ||
|
||
deploy-down: ensure-network | ||
docker compose --project-directory $(ROOT_DIR) $(PROD_COMPOSE) down | ||
|
||
deploy-logs: ensure-network | ||
docker compose --project-directory $(ROOT_DIR) $(PROD_COMPOSE) logs -f | ||
|
||
deploy-log: ensure-network | ||
docker compose --project-directory $(ROOT_DIR) $(PROD_COMPOSE) logs -f $(CONTAINER) | ||
|
||
deploy-build: ensure-network | ||
docker compose --project-directory $(ROOT_DIR) $(PROD_COMPOSE) build $(FLAGS) $(CONTAINER) | ||
|
||
.PHONY: deploy deploy-down deploy-logs deploy-logs deploy-build |
Oops, something went wrong.