Skip to content

Commit

Permalink
Merge pull request #105 from urbancamo/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
urbancamo authored Aug 13, 2024
2 parents fce09f9 + 2e84898 commit bc760d0
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<groupId>uk.m0nom</groupId>
<artifactId>adif-processor</artifactId>
<version>1.4.10</version>
<version>1.4.11-SNAPSHOT</version>

<name>ADIF Processor</name>
<url>https://github.com/urbancamo/adif-processor</url>
Expand Down
84 changes: 84 additions & 0 deletions src/doc/VPS-install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Installation on the Contabo VPS

## Installing Docker

- Install docker, following instructions at https://docs.docker.com/engine/install/ubuntu/
- Manage Docker as a non-root user following instructions at https://docs.docker.com/engine/install/linux-postinstall/
-

## Installing Prerequisites

Install the following packages:

```bash
sudo apt-get install -y default-jre
sudo apt-get install -y maven
```

## Installing Java

- Create a user account `adifproc`
- Clone the repository into `/home/adifproc/code`
- Create a directory for the log files `/home/adifproc/logs`
- Add the user to the docker group `sudo usermod -aG docker adifproc`

## Boot time configuration

Configure docker to start on boot:

```bash
sudo systemctl enable docker.service
sudo systemctl enable containerd.service`
```
Configure a watchdog to start and monitor the adifproc application:

```bash
sudo systemctl enable watchdog.service
sudo systemctl start watchdog.service
```

## Installing the application

Clone the repository into `/home/adifproc/code`


## Environment Variables
| Environment Variable | Value |
|------------------------|----------------|
| POSTGRES_DB | postgres |
| POSTGRES_HOST | localhost |
| POSTGRES_PASSWORD | <db_password> |
| POSTGRES_USERNAME | adifproc |
| QRZ_PASSWORD | <qrz_password> |
| QRZ_USERNAME | <qrz_username> |
| SPRING_PROFILES_ACTIVE | prod |


## Environment Variables on command line

Create a run script `adifproc.sh` with the following contents:

```bash
#!/bin/bash
# Set the environment variables
export POSTGRES_DB=postgres
export POSTGRES_HOST=localhost
export POSTGRES_PASSWORD=mysecretpassword
export POSTGRES_USERNAME=adifproc
export QRZ_PASSWORD=<qrz_password>
export QRZ_USERNAME=<qrz_username>
export SPRING_PROFILES_ACTIVE=prod
# Run the application
java -jar /home/adifproc/code/target/adif-processor-1.4.11-SNAPSHOT-jar-with-dependencies.jar
```

## Postgres Docker Container

Instructions here: https://www.docker.com/blog/how-to-use-the-postgres-docker-official-image/

```bash
docker pull postgres
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
```
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,66 @@ public void testTransformAltitudeComment() {
assertThat(results.getWarnings()).isEmpty();
assertThat(rec.getAltitude()).isEqualTo(1000.0);

comment= "altitude: -1";
comment = "altitude: -1";
transformer.transformComment(qso, comment, unmapped, results);
assertThat(results.getWarnings()).isEmpty();
assertThat(rec.getAltitude()).isEqualTo(-1);
}

@Test
public void testAntAz() {
Qso qso = new Qso();
Adif3Record rec = new Adif3Record();
qso.setRecord(rec);

comment = "ant_az: 450";
TransformResults results = new TransformResults();
Map<String, String> unmapped = new HashMap<>();
String comment = "ant_az: 450";
transformer.transformComment(qso, comment, unmapped, results);
assertThat(results.getWarnings()).contains("Validation of comment field 'ANT_AZ:450' failed because value is too high");
assertThat(unmapped.containsKey("ANT_AZ")).isTrue();
assertThat(unmapped.containsValue("450")).isTrue();
}

@Test
public void testPotaRef() {
TransformResults results = new TransformResults();
Map<String, String> unmapped = new HashMap<>();

Qso qso = new Qso();
Adif3Record rec = new Adif3Record();
qso.setRecord(rec);
String comment = "POTA_REF: EA-2120,EA-0825,EA-0050 WWFF: EAFF-0265";
transformer.transformComment(qso, comment, unmapped, results);
}

comment = "POTA_REF: EA-2120,EA-0825,EA-0050 WWFF: EAFF-0265";
@Test
public void testFreeTextNoColons1() {
Qso qso = new Qso();
Adif3Record rec = new Adif3Record();
qso.setRecord(rec);

TransformResults results = new TransformResults();
Map<String, String> unmapped = new HashMap<>();
String comment = "Marco, 200w 3-elem";
transformer.transformComment(qso, comment, unmapped, results);

assertThat(unmapped.containsKey("MARCO, 200W 3-ELEM")).isTrue();
assertThat(unmapped.containsValue("Marco, 200w 3-elem")).isTrue();
}

@Test
public void testFreeTextNoColons2() {
Qso qso = new Qso();
Adif3Record rec = new Adif3Record();
qso.setRecord(rec);

TransformResults results = new TransformResults();
Map<String, String> unmapped = new HashMap<>();
String comment = "\"Stef\", France";
transformer.transformComment(qso, comment, unmapped, results);
assertThat(unmapped.containsKey("\"STEF\", FRANCE")).isTrue();
assertThat(unmapped.containsValue("\"Stef\", France")).isTrue();
}

}

0 comments on commit bc760d0

Please sign in to comment.