Skip to content
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
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ checksum:
name_template: "checksums.txt"

snapshot:
name_template: "{{.Tag}}"
name_template: "{{ .Tag }}"

changelog:
sort: asc
Expand Down
16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
# This Dockerfile used ONLY with GoReleaser project (`task release [TAG...]`).
# Please DO NOT use it for build a normal Docker image for Create Go App CLI!

FROM alpine:3.12

LABEL maintainer="Vic Shóstak <truewebartisans@gmail.com>"

# Copy Create Go App binary.
# Copy Create Go App CLI binary.
COPY cgapp /cgapp

# Install git, npm.
# Install git, npm (with nodejs).
RUN apk add --no-cache git npm

# Install frontend CLIs.
RUN npm i -g -s create-react-app preact-cli @vue/cli degit @angular/cli
# Install frontend CLIs (globally and in silent mode).
RUN npm i -g -s \
create-react-app \
preact-cli \
@vue/cli \
@angular/cli \
degit

# Set entry point.
ENTRYPOINT ["/cgapp"]
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</h1>
<p align="center">Create a new production-ready project with <b>backend</b> (Golang), <b>frontend</b> (JavaScript, TypeScript)<br/>and <b>deploy automation</b> (Ansible, Docker) by running one CLI command.<br/><br/>Focus on <b>writing</b> code and <b>thinking</b> of business-logic! The CLI will take care of the rest.</p>

<p align="center"><a href="https://github.com/create-go-app/cli/releases" target="_blank"><img src="https://img.shields.io/badge/version-v1.5.2-blue?style=for-the-badge&logo=none" alt="cli version" /></a>&nbsp;<a href="https://pkg.go.dev/github.com/create-go-app/cli?tab=doc" target="_blank"><img src="https://img.shields.io/badge/Go-1.11+-00ADD8?style=for-the-badge&logo=go" alt="go version" /></a>&nbsp;<a href="https://gocover.io/github.com/create-go-app/cli/pkg/cgapp" target="_blank"><img src="https://img.shields.io/badge/Go_Cover-94%25-success?style=for-the-badge&logo=none" alt="go cover" /></a>&nbsp;<a href="https://goreportcard.com/report/github.com/create-go-app/cli" target="_blank"><img src="https://img.shields.io/badge/Go_report-A+-success?style=for-the-badge&logo=none" alt="go report" /></a>&nbsp;<img src="https://img.shields.io/badge/license-apache_2.0-red?style=for-the-badge&logo=none" alt="license" /></p>
<p align="center"><a href="https://github.com/create-go-app/cli/releases" target="_blank"><img src="https://img.shields.io/badge/version-v1.6.0-blue?style=for-the-badge&logo=none" alt="cli version" /></a>&nbsp;<a href="https://pkg.go.dev/github.com/create-go-app/cli?tab=doc" target="_blank"><img src="https://img.shields.io/badge/Go-1.11+-00ADD8?style=for-the-badge&logo=go" alt="go version" /></a>&nbsp;<a href="https://gocover.io/github.com/create-go-app/cli/pkg/cgapp" target="_blank"><img src="https://img.shields.io/badge/Go_Cover-94%25-success?style=for-the-badge&logo=none" alt="go cover" /></a>&nbsp;<a href="https://goreportcard.com/report/github.com/create-go-app/cli" target="_blank"><img src="https://img.shields.io/badge/Go_report-A+-success?style=for-the-badge&logo=none" alt="go report" /></a>&nbsp;<img src="https://img.shields.io/badge/license-apache_2.0-red?style=for-the-badge&logo=none" alt="license" /></p>

## ⚡️ [Quick start](https://create-go.app/quick-start/)

Expand Down Expand Up @@ -141,13 +141,6 @@ project:
# like `github.com/user/template`
- webserver: nginx

# Web/proxy server for your project.
# (Optional, to skip set to `none`)
# String: `postgres`
# User template: supported, set to URL (without protocol),
# like `github.com/user/template`
- database: postgres

# Automation config.
roles:
# Ansible roles for deploy your project.
Expand Down Expand Up @@ -270,10 +263,6 @@ cgapp deploy --use-config

- [x] [`nginx`](https://create-go.app/docker-containers/nginx/) — Docker container with [Nginx](https://nginx.org).

**Database:**

- [ ] [`postgres`](https://create-go.app/docker-containers/postgres/) _WIP_ — Docker container with [PostgreSQL](https://postgresql.org).

## 🤔 Why another CLI?

When we started this project, we asked ourselves this question too and... came to the conclusion, that approximately 8 out of 10 routine operations at the start of a new project and/or the deployment of an existing one **can be automated**. And it would be better to have all the necessary functions inside one CLI. That's why we transferred all our experience to the Create Go App CLI, which we use ourselves!
Expand Down
21 changes: 1 addition & 20 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ var runCreateCmd = func(cmd *cobra.Command, args []string) {
backend = strings.ToLower(projectConfig["backend"].(string))
frontend = strings.ToLower(projectConfig["frontend"].(string))
webserver = strings.ToLower(projectConfig["webserver"].(string))
database = strings.ToLower(projectConfig["database"].(string))

// Check, if config file contains `roles` section
if rolesConfig != nil {
Expand Down Expand Up @@ -85,7 +84,6 @@ var runCreateCmd = func(cmd *cobra.Command, args []string) {
backend = strings.ToLower(createAnswers.Backend)
frontend = strings.ToLower(createAnswers.Frontend)
webserver = strings.ToLower(createAnswers.Webserver)
database = strings.ToLower(createAnswers.Database)
installAnsibleRoles = createAnswers.InstallAnsibleRoles
}

Expand Down Expand Up @@ -161,7 +159,7 @@ var runCreateCmd = func(cmd *cobra.Command, args []string) {
}

// Docker containers.
if webserver != "none" || database != "none" {
if webserver != "none" {

cgapp.SendMsg(true, "* * *", "Configuring Docker containers...", "yellow", false)

Expand All @@ -181,23 +179,6 @@ var runCreateCmd = func(cmd *cobra.Command, args []string) {
os.Exit(1)
}
}

if database != "none" {
// Create container with a database.
cgapp.SendMsg(true, "*", "Create container with database...", "cyan", true)
if err := cgapp.CreateProjectFromRegistry(
&registry.Project{
Type: "database",
Name: database,
RootFolder: currentDir,
},
registry.Repositories,
registry.RegexpDatabasePattern,
); err != nil {
cgapp.SendMsg(true, "[ERROR]", err.Error(), "red", true)
os.Exit(1)
}
}
}

// Stop timer
Expand Down
7 changes: 0 additions & 7 deletions configs/.cgapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ project:
# like `github.com/user/template`
- webserver: nginx

# Web/proxy server for your project.
# (Optional, to skip set to `none`)
# String: `postgres`
# User template: supported, set to URL (without protocol),
# like `github.com/user/template`
- database: postgres

# Automation config.
roles:
# Ansible roles for deploy your project.
Expand Down
31 changes: 0 additions & 31 deletions configs/deploy-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
path: ./webserver
register: webserver_folder

- name: Check, if ./database directory is exists
stat:
path: ./database
register: database_folder

#
# The block that builds and runs the backend part of the project.
#
Expand Down Expand Up @@ -94,29 +89,3 @@
state: started
# Run block only if ./webserver is a folder and exists.
when: webserver_folder.stat.exists and webserver_folder.stat.isdir

#
# The block that builds and runs the database part of the project.
#
- name: Database block
block:
- name: Builds Docker image for database
docker_image:
name: cgapp_database # name of the database image
build:
path: ./database # folder with Dockerfile
pull: yes
source: build

- name: Runs Docker container with database
docker_container:
name: cgapp-database # name of the database container
image: cgapp_database:latest
recreate: yes
networks:
- name: "{{ network_name }}"
ports:
- "5432:5432"
state: started
# Run block only if ./database is a folder and exists.
when: database_folder.stat.exists and database_folder.stat.isdir
13 changes: 0 additions & 13 deletions pkg/cgapp/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@ func TestCreateProjectFromRegistry(t *testing.T) {
},
false,
},
{
"successfully created database",
args{
p: &registry.Project{
Type: "database",
Name: "postgres",
RootFolder: "../../tmp",
},
r: registry.Repositories,
m: registry.RegexpDatabasePattern,
},
false,
},
{
"failed to create (not valid repository)",
args{
Expand Down
4 changes: 2 additions & 2 deletions pkg/embed/blob.go

Large diffs are not rendered by default.

20 changes: 1 addition & 19 deletions pkg/registry/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import "github.com/AlecAivazis/survey/v2"

const (
// CLIVersion version of Create Go App CLI.
CLIVersion = "1.5.2"
CLIVersion = "1.6.0"
// RegexpAnsiblePattern pattern for Ansible roles.
RegexpAnsiblePattern = "^(deploy)$"
// RegexpBackendPattern pattern for backend.
Expand All @@ -39,8 +39,6 @@ const (
RegexpFrontendPattern = "^(p?react:?|vue(:?[\\w]+)?(:?[\\w-_0-9\\/]+)?|angular|svelte|sapper:?)"
// RegexpWebServerPattern pattern for web/proxy servers.
RegexpWebServerPattern = "^(nginx)$"
// RegexpDatabasePattern pattern for databases.
RegexpDatabasePattern = "^(postgres)$"
)

// Project struct for describe project.
Expand All @@ -67,7 +65,6 @@ type CreateAnswers struct {
Backend string
Frontend string
Webserver string
Database string
InstallAnsibleRoles bool `survey:"roles"`
AgreeCreation bool `survey:"agree"`
}
Expand Down Expand Up @@ -99,13 +96,6 @@ var (
"nginx": "github.com/create-go-app/nginx-docker",
},
},

// Docker containers with databases.
"database": {
List: map[string]string{
"postgres": "github.com/create-go-app/postgres-docker",
},
},
}

// Commands collection.
Expand Down Expand Up @@ -178,14 +168,6 @@ var (
Default: "none",
},
},
{
Name: "database",
Prompt: &survey.Select{
Message: "Choose a database:",
Options: []string{"none", "Postgres"},
Default: "none",
},
},
{
Name: "roles",
Prompt: &survey.Confirm{
Expand Down