Skip to content

Commit

Permalink
prepare to release v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanh Nguyen committed Nov 23, 2022
1 parent b029564 commit 2fdf556
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .azure/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ stages:
- stage: build_dockerhub
displayName: Build image and publish to Docker Hub
dependsOn: test
#condition: eq(variables['branchDemoBuildChanged'], true)
condition: eq(variables['branchDemoBuildChanged'], true)
jobs:
- job: generate_build_publish
displayName: Generate project, build Docker image and publish
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/govueadmin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ jobs:
- name: Set up NodeJS env
uses: actions/setup-node@v3
with:
go-version: "12"
node-version: "12"
- name: Install go-giter8
run: |
# minimum go-giter8 v0.5.1 for "quiet" mode
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2021 Thanh Ba Nguyen
Copyright (c) 2020-2022 Thanh Ba Nguyen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
35 changes: 16 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,35 @@
[![codecov](https://codecov.io/gh/btnguyen2k/govueadmin.g8/branch/master/graph/badge.svg?token=HVAP5A0R2Z)](https://codecov.io/gh/btnguyen2k/govueadmin.g8)
[![Release](https://img.shields.io/github/release/btnguyen2k/govueadmin.g8.svg?style=flat-square)](RELEASE-NOTES.md)

Giter8 template to develop `Admin Control Panel` in Go with VueJS-based frontend.
Giter8 template to build `Admin Control Panel` for Go with VueJS-based frontend.

Demo: https://demo-govueadmin.gpvcloud.com/
Demo: https://demo-govueadmin.gpvcloud.com/.

## Features

- Create new project from template with [go-giter8](https://github.com/btnguyen2k/go-giter8).
- Frontend (GUI) built on [CoreUI for Vue.js](https://coreui.io/vue/).
- Backend (API) built on [Echo framework](https://echo.labstack.com).
- [Giter8](https://github.com/btnguyen2k/go-giter8) template.
- Single-page applicaton (SPA):
- Frontend (GUI) built on [CoreUI for Vue.js](https://coreui.io/vue/).
- Backend (API) built on [Echo framework](https://echo.labstack.com).
- I18n support:
- FE i18n support with [Vue-i18n](https://kazupon.github.io/vue-i18n/).
- BE i18n support with [goyai](https://github.com/btnguyen2k/goyai).
- Sample features:
- I18n support:
- FE using [Vue-i18n](https://kazupon.github.io/vue-i18n/).
- BE using [goyai](https://github.com/btnguyen2k/goyai).
- Login page & Logout
- Blog post management (list, create, update, delete)
- Dashboard/Feed
- Vote up/down on public blog posts
- BO & DAO:
- [AWS DynamoDB](https://aws.amazon.com/dynamodb/) implementation.
- [Azure Cosmos DB](https://azure.microsoft.com/services/cosmos-db/) implementation.
- [MongoDB](https://www.mongodb.com/) implementation.
- [PostgreSQL](https://www.postgresql.org/) implementation.
- [SQLite3](https://sqlite.org/index.html) implementation.
- BO & DAO implementation in AWS DynamoDB, Azure Cosmos DB, SQLite3, MySQL, PostgreSQL and MongoDB.
- Sample `Dockerfile` to package application as Docker image.
- Sample [GitHub Actions](https://docs.github.com/actions) workflow.


## Getting Started

### Install `go-giter8`

This a Giter8 template, so it is meant to be used in conjunction with a giter8 tool.
Since this is a template for Go application, it make sense to use [go-giter8](https://github.com/btnguyen2k/go-giter8).
Since this is a template for Go application, it makes sense to use [go-giter8](https://github.com/btnguyen2k/go-giter8).

See [go-giter8](https://github.com/btnguyen2k/go-giter8) website for installation guide.

Expand All @@ -58,14 +55,14 @@ Upon successful project creation, 2 sub-projects are created:

**Frontend**

The frontend is a VueJS-based project located under `fe-gui` directory and can be imported into ay VueJS-supported IDE.
Feel free to use it to develop your application's frontend.
The frontend is a VueJS-based project located under `fe-gui` directory and can be imported into any VueJS-supported IDE.
Feel free to use it as a reference or the starting point to build your awesome application's frontend.

> The frontend is built on [CoreUI v4 for Vue.js](https://coreui.io/vue/).
> The frontend is built on [CoreUI for Vue.js](https://coreui.io/vue/).
**Backend**

The backend is a Go project built on [Echo framework v4](https://echo.labstack.com) located under `be-api` directory.
The backend is a Go project built on [Echo framework](https://echo.labstack.com) located under `be-api` directory.
It purely provides APIs for frontend to call (e.g. it has no GUI) and can be opened by any Go-supported IDE.

> The backend is based on `goapi.g8` template. See [goapi.g8](https://github.com/btnguyen2k/goapi.g8) for API implementation guideline.
Expand Down
4 changes: 4 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- AB#54: Frontend migrated to [CoreUI for Vue.js](https://coreui.io/vue/) `v4.1.0`.
- AB#55: I18n support in BE using [goyai](https://github.com/btnguyen2k/goyai).
- AB#56: Migrate `dgrijalva/jwt-go` to `golang-jwt/jwt`.
- Others:
- BO & DAO: add MySQL support.
- Go libs update.

## 2021-07-17: template-v0.3.0

Expand Down
1 change: 0 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ git commit -m "$1"
git tag -f -a "$1" -m "$1"
git push origin "$1" -f
git push

223 changes: 223 additions & 0 deletions src/main/g8/.github/workflows/myapp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
name: myapp

on:
push:
branches-ignore: [ 'azure-pipelines' ]
pull_request:
branches: [ master ]

env:
FE_ROOT: './fe-gui'
BE_ROOT: './be-api'
BE_GO_TEST_PATH: './src/gvabe/bov2/user ./src/gvabe/bov2/blog'

jobs:
testWithDynamoDb:
name: Test with AWS DynamoDB
runs-on: ubuntu-latest
steps:
- name: Set up Go env
uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Check out code
uses: actions/checkout@v2
- name: Start AWS DynamoDB server
run: docker run -d --name dynamodb -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -inMemory -sharedDb
- name: Test
run: |
export TIMEZONE="Asia/Ho_Chi_Minh"
export AWS_REGION="us-west-2"
export AWS_ACCESS_KEY_ID="DUMMY"
export AWS_SECRET_ACCESS_KEY="DUMMY"
export AWS_DYNAMODB_ENDPOINT="http://localhost:8000"
cd $BE_ROOT
go test -v -count 1 -p 1 -cover -coverprofile=coverage_dynamodb.txt $BE_GO_TEST_PATH
- name: Codecov
uses: codecov/codecov-action@v3
with:
flags: dynamodb
name: dynamodb

testWithMongoStandalone:
name: Test with MongoDB (Standalone)
runs-on: ubuntu-latest
steps:
- name: Set up Go env
uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Check out code
uses: actions/checkout@v2
- name: Start MongoDB Standalone server
run: docker run -d --name mongodb -e MONGO_INITDB_ROOT_USERNAME=test -e MONGO_INITDB_ROOT_PASSWORD=test -e MONGO_INITDB_DATABASE=test -p 27017:27017 mongo:4.2
- name: Test
run: |
export TIMEZONE="Asia/Ho_Chi_Minh"
export MONGO_DB="test"
export MONGO_URL="mongodb://test:test@localhost:27017/?authSource=admin"
cd $BE_ROOT
go test -v -count 1 -p 1 -cover -coverprofile=coverage_mongo_standalone.txt $BE_GO_TEST_PATH
- name: Codecov
uses: codecov/codecov-action@v3
with:
flags: mongo_standalone
name: mongo_standalone

testWithMongoReplicaSet:
name: Test with MongoDB (ReplicaSet)
runs-on: ubuntu-latest
steps:
- name: Set up Go env
uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Check out code
uses: actions/checkout@v2
- name: Start MongoDB Standalone server
run: docker run -d --name mongodb-replset -e MONGODB_REPLICA_SET_MODE=primary -e MONGODB_REPLICA_SET_KEY=myreplset -e MONGODB_ADVERTISED_HOSTNAME=localhost -e MONGODB_PRIMARY_PORT_NUMBER=27017 -e MONGODB_ROOT_PASSWORD=test -e MONGODB_DATABASE=test -p 27017:27017 bitnami/mongodb:4.2
- name: Test
run: |
export TIMEZONE="Asia/Ho_Chi_Minh"
export MONGO_DB="test"
export MONGO_URL="mongodb://root:test@localhost:27017/?authSource=admin&replicaSet=replicaset"
cd $BE_ROOT
go test -v -count 1 -p 1 -cover -coverprofile=coverage_mongo_replicaset.txt $BE_GO_TEST_PATH
- name: Codecov
uses: codecov/codecov-action@v3
with:
flags: mongo_replicaset
name: mongo_replicaset

testWithMySQL:
name: Test with MySQL
runs-on: ubuntu-latest
steps:
- name: Set up Go env
uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Check out code
uses: actions/checkout@v2
- name: Start MySQL server
run: docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=test -e MYSQL_DATABASE=test -e MYSQL_USER=test -e MYSQL_PASSWORD=test -p 3306:3306 mysql:8
- name: Test (parseTime=false)
run: |
export TIMEZONE="Asia/Ho_Chi_Minh"
export MYSQL_DRIVER="mysql"
export MYSQL_URL="test:test@tcp(localhost:3306)/test?charset=utf8mb4,utf8&parseTime=false&loc=\${loc}"
cd $BE_ROOT
go test -v -count 1 -p 1 -cover -coverprofile=coverage_mysql.txt $BE_GO_TEST_PATH
- name: Test (parseTime=true)
run: |
export TIMEZONE="Asia/Ho_Chi_Minh"
export MYSQL_DRIVER="mysql"
export MYSQL_URL="test:test@tcp(localhost:3306)/test?charset=utf8mb4,utf8&parseTime=true&loc=\${loc}"
cd $BE_ROOT
go test -v -count 1 -p 1 -cover -coverprofile=coverage_mysql_parsetime.txt $BE_GO_TEST_PATH
- name: Codecov
uses: codecov/codecov-action@v3
with:
flags: mysql
name: mysql

testWithPostgreSQL:
name: Test with PostgreSQL
runs-on: ubuntu-latest
steps:
- name: Set up Go env
uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Check out code
uses: actions/checkout@v2
- name: Start PostgreSQL server
run: docker run -d --name postgres -e POSTGRES_DB=test -e POSTGRES_USER=test -e POSTGRES_PASSWORD=test -p 5432:5432 postgres:11
- name: Test
run: |
export TIMEZONE="Asia/Ho_Chi_Minh"
export PGSQL_DRIVER="pgx"
export PGSQL_URL="postgres://test:test@localhost:5432/test?sslmode=disable&client_encoding=UTF-8&application_name=godal"
cd $BE_ROOT
go test -v -count 1 -p 1 -cover -coverprofile=coverage_pgsql.txt $BE_GO_TEST_PATH
- name: Codecov
uses: codecov/codecov-action@v3
with:
flags: pgsql
name: pgsql

testWithSqlite:
name: Test with SQLite
runs-on: ubuntu-latest
steps:
- name: Set up Go env
uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Check out code
uses: actions/checkout@v2
- name: Test
run: |
export TIMEZONE="Asia/Ho_Chi_Minh"
cd $BE_ROOT
mkdir -p ./temp
export SQLITE_DRIVER="sqlite3"
export SQLITE_URL="$(pwd)/temp/temp.db"
go test -v -count 1 -p 1 -cover -coverprofile=coverage_sqlite.txt $BE_GO_TEST_PATH
- name: Codecov
uses: codecov/codecov-action@v3
with:
flags: sqlite
name: sqlite

testWithCosmosDbSql:
name: Test with Azure Cosmos DB (SQL API)
runs-on: windows-latest
steps:
- name: Set up Go env
uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Check out code
uses: actions/checkout@v2
- name: Test
run: |
choco install azure-cosmosdb-emulator
& "C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe"
Start-Sleep -s 120
try { Invoke-RestMethod -Method GET https://127.0.0.1:8081/ } catch {}
netstat -nt
$env:COSMOSDB_DRIVER='gocosmos'
$env:COSMOSDB_URL='AccountEndpoint=https://127.0.0.1:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=='
$env:TIMEZONE='Asia/Ho_Chi_Minh'
cd $env:BE_ROOT
go test -v -count 1 -p 1 -cover -coverprofile="coverage_cosmosdb_sql.txt" ./src/gvabe/bov2/user ./src/gvabe/bov2/blog
- name: Codecov
uses: codecov/codecov-action@v3
with:
flags: cosmosdb_sql
name: cosmosdb_sql

testDockerBuild:
name: Test with Docker build
runs-on: ubuntu-latest
steps:
- name: Set up Go env
uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Set up NodeJS env
uses: actions/setup-node@v3
with:
node-version: "12"
- name: Check out code
uses: actions/checkout@v2
- name: Build FE
run: |
cd $GITHUB_WORKSPACE/fe-gui && npm install && npm run build
- name: Build BE
run: |
cd $GITHUB_WORKSPACE/be-api && go build -tags netgo -a
- name: Build Docker image
run: |
cd $GITHUB_WORKSPACE && docker build -t test .
16 changes: 16 additions & 0 deletions src/main/g8/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

## Utility script to release project with a tag
## Usage:
## ./release.sh <tag-name>

if [ "$1" == "" ]; then
echo "Usage: $0 tag-name"
exit -1
fi

echo "$1"
git commit -m "$1"
git tag -f -a "$1" -m "$1"
git push origin "$1" -f
git push

0 comments on commit 2fdf556

Please sign in to comment.