for macos/linux
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.bashrc
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.zshrc
echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.zshrc
source ~/.bashrc
source ~/.zshrcfor windows
setx PATH "%PATH%;C:\Go\bin"
setx PATH "%PATH%;%USERPROFILE%\go\bin"after that install air with:
go install github.com/air-verse/air@latestcreate a temp directory for go executables
sudo mkdir -p /usr/local/go/bin/tmpAfter that just run the project with
air- ent
- for generating models. To regenerate models run
go generate ./ent
- for generating models. To regenerate models run
- air
- for hot reloading the server. To run the server run
air
- for hot reloading the server. To run the server run
- swag
- for generating swagger documentation. To regenerate swagger documentation run
swag init - install with
go install github.com/swaggo/swag/cmd/swag@latest
- for generating swagger documentation. To regenerate swagger documentation run
- golang
- Run on Save
- We use this to automatically generate ent models and swagger documentation on save
- Download docker
- Enable docker buildx - just check the box
Use containerd for pulling and storing imagesin docker desktop -> settings -> general - Build the image
docker buildx build --platform linux/amd64,linux/arm64 -t registry.autojidelna.cz/autojidelna:latest .- Push the image to the registry
docker push registry.autojidelna.cz/autojidelna:latest- Deploy the image to the server
ssh autojidelna # ssh onto the server if you have access
sh deploy_docker.sh