cli

command module
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README


Create Go App CLI

Create a new production-ready project with backend (Golang), frontend (JavaScript, TypeScript)
and deploy automation (Ansible, Docker) by running one CLI command.

Focus on writing code and thinking of business-logic! The CLI will take care of the rest.

cli version go version go cover go report license

⚡️ Quick start

First of all, download and install Go. Version 1.11 or higher is required.

Installation is done by using the go build command with $GOPATH/bin:

go build -i -o $GOPATH/bin/cgapp github.com/create-go-app/cli

Let's create a new project via interactive console UI (or CUI) into current folder:

cgapp create

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:

cgapp deploy

That's all you need to start! 🎉

📖 Official Documentation

Unfortunately, we are unable to include all helpful documentation to the README file. That's why, the best way to better explore all the features of the Create Go App CLI is to read the Official Documentation.

🔥 We've put together a subject index specifically for you, so you can find any answer you want in seconds!

⚙️ Commands & Options

init

CLI command for generate a default .cgapp.yml config file in current folder:

cgapp init
Generated config file
# 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

create

CLI command to create a new project with the selected configuration.

There's two ways to create a new project:

  • With an interactive console UI (or CUI).
  • From configuration file (by default, in $PWD/.cgapp.yml).
Create with the interactive console UI

Run create command without any arguments:

cgapp create
Create from the config file

Run create command with --use-config (or -c) argument:

cgapp create --use-config

deploy

CLI command for deploy Docker containers with your project to a remote server.

☝️ 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.

There's, also, two ways to deploy your project:

  • With an interactive console UI (or CUI).
  • From configuration file (by default, in $PWD/.cgapp.yml).
Deploy with the interactive console UI

Run deploy command without any arguments:

cgapp deploy
Deploy from the config file

Run deploy command with --use-config (or -c) argument:

cgapp deploy --use-config

📝 Production-ready project templates

Backend:

Frontend:

🐳 Configured Docker containers

Web/Proxy server:

Database:

🤔 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

If you want to say thank you or/and support active development of Create Go App CLI:

Together, we can make this project better every day! 😘

⚠️ License

Create Go App CLI is free and open-source software licensed under the Apache 2.0 License. Official logo was created by Vic Shóstak and distributed under Creative Commons license (CC BY-SA 4.0 International).

Documentation

Overview

Copyright © 2020 Vic Shóstak <truewebartisans@gmail.com> (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. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
Package cmd includes all of the Create Go App CLI commands.
Package cmd includes all of the Create Go App CLI commands.
pkg
actions
Package actions includes actions for create a new project via the Create Go App CLI.
Package actions includes actions for create a new project via the Create Go App CLI.
embed
Package embed embed to binary all config files.
Package embed embed to binary all config files.
registry
Package registry includes available repositories & commands for the Create Go App CLI.
Package registry includes available repositories & commands for the Create Go App CLI.
utils
Package utils includes helpful utilities for the Create Go App CLI.
Package utils includes helpful utilities for the Create Go App CLI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL