<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Backend on AgStack Documentation</title><link>https://docs.agstack.org/inatrace/backend/</link><description>Recent content in Backend on AgStack Documentation</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://docs.agstack.org/inatrace/backend/index.xml" rel="self" type="application/rss+xml"/><item><title>Getting started</title><link>https://docs.agstack.org/inatrace/backend/getting-started/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.agstack.org/inatrace/backend/getting-started/</guid><description>&lt;p&gt;Running the INATrace backend on a development machine. Configuration is covered separately in &lt;a href="https://docs.agstack.org/inatrace/backend/configuration/"&gt;Configuration&lt;/a&gt;&#10;.&lt;/p&gt;&#10;&lt;h2 id="requirements"&gt;Requirements&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Java &lt;code&gt;17&lt;/code&gt; or higher&lt;/li&gt;&#10;&lt;li&gt;Maven &lt;code&gt;3.8.5&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;MySQL &lt;code&gt;8.4.11&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="optional"&gt;Optional&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Docker&lt;/li&gt;&#10;&lt;li&gt;Mailhog&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="how-to-run"&gt;How to run&lt;/h2&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Clone the repository&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Import as maven project to your preferred IDE&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Prepare environment&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;a href="#create-database"&gt;Create database&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;(&lt;em&gt;OPTIONAL&lt;/em&gt;) &lt;a href="#email-testing"&gt;Email testing&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://docs.agstack.org/inatrace/backend/configuration/"&gt;Spring configuration&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Run &lt;code&gt;INATraceBackendApplication.java&lt;/code&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h3 id="create-database"&gt;Create database&lt;/h3&gt;&#10;&lt;p&gt;Spin up a container:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;docker run --name inatrace-mysql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=inatrace -e MYSQL_USER=inatrace -e MYSQL_PASSWORD=inatrace -p 3306:3306 -d mysql:8.4.11&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Tables will be created and prefilled with starter data on application startup.&lt;/p&gt;</description></item><item><title>Configuration</title><link>https://docs.agstack.org/inatrace/backend/configuration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.agstack.org/inatrace/backend/configuration/</guid><description>&lt;p&gt;Every property the backend reads, grouped by what it configures.&lt;/p&gt;&#10;&lt;p&gt;Spring uses &lt;code&gt;application.properties&lt;/code&gt; file stored in &lt;code&gt;src/main/resources&lt;/code&gt; for configuration. A template is provided, see instructions below.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Make a copy of &lt;code&gt;application.properties.template&lt;/code&gt; and save it as &lt;code&gt;application.properties&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;Fill the missing values&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;em&gt;NOTE&lt;/em&gt;: The values defined below are applicable for a local development environment. For other environments, change the values accordingly.&lt;/p&gt;&#10;&lt;h2 id="datasource"&gt;Datasource&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;INATrace.database.name&lt;/code&gt;: &lt;code&gt;inatrace&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;spring.datasource.username&lt;/code&gt;: &lt;code&gt;inatrace&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;spring.datasource.password&lt;/code&gt;: &lt;code&gt;inatrace&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="smtp"&gt;SMTP&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;spring.mail.protocol&lt;/code&gt;: &lt;code&gt;smtp&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;spring.mail.host&lt;/code&gt;: &lt;code&gt;localhost&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;spring.mail.port&lt;/code&gt;: &lt;code&gt;1025&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;spring.mail.username&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;spring.mail.password&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;spring.mail.properties.mail.smtp.ssl.checkserveridentity&lt;/code&gt;: &lt;code&gt;false&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;spring.mail.properties.mail.smtps.auth&lt;/code&gt;: &lt;code&gt;false&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="email-template"&gt;Email template&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;INAtrace.mail.template.from&lt;/code&gt;: &lt;code&gt;info@inatrace.com&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;INAtrace.mail.redirect&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;INAtrace.mail.sendingEnabled&lt;/code&gt;: &lt;code&gt;true&lt;/code&gt; (&lt;code&gt;false&lt;/code&gt; by default)&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;INATrace.loginManager.mail&lt;/code&gt;: &lt;code&gt;registrations@inatrace.com&lt;/code&gt; (Email address to receive notifications for new registrations)&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;INAtrace.info.mail&lt;/code&gt;: &lt;code&gt;info@inatrace.com&lt;/code&gt; (Contact email)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="security"&gt;Security&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;INATrace.auth.jwtSigningKey&lt;/code&gt;: &lt;code&gt;sign&lt;/code&gt; (Key for signing JWT tokens)&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;INATrace.requestLog.token&lt;/code&gt;: &lt;code&gt;token&lt;/code&gt; (Key for authorizing log requests)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="storage"&gt;Storage&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;INATrace.fileStorage.root&lt;/code&gt;: Path on local filesystem for saving images, documents, etc. (e.g. &lt;code&gt;C:\\Users\\Name\\inatrace-backend&lt;/code&gt; or &lt;code&gt;/home/name/inatrace-backend&lt;/code&gt;)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="exchange-rates-api"&gt;Exchange rates API&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;INAtrace.exchangerate.apiKey&lt;/code&gt;: API key for exchange rate service. Create a free account at &lt;a href="https://exchangeratesapi.io/"&gt;https://exchangeratesapi.io&lt;/a&gt;&#10; to get an API key.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="beyco-integration"&gt;Beyco integration&lt;/h2&gt;&#10;&lt;p&gt;INATrace supports integration with the Beyco platform. This allows users to create Beyco offers automatically from INATrace stock orders. For more info about Beyco, please go to: &lt;code&gt;https://beyco.nl&lt;/code&gt;. This integration is optional. Integration properties are following:&lt;/p&gt;</description></item><item><title>API</title><link>https://docs.agstack.org/inatrace/backend/api/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.agstack.org/inatrace/backend/api/</guid><description>&lt;p&gt;How clients authenticate, where the generated OpenAPI definition lives, and what the common requests look like.&lt;/p&gt;&#10;&lt;h2 id="openapi"&gt;OpenAPI&lt;/h2&gt;&#10;&lt;p&gt;Resources are annotated with Swagger annotations. After the application is started, the Swagger service definition JSON is served at &lt;code&gt;http://localhost:8080/v3/api-docs&lt;/code&gt;, and Swagger UI is served at &lt;a href="http://localhost:8080/swagger-ui.html"&gt;http://localhost:8080/swagger-ui.html&lt;/a&gt;&#10;.&lt;/p&gt;&#10;&lt;p&gt;Both live at the root of the server rather than under &lt;code&gt;/api&lt;/code&gt;. Every endpoint the application itself defines is published under &lt;code&gt;/api&lt;/code&gt; — &lt;code&gt;PrefixedApiRequestHandler&lt;/code&gt; adds that prefix to the mappings in the &lt;code&gt;com.abelium&lt;/code&gt; packages — but springdoc&amp;rsquo;s own endpoints are not touched by it. &lt;code&gt;http://localhost:8080/api/swagger-ui.html&lt;/code&gt; does not exist.&lt;/p&gt;</description></item><item><title>Database</title><link>https://docs.agstack.org/inatrace/backend/database/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.agstack.org/inatrace/backend/database/</guid><description>&lt;p&gt;Connection parameters, the entity model, and how schema migrations run.&lt;/p&gt;&#10;&lt;h2 id="version"&gt;Version&lt;/h2&gt;&#10;&lt;p&gt;MySQL &lt;code&gt;8.4.11&lt;/code&gt;&lt;/p&gt;&#10;&lt;h2 id="connection"&gt;Connection&lt;/h2&gt;&#10;&lt;p&gt;If you are using a database management tool, use the following parameters to create a connection:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Hostname: &lt;code&gt;localhost&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;Port: &lt;code&gt;3306&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;Database: &lt;code&gt;inatrace&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;Username: &lt;code&gt;root&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;Password: &lt;code&gt;root&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;Use SSL: &lt;code&gt;true&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;Driver settings:&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;allowPublicKeyRetrieval&lt;/code&gt;: &lt;code&gt;true&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="entities"&gt;Entities&lt;/h2&gt;&#10;&lt;p&gt;A complete list of entities is available &lt;a href="https://github.com/agstack/inatrace-backend/tree/main/src/main/java/com/abelium/inatrace/db"&gt;here&lt;/a&gt;&#10;.&lt;/p&gt;&#10;&lt;p&gt;Below is the entity graph for an initialized INATrace database. The full-sized vector image can be found &lt;a href="images/inatrace_db.svg"&gt;here&lt;/a&gt;&#10;.&lt;/p&gt;</description></item><item><title>Building</title><link>https://docs.agstack.org/inatrace/backend/building/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.agstack.org/inatrace/backend/building/</guid><description>&lt;p&gt;Producing a runnable jar and a Docker image.&lt;/p&gt;&#10;&lt;p&gt;To build an executable &lt;code&gt;jar&lt;/code&gt; run the following command in the project root directory:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;mvn clean install&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="docker-image"&gt;Docker image&lt;/h2&gt;&#10;&lt;h3 id="base"&gt;Base&lt;/h3&gt;&#10;&lt;p&gt;&lt;code&gt;eclipse-temurin:17-jre&lt;/code&gt;&lt;/p&gt;&#10;&lt;p&gt;Since only the major version is specified, the build process will always pull the latest minor and patch versions automatically.&lt;/p&gt;&#10;&lt;h3 id="command-syntax"&gt;Command syntax&lt;/h3&gt;&#10;&lt;p&gt;To build and tag a Docker image run &lt;code&gt;docker-build.sh&lt;/code&gt; in the project root directory. The script runs &lt;code&gt;mvn clean package&lt;/code&gt; then builds and tags a Docker image with the resulting &lt;code&gt;jar&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>