Bootstrap
Here we describe how to can start new Devotion projects.
New pure API project
Project creation
cd $GITPRIV && aldev bootstrap --name MyNewApi --web-less
This creates a new project in a folder called: ./my-new-api.
The Go API code is in the /api folder.
Running the new API
First, go into the project: cd my-new-api.
We run the API server with just:
aldev
Or, if you want more details about what's under the hood:
aldev -v
# or
aldev --verbose
You can learn more about aldev later, but what you can at least see from the logs is that it created 3 instances of your new API + a load balancer (Nginx) in front of them.
Which can be confirmed by checking with this:
podman ps
Developing & testing the API
You can start modifying the Go code in the /api folder.
More details about how it's architectured in the Goald documentation.
As soon as you save your changes, aldev will perform automatic operations, and locally re-deploy the updated server's instances.
Which allow for quick dev & test iterations.
Testing the API
To test, do this in another terminal window:
curl http://localhost:42042/rest/translation/fr\?Namespace\=Common
This should return a JSON response with translations.
If you repeat this request several times, you'll see in aldev's log that the load balancing is effective.
Deploying
Depending on what's configured in the .aldev.yaml file, CI/CD and infrastructure management can be assisted by aldev.
In particular:
- the config item
deploying > platforminfluences what files (e.g. Terraform configs)aldevgenerates to help with infra - the config item
deploying > cicdinfluences what files (form instance:.gitlab-ci.yml)aldevgenerates to help with CI/CD
For now:
- only the value
"azure"fordeploying > platformhas an effect: it triggers the creation of Terraform Azure configs in thedeploy/remotefolder - only the value
"gitlab"fordeploying > cicd, in conjonction withdeploying > platform = azurehas an effect: it triggers the creation of a.gitlab-ci.ymlfile, which help deploying to Azure
First deployment steps
- Fill in the necessary deployment info in
.aldev.yaml- i.e. remove the???placeholders - Force the regeneration of all the config files with
aldev confgen --regenoraldev confgen -r - Git-push the code to its remote
mainbranch to deploy to theSANDBOXenvironment (for instance:dev)- Git-tag (
git tag v0.0.1), andgit push --tags, to deploy to theSTAGINGenvironment (for instance:qua) - Manually trigger the production deploy job to deploy to the
PRODUCTIONenvironment (for instance:prd)
- Git-tag (
- Go into the
deploy/remotefolder and use the IaC configs- For instance, if
platform = azure, runterraform applyfrom within each subfolder ofdeploy/remote
- For instance, if
- Test the deployment has gone ok