# Using the provided Dev-image

We provide a ready-to-go image of a virtual machine, running Debian 12, for [VirtualBox](https://www.virtualbox.org/wiki/Downloads).

The machine is set up with all the required software and helper scripts, to enable development of custom codeunits.

The image is setup with MariaDB, Tomcat 8, Netbeans 11.3 and a java-project that automatically deploys to the local Tomcat instance and has access to the TS-API with javadoc.

If the image is connected to a bridged network, the database and webserver are accessible from other machines (port 3306 and 8080 are open). use the command `ip a` to find the IP of the machine.

The image is running Debian 12 with a custom LXDE interface.

### <span class="mw-headline" id="bkmrk-getting-the-image-ru-1">Getting the image running</span>

The image is buildt for VirtualBox, so install that.

Once you have the image downloaded, start the import wizard in VirtualBox (ctrl + i) and follow it.

Now you should be able to boot the VM. The username and password for the user is noted in the comment on the VM.

The machine includes the following programs:

- Firefox, to access the local Tomcat server
- NetBeans 11.3, to develop codeunits
- DBeaver CE 24, to access the local DB

### <span class="mw-headline" id="bkmrk-deploying-codeunits-1">Deploying codeunits</span>

To deploy your code to the local Tomcat instance do the following:

1. Open Netbeans
2. Build the project (right-click the project in the project-browser on the left and select build)
3. Copy the generated .jar file from `/home/developer/NetBeansProjects/[ApplicationName]/dist` to `/mnt/sda/deploy`
4. Clear the cache (open [http://localhost:8080/app/service?CacheClear](http://localhost:8080/app/service?CacheClear)) or go back to the app in firefox and select Administrator -&gt; Services -&gt; Cache control -&gt; Cache clear

### <span class="mw-headline" id="bkmrk-debugging-codeunits-1">Debugging codeunits</span>

Attach the NetBeans debugger to the local Tomat server:

Click "debug" in the top-left menu -&gt; click "attach debugger" -&gt; click "OK", the default settings should work

Add a breakpoint to your code by selecting the line number and try to invoke it from the browser.

### <span class="mw-headline" id="bkmrk-updating-the-api-and-1">Updating the API and platform</span>

To update the local environment to the latest version of the TS-API and TS Platform, open a terminal and execute the following commands.

```bash
updateAPI
ts -w app upgrade-alphaapp
```

You will be prompted to input the password for the user.