Skip to content
Vic Shóstak edited this page Jul 7, 2023 · 17 revisions

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 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 this project, which we use ourselves!

So, yes, this CLI gives you the ability to prepare everything you need to start a new project (as create-react-app for the React ecosystem does) and deploy an existing project to a remote server in configured Docker containers.

Docs and code for the older CLI version

If you are looking for documentation or code for the older CLI version, it is here:

Instructions for deploy the project

We're strongly recommended to use Docker-ready (pre-installed) virtual servers to easily deploy your project. All modern cloud platforms provide such presets out of the box. For example, at DigitalOcean you can set up that droplet preset here:

do screenshot

Next, all you have to do is create a new server (or droplet), generate SSH key to authenticate your computer to this remote server, fill in Ansible inventory file (hosts.ini) with your credentials and run the cgapp -deploy command from the project root folder!

Use custom Ansible roles

If you want or need to use your own roles, you can do it quite easily. Just follow the consistent structure of your role as described in the Ansible User Guide, and make sure you do only three things:

  1. Place the role in the ./roles folder at the root of the project.
  2. Edit the ./playbook.yml file, like this:
# ...
- name: Deploy the Create Go App project
  hosts: cgapp_project

  # ...
  roles:
    # ...other roles...
    - { role: my_role, tags: [my_role, another_tag] }
  1. Next, start the deployment process as usual with the cgapp -deploy command.

🔔 Note especially the order in which the roles are specified! Ansible will execute them by default in a strictly specified order (from top to bottom).

How to reduce the binary size of the CLI?

Sometimes even a few extra megabytes can give you a problem. With this command, you can reduce the size of the binary file without losing CLI functionality:

CGO_ENABLED=0 go install -ldflags="-s -w" github.com/create-go-app/cli/v5/cmd/cgapp@latest

👋 By the way, if you install the CLI by Homebrew or from Releases page of this repository, you're already have this optimization.

How to install older CLI version?

Found all available CLI versions on our pkg.go.dev page, choose any version you want and run this command, where X.X.X it's a needed version of the Create Go App CLI package:

# For v5:
go install github.com/create-go-app/cli/v4/cmd/[email protected]

# For v4:
go install github.com/create-go-app/cli/v4/cmd/[email protected]

# For v3:
go install github.com/create-go-app/cli/v3/cmd/[email protected]

# For v2:
go install github.com/create-go-app/cli/v2/cmd/[email protected]

# For v1:
go install github.com/create-go-app/[email protected]

🔔 Don't forget to rename binary after installation, according to the version you have installed! This must be done to avoid confusion with the latest version.