/pet-java-api

A pet project with API written with Java and auxiliary apps

Primary LanguageJavaMIT LicenseMIT

pet-java-api

Common Linters Terraform CI Java API CI Golang Exporter CI

A pet project with API written with Java and auxiliary apps.

Available here https://pja.alosenkov.site/

Instruments

Project Applications

app_api

An API application written in Java using Spring Boot framework. Based on Uploading and downloading files using Spring Boot REST API publication by Atta.

See also app_api/Development.md.

  • https://pja.alosenkov.site/ (index homepage). Shows a web page with a manual file upload form. Also shows already uploaded files.

  • https://pja.alosenkov.site/upload-file: API endpoint to post the file using HTTP request, e.g. using curl tool like this

    curl -F "file=@/path/to/file.txt" https://user:pass@pja.alosenkov.site/upload-file

    where user:pass is a credentials pair because API access is restricted.

    Successfull upload response example

    {"name":"file.txt","uri":"https://pja.alosenkov.site/download/file.txt","type":"text/plain","size":6}

app_exporter

This application exposes service metrics in Prometheus format. The application is written in Golang. See also app_exporter/Development.md.

Metrics are exposed only by user:pass credentials provided in request:

curl https://user:pass@pja.alosenkov.site/metrics

GitHub Actions Secrets

Variable Description Example
TF_API_TOKEN A token for Terraform Cloud auth XXXXXXXXX
DOCKER_USERNAME A Dockerhub login octocat
DOCKER_PASSWORD A Dockerhub password im-mona
DEPLOY_SSH_PRIVATE_KEY SSH private key content for app deploy -----BEGIN OPENSSH PRIVATE KEY----- ...
PJA_ANSIBLE_VAULT_PASS Ansible Vault decryption password secret-vault-pass
AWS_ACCESS_KEY_ID AWS IAM access key XXXX
AWS_SECRET_ACCESS_KEY AWS IAM secret access key YYYYY