Skip to content

Autojidelna/api

Repository files navigation

autojidelna example api

Running the project

  1. Download golang

  2. Download and run postgres

  3. Add go bin to your path

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 ~/.zshrc

for 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@latest

create a temp directory for go executables

sudo mkdir -p /usr/local/go/bin/tmp

After that just run the project with

air

Developer tools

  • ent
    • for generating models. To regenerate models run go generate ./ent
  • air
    • for hot reloading the server. To run the server run air
  • swag
    • for generating swagger documentation. To regenerate swagger documentation run swag init
    • install with go install github.com/swaggo/swag/cmd/swag@latest

vscode extensions

  • golang
  • Run on Save
    • We use this to automatically generate ent models and swagger documentation on save

Deployment

  1. Download docker
  2. Enable docker buildx - just check the box Use containerd for pulling and storing images in docker desktop -> settings -> general
  3. Build the image
docker buildx build --platform linux/amd64,linux/arm64 -t registry.autojidelna.cz/autojidelna:latest .
  1. Push the image to the registry
docker push registry.autojidelna.cz/autojidelna:latest
  1. Deploy the image to the server
ssh autojidelna # ssh onto the server if you have access
sh deploy_docker.sh

About

Sandbox for the autojidelna app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors