Hello, friends! 😉 I'm excited to share great news with you: the Create Go App CLI project, that I've been working on for a long time, has finally been updated to major version
☝️ You only need to focus on writing code and thinking of business-logic! The CLI will take care of the rest.
OK. Let's look at the changes together! Fasten your seat belts, we're starting.
- New in v2 and beyond
- Changes in CLI commands
- Ansible roles
- Project Wiki page
- Your assistance to the project
There are actually quite a few changes, but I've highlighted a few of the most important ones that change the way you work with the Create Go App CLI. For all other changes, please read the release notes in our GitHub repository:
This release was aimed primarily at speeding up the CLI and reducing the functionality of commands that were too overloaded.
After some analysis of the CLI command feedback, we concluded that the command to create a configuration file is very rarely used. The same comment from the focus group of our users, followed about the configuration file itself.
The most popular comment we got, was something like this:
— [...] nobody likes setting up yet another config for yet another CLI!
So, it was decided to remove
init command and file-based config
.cgapp.yml completely, even without the possibility of backward compatibility, which we successfully did in
The central CLI command has been redesigned, and its execution time has been reduced to 2-4 seconds. This was achieved by switching to generating the frontend part of the project using ready-made templates from the awesome next generation frontend tooling called Vite.js.
Now, you can choose between this frontend frameworks/libraries:
⚠️ Please note! Creating a new project is done only through the console interface (or CUI for short).
Create a new project from the custom backend and frontend templates (from your git repositories) is done by using
-t option with
||Enables to define custom backend and frontend templates.||
The structure of the created project will be as follows:
. ├── .editorconfig ├── .gitattributes ├── .gitignore ├── hosts.ini # <-- file with Ansible inventory variables ├── playbook.yml # <-- file with Ansible playbook ├── Makefile ├── backend # <-- folder with Go backend │ └── ... ├── frontend # <-- folder with JS/TS frontend (if you choose) │ └── ... └── roles # <-- folder with Ansible roles ├── backend │ └── ... ├── docker │ └── ... ├── postgres │ └── ... ├── redis │ └── ... └── traefik # or nginx (if you choose) └── ...
Watch a short video presentation:
Direct link: https://recordit.co/OQAwkZBrjN
Also, we have seriously reworked the principle of deploying the project on a remote server. The only option left for the
deploy command is the default password call for the sudo user:
||Prompt you to provide the remote user sudo password (a standard Ansible
Watch a short video presentation:
Direct link: https://recordit.co/ishTf0Au1x
Starting with version
v2.0.0 we will actively add new Ansible roles to make the process of deploying your project to remote servers as comfortable and fast as possible.
So, now all the configuration for deployment will be in the Ansible inventory
hosts.ini (in the root of the created project). For example, this is what the inventory looks like for deploying a project with the Nginx web server:
# ./hosts.ini # Ansible inventory for deploy the Create Go App project. # Author: Vic Shóstak <firstname.lastname@example.org> (https://shostak.dev) # For more information, please visit https://create-go.app/ [cgapp_project] 127.0.0.1 # CHANGE THIS TO YOUR REMOTE SERVER IP! [cgapp_project:vars] # # Ansible default variables to start playbook: # # Set remote sudo username ansible_user=root # Ask become password for remote sudo user ansible_become=yes # Set connection type to remote server (usually, 'ssh') ansible_connection=ssh # Set Python 3 default path ansible_python_interpreter=/usr/bin/python3 # # Remote server configuration: # # Set directory on your remote server # for store project files server_dir=/var/www/cgapp # Set user (owner of files/folders) name server_user=root # Set group name server_group=docker # # Project configuration: # # Set your project domain project_domain=example.com # # Docker configuration: # # Set Docker network name docker_network=cgapp_network # # Backend configuration: # # Set backend port number, # MUST BE MATCH to the port that is listed # in your `./backend/.env` file! backend_port=5000 # # PostgreSQL configuration (backend DB): # # Set PostgreSQL version (for example, 13.2) postgres_version=latest # Set PostgreSQL port number, # MUST BE MATCH to the port that is listed # in your `./backend/.env` file! postgres_port=5432 # Set PostgreSQL user name, # MUST BE MATCH to the user name that is listed # in your `./backend/.env` file! postgres_user=postgres # Set PostgreSQL password, # MUST BE MATCH to the password that is listed # in your `./backend/.env` file! postgres_password=password # Set PostgreSQL DB name, # MUST BE MATCH to the DB name that is listed # in your `./backend/.env` file! postgres_db=postgres # Set PostgreSQL SSL mode state ('enabled' or 'disabled'), # MUST BE MATCH to the SSL mode state that is listed # in your `./backend/.env` file! postgres_ssl_mode=disable # # Go-Migrate configuration: # # Set migration number, # if you WANT to migrate all of your migrations, # just leave it blank, # for only initial migration set it to '1' migrate_number=1 # # Redis configuration (backend cache): # # Set Redis version (for example, 6.2) redis_version=latest # Set Redis port number, # MUST BE MATCH to the port that is listed # in your `./backend/.env` file! redis_port=6379 # # Nginx configuration: # # Set Nginx version (for example, 1.20-alpine) nginx_version=alpine # Set redirect from HTTP to HTTPS for default server nginx_use_only_https=yes # Set redirect from WWW to non-WWW domain for default server nginx_redirect_to_non_www=yes
We're recommending to use Traefik Proxy as default proxy server for your projects. The main reason: this proxy provides automatic SSL certificates from Let's Encrypt with renew out of the box.
Also, Traefik was built on the Docker ecosystem and has a really useful Web UI:
List of roles:
traefik— configured Traefik container with a simple ACME challenge via CA server.
traefik-acme-dns— configured Traefik container with a complex ACME challenge via DNS provider.
nginx— pure Nginx container with "the best practice" configuration.
List of roles:
postgres— configured PostgreSQL container with apply migrations (by golang-migrate/migrate tool) for backend.
List of roles:
redis— configured Redis container to store the backend cache.
Soon, we plan to move completely to the GitHub Wiki and do away with the separate documentation on our website for the project.
— Everything should be in one place, — as focus group users correctly noted.
This is a table of contents for the Create Go App Wiki:
- How the CLI works
- CLI commands
- Errors in the process
- Frequently asked questions
If you want to say thank you or/and support active development of project:
- Add a GitHub Star to the project.
- Tweet about project on your Twitter.
- Write interesting articles about project on Dev.to, Medium or personal blog.
- Join DigitalOcean at our referral link (your profit is $100 and we get $25).
Together, we can make this project better every day!
- Vic Shóstak https://shostak.dev
If you want more articles like this on this blog, then post a comment below and subscribe to me. Thanks! 😘
And, of course, you can support me by donating at LiberaPay. Each donation will be used to write new articles and develop non-profit open-source projects for the community.