-
Notifications
You must be signed in to change notification settings - Fork 261
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 #3 from create-go-app/dev
Dev > v1.3.0
- Loading branch information
Showing
46 changed files
with
2,130 additions
and
861 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
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
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 |
---|---|---|
|
@@ -5,8 +5,10 @@ | |
**/app/ | ||
**/build/ | ||
**/dist/ | ||
**/cgapp-project/ | ||
|
||
# Tests | ||
*.out | ||
**/tmp/ | ||
|
||
# Embed file | ||
|
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
Apache License | ||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|
@@ -186,7 +187,7 @@ | |
same "printed page" as the copyright notice for easier | ||
identification within third-party archives. | ||
|
||
Copyright 2019-present Vic Shóstak <[email protected]> (https://1wa.co) | ||
Copyright 2020 Vic Shóstak <[email protected]> (https://1wa.co) | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
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 |
---|---|---|
|
@@ -2,30 +2,30 @@ | |
<img src="https://github.com/create-go-app/cli/blob/master/.github/images/[email protected]" width="224px"/><br/> | ||
Create Go App CLI | ||
</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 code</b>! The CLI will take care of the rest.</p> | ||
<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.2.1-blue?style=for-the-badge&logo=none" alt="cli version" /></a> <a href="https://pkg.go.dev/github.com/create-go-app/cli/pkg/cgapp?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> <a href="https://gocover.io/github.com/create-go-app/cli/pkg/cgapp" target="_blank"><img src="https://img.shields.io/badge/Go_Cover-98%25-success?style=for-the-badge&logo=none" alt="go cover" /></a> <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> <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.3.0-blue?style=for-the-badge&logo=none" alt="cli version" /></a> <a href="https://pkg.go.dev/github.com/create-go-app/cli/cmd?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> <a href="https://gocover.io/github.com/create-go-app/cli/cmd" target="_blank"><img src="https://img.shields.io/badge/Go_Cover-84%25-success?style=for-the-badge&logo=none" alt="go cover" /></a> <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> <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/) | ||
|
||
First of all, [download](https://golang.org/dl/) and install Go. Version `1.11` or higher is required. | ||
First of all, [download](https://golang.org/dl/) and install **Go**. Version `1.11` or higher is required. | ||
|
||
Installation is done by using the [`go build`](https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies) command with `$GOPATH/bin`: | ||
|
||
```bash | ||
go build -i -o $GOPATH/bin/cgapp github.com/create-go-app/cli | ||
``` | ||
|
||
Let's create a new project into `./app` folder with [Fiber](https://github.com/gofiber/fiber) as backend and [Nginx](https://nginx.org/) as web server: | ||
Let's create a new project via **interactive console UI** (or **CUI**) into current folder: | ||
|
||
```bash | ||
cgapp create -p ./app -b fiber -w nginx | ||
cgapp create | ||
``` | ||
|
||
Okay, it works! Now, you can deploy this project to a remote server or run on your local machine in isolated Docker containers. Go to the root project folder and type command: | ||
Okay, it works! Now, you can run this project on your **local machine** or deploy to a **remote server**. Project works in isolated Docker containers and automates via Ansible playbook: | ||
|
||
```bash | ||
cgapp deploy -u john_doe --ask-become-pass | ||
cgapp deploy | ||
``` | ||
|
||
That's all you need to start! 🎉 | ||
|
@@ -40,6 +40,7 @@ Unfortunately, we are unable to include all helpful documentation to the `README | |
- [CLI Installation](https://create-go.app/detailed-guides/installation/) | ||
- [Alternative installations](https://create-go.app/detailed-guides/installation/#alternative-installations) | ||
- [Understanding CLI commands and options](https://create-go.app/detailed-guides/commands-and-options/) | ||
- [`init`](https://create-go.app/detailed-guides/commands-and-options/#init) | ||
- [`create`](https://create-go.app/detailed-guides/commands-and-options/#create) | ||
- [`deploy`](https://create-go.app/detailed-guides/commands-and-options/#deploy) | ||
- [Run project on your local machine](https://create-go.app/detailed-guides/run-on-local/) | ||
|
@@ -53,67 +54,159 @@ Unfortunately, we are unable to include all helpful documentation to the `README | |
|
||
## ⚙️ [Commands & Options](https://create-go.app/detailed-guides/commands-and-options/) | ||
|
||
### `create` | ||
### [`init`](https://create-go.app/detailed-guides/commands-and-options/#init) | ||
|
||
CLI command for generate a default `.cgapp.yml` config file in current folder: | ||
|
||
```bash | ||
cgapp init | ||
``` | ||
|
||
<details> | ||
<summary>Generated config file</summary> | ||
|
||
<br/> | ||
|
||
```yaml | ||
# Project config. | ||
project: | ||
# Backend for your project. | ||
# (Required) | ||
# String: `net/http`, `fiber`, `echo`, `gin` | ||
# User template: supported, set to URL (without protocol), | ||
# like `github.com/user/template` | ||
- backend: fiber | ||
# Frontend for your project. | ||
# (Optional, to skip set to `none`) | ||
# String: `react`, `react:<template>` `preact`, `preact:<template>`, `svelte` | ||
# User template: NOT supported! | ||
- frontend: svelte | ||
# Web/proxy server for your project. | ||
# (Optional, to skip set to `none`) | ||
# String: `nginx` | ||
# User template: supported, set to URL (without protocol), | ||
# 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. | ||
# (Optional, to skip set to empty or comment) | ||
# Objects list: `deploy` | ||
- deploy: | ||
# Username of remote's server or local's user. | ||
# (Required) | ||
username: root | ||
# If you need to deploy (or run) a project asking for a password | ||
# for the user, set `become` to `true`. This is equivalent of | ||
# `--ask-become-pass`, a standard Ansible argument to ask | ||
# for a privilege escalation password. | ||
# (Optional) | ||
become: true | ||
# Host name from your inventory file (usually, at /etc/ansible/hosts). | ||
# (Required) | ||
host: localhost | ||
# Name of Docker network | ||
# (Required) | ||
network: cgapp_network | ||
# Filename of Ansible playbook in the root of the Create Go App project. | ||
# If you want to rename it, do it, but not to change destination of file! | ||
# (Required) | ||
playbook: deploy-playbook.yml | ||
``` | ||
</details> | ||
### [`create`](https://create-go.app/detailed-guides/commands-and-options/#create) | ||
|
||
CLI command to create a new project with the selected configuration. | ||
|
||
There's two ways to create a new project: | ||
|
||
- [x] With an interactive console UI (or CUI). | ||
- [x] From configuration file (by default, in `$PWD/.cgapp.yml`). | ||
|
||
#### Create with the interactive console UI | ||
|
||
Run `create` command **without** any arguments: | ||
|
||
```bash | ||
cgapp create | ||
``` | ||
|
||
#### Create from the config file | ||
|
||
Run `create` command **with** `--use-config` (or `-c`) argument: | ||
|
||
```bash | ||
cgapp create -p <PATH> -b <BACKEND> -f <FRONTEND> -w <WEBSERVER> -d <DB> [ARGS...] | ||
cgapp create --use-config | ||
``` | ||
|
||
| Option | Argument | Required? | Description | Default value | | ||
| ------ | ----------- | --------- | --------------------------------- | -------------------- | | ||
| `-p` | `PATH` | no | path to create project | current folder, `./` | | ||
| `-b` | `BACKEND` | no | backend for your project | `net/http` | | ||
| `-f` | `FRONTEND` | no | frontend for your project | | | ||
| `-w` | `WEBSERVER` | no | web/proxy server for your project | | | ||
| `-d` | `DB` | no | database for your project | | | ||
### [`deploy`](https://create-go.app/detailed-guides/commands-and-options/#deploy) | ||
|
||
CLI command for deploy Docker containers with your project to a remote server. | ||
|
||
If you not need to install Ansible playbook and roles for your project, you can skip this by adding an `--skip-ansible-roles` argument in `[ARGS...]` section. | ||
> ☝️ You should only run this command from the **root folder** of your project, which created with the `cgapp create` command! It's a necessary condition for everything to work perfectly. | ||
|
||
### `deploy` | ||
There's, also, two ways to deploy your project: | ||
|
||
CLI command for deploy Docker containers with your project to a remote server or run on your local machine. | ||
- [x] With an interactive console UI (or CUI). | ||
- [x] From configuration file (by default, in `$PWD/.cgapp.yml`). | ||
|
||
#### Deploy with the interactive console UI | ||
|
||
Run `deploy` command **without** any arguments: | ||
|
||
```bash | ||
cgapp deploy -p <PLAYBOOK> -u <USER> -s <HOST> -n <NETWORK> [ARGS...] | ||
cgapp deploy | ||
``` | ||
|
||
| Option | Argument | Required? | Description | Default value | | ||
| ------ | ---------- | --------- | ---------------------------------------------- | --------------------- | | ||
| `-p` | `PLAYBOOK` | no | the Ansible playbook name | `deploy-playbook.yml` | | ||
| `-u` | `USER` | yes | an username of remote's server or local's user | | | ||
| `-s` | `HOST` | no | a host name from your inventory file | `localhost` | | ||
| `-n` | `NETWORK` | no | a network name for your Docker containers | `cgapp_network` | | ||
#### Deploy from the config file | ||
|
||
Run `deploy` command **with** `--use-config` (or `-c`) argument: | ||
|
||
If you need to deploy (or run) a project asking for a password for the `USER`, simply add an `--ask-become-pass` argument in `[ARGS...]` section. | ||
```bash | ||
cgapp deploy --use-config | ||
``` | ||
|
||
## 📝 [Production-ready project templates](https://create-go.app/production-templates/) | ||
|
||
**Golang:** | ||
**Backend:** | ||
|
||
- [x] [`net/http`](https://create-go.app/production-templates/net-http-go/) — Backend template with Golang built-in [net/http](https://golang.org/pkg/net/http/) package. | ||
- [x] [`fiber`](https://create-go.app/production-templates/fiber-go/) — Backend template with [Fiber](https://github.com/gofiber/fiber). | ||
- [ ] [`echo`](https://create-go.app/production-templates/echo-go/) _WIP_ — Backend template with [Echo](https://github.com/labstack/echo). | ||
- [ ] [`gin`](https://create-go.app/production-templates/gin-go/) _WIP_ — Backend template with [Gin](https://github.com/gin-gonic/gin). | ||
|
||
**JavaScript:** | ||
|
||
- [x] [`react-js`](https://create-go.app/production-templates/react-js/) — Frontend template with [React.js](https://github.com/facebook/react). | ||
- [x] [`preact`](https://create-go.app/production-templates/preact-js/) — Frontend template with [Preact](https://github.com/preactjs/preact). | ||
|
||
**TypeScript:** | ||
**Frontend:** | ||
|
||
- [x] [`react-ts`](https://create-go.app/production-templates/react-ts/) — Frontend template with [React.js](https://github.com/facebook/react) TypeScript. | ||
- [x] [`react`](https://create-go.app/production-templates/react-js/) — Frontend app with [React.js](https://reactjs.org). | ||
- [x] [`preact`](https://create-go.app/production-templates/preact-js/) — Frontend app with [Preact](https://preactjs.com). | ||
- [ ] [`vue`](https://create-go.app/production-templates/vue-js/) _WIP_ — Frontend app with [Vue.js](https://vuejs.org). | ||
- [x] [`svelte`](https://create-go.app/production-templates/svelte-js/) — Frontend app with [Svelte](https://svelte.dev). | ||
- [ ] [`angular`](https://create-go.app/production-templates/angular-js/) _WIP_ — Frontend app with [Angular](https://angular.io). | ||
|
||
## 🐳 [Configured Docker containers](https://create-go.app/docker-containers/) | ||
|
||
**Web/Proxy server:** | ||
|
||
- [x] [`nginx`](https://create-go.app/docker-containers/nginx/) — Docker container with Nginx. | ||
- [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. | ||
- [ ] [`postgres`](https://create-go.app/docker-containers/postgres/) _WIP_ — Docker container with [PostgreSQL](https://postgresql.org). | ||
|
||
## 🤔 Why another CLI? | ||
|
||
Yes, when we started this project, we asked ourselves this question too and... came to the conclusion, that about **8-10** routine steps in each project can be automated with a smart CLI. | ||
|
||
The Create Go App project allow you to prepare and deploy your project **without** any unnecessary headaches. | ||
|
||
## ⭐️ Project assistance | ||
|
||
|
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
Oops, something went wrong.