Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/Docker.build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Docker Build and Deploy

on:
push:
branches:
- fix/postgresql-array-handling #branch name which is used for image building

jobs:
build:
runs-on: self-hosted
permissions:
contents: read
packages: read

env:
ECR_REPOSITORY: atomhopper
AWS_REGION: us-east-1

steps:
- name: checkout code
uses: actions/checkout@v3

- name: Set Short commit SHA as image tag
run: echo "IMAGE_TAG=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV

- name: AWS ECR login
run: |
aws ecr get-login-password --region ${{ env.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com
- name: Build docker image
run: |
docker build -f docker/Dockerfile \
--build-arg GITHUB_TOKEN=${{ secrets.PAT_FOR_DOCKER }} \
--build-arg GITHUB_ACTOR=${{ secrets.USER_ID }} \
-t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} .
- name: Push docker image to registry
run: |
docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
2 changes: 1 addition & 1 deletion adapters/dynamoDB_adapters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>org.atomhopper</groupId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion adapters/hibernate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
<relativePath>./../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion adapters/jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
<relativePath>./../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import org.atomhopper.util.uri.template.URITemplate;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormatter;

import java.sql.Array;
import org.joda.time.format.ISODateTimeFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -826,7 +828,14 @@ public Object extractData( ResultSet rs ) throws SQLException, DataAccessExcepti
entry.setEntryId(rs.getString("entryid"));


List<String> cats = new ArrayList<String>( Arrays.asList( (String[])rs.getArray( "categories" ).getArray() ) );
List<String> cats = new ArrayList<String>();
Array categoriesArray = rs.getArray("categories");
if (categoriesArray != null) {
String[] categoryStrings = (String[]) categoriesArray.getArray();
if (categoryStrings != null) {
cats.addAll(Arrays.asList(categoryStrings));
}
}

for( String column : mapColumn.keySet() ) {

Expand Down
2 changes: 1 addition & 1 deletion adapters/migration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
<relativePath>./../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion adapters/mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
<relativePath>./../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion adapters/postgres-adapter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
<relativePath>./../../pom.xml</relativePath>
</parent>

Expand Down
10 changes: 3 additions & 7 deletions atomhopper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
</parent>

<groupId>org.atomhopper</groupId>
Expand Down Expand Up @@ -65,7 +65,7 @@
<dependency>
<groupId>org.atomhopper.adapter</groupId>
<artifactId>dynamoDB_adapters</artifactId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -104,11 +104,7 @@
<version>4.2.5.RELEASE</version>
</dependency>

<dependency>
<groupId>org.atomhopper.adapter</groupId>
<artifactId>dynamoDB_adapters</artifactId>
<version>1.2.35-SNAPSHOT</version>
</dependency>


<dependency>
<groupId>jakarta.xml.bind</groupId>
Expand Down
40 changes: 30 additions & 10 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@ FROM tomcat:9.0.41-jdk8 as tomcat

FROM adoptopenjdk/openjdk8:alpine-slim

# Build arguments for GitHub authentication
ARG GITHUB_TOKEN
ARG GITHUB_ACTOR

# Validate that authentication arguments are provided
RUN if [ -z "$GITHUB_TOKEN" ] || [ -z "$GITHUB_ACTOR" ]; then \
echo "ERROR: GITHUB_TOKEN and GITHUB_ACTOR build arguments are required for GitHub Packages authentication"; \
exit 1; \
fi

LABEL maintainer="AtomHopperTeam@rackspace.com" \
#Atom Hopper version
version="1.2.33" \
version="1.2.35" \
description="Docker image for Atom Hopper"

#The database type
Expand All @@ -16,28 +26,38 @@ ENV DB_TYPE=H2 \
DB_PASSWORD= \
#Database Host:Port
DB_HOST=h2 \
AH_VERSION=1.2.33 \
AH_VERSION=1.2.35 \
CATALINA_HOME=/opt/tomcat \
AH_HOME=/opt/atomhopper \
PATH=${PATH}:${CATALINA_HOME}/bin:${AH_HOME}

RUN mkdir -p "${CATALINA_HOME}" "${AH_HOME}" /etc/atomhopper/ /var/log/atomhopper/
RUN mkdir -p "${CATALINA_HOME}" "${AH_HOME}" /etc/atomhopper/ /var/log/atomhopper/

WORKDIR ${AH_HOME}

COPY --from=tomcat /usr/local/tomcat ${CATALINA_HOME}
COPY start.sh .

RUN apk --no-cache add curl \
&& curl -o atomhopper.war https://maven.research.rackspacecloud.com/content/repositories/releases/org/atomhopper/atomhopper/${AH_VERSION}/atomhopper-${AH_VERSION}.war \
COPY docker/start.sh .

RUN apk --no-cache add curl unzip file \
&& echo "Downloading AtomHopper ${AH_VERSION} from GitHub Packages..." \
&& echo "URL: https://maven.pkg.github.com/rackerlabs/atom-hopper/org/atomhopper/atomhopper/${AH_VERSION}/atomhopper-${AH_VERSION}.war" \
&& curl -L -v -u ${GITHUB_ACTOR}:${GITHUB_TOKEN} -o atomhopper.war \
"https://maven.pkg.github.com/rackerlabs/atom-hopper/org/atomhopper/atomhopper/${AH_VERSION}/atomhopper-${AH_VERSION}.war" \
&& echo "Download completed. Verifying WAR file..." \
&& ls -la atomhopper.war \
&& file atomhopper.war \
&& unzip -t atomhopper.war > /dev/null \
&& echo "Extracting configuration files..." \
&& unzip atomhopper.war META-INF/application-context.xml META-INF/template-logback.xml WEB-INF/classes/META-INF/atom-server.cfg.xml -d . \
&& mv META-INF/application-context.xml WEB-INF/classes/META-INF/atom-server.cfg.xml /etc/atomhopper/ \
&& mv META-INF/template-logback.xml /etc/atomhopper/logback.xml \
&& mv atomhopper.war ${CATALINA_HOME}/webapps/ROOT.war \
&& rm -rf META-INF WEB-INF \
&& chmod +x ${AH_HOME}/start.sh
&& chmod +x ${AH_HOME}/start.sh \
&& echo "Verifying start.sh file..." \
&& ls -la ${AH_HOME}/start.sh \
&& echo "AtomHopper ${AH_VERSION} setup completed successfully"

EXPOSE 8080

CMD ["start.sh"]

CMD ["/opt/atomhopper/start.sh"]
11 changes: 4 additions & 7 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# docker build image and run the conatiner
Your current direcotry should be pointing to ***atom-hopper/docker***.
Your current direcotry should be pointing to ***atom-hopper/docker***.
Run the following command to build an image.
```
$docker build -t atomhopper:latest-alpine .
Expand All @@ -17,7 +17,7 @@ Test the sample feed at http://localhost:8080/namespace/feed

H2 is the default databse configured to be used. The databse file for this is present under */opt/atomhopper*

Following environment variables are set by default
Following environment variables are set by default
```
JAVA_HOME "/opt/java/openjdk8/jre"
CATALINA_HOME "/opt/tomcat"
Expand All @@ -26,10 +26,7 @@ AH_VERSION "1.2.33"
```
For specific databse configuration of your choice (PostgreSQL,MySQL) provide values for the variables DB_TYPE, DB_USER, DB_PASSWORD and DB_HOST

Example of running with a PostgreSQL databse hosted externally.
Example of running with a PostgreSQL databse hosted externally.
```
$docker run -d --name atomhopper -p 8080:8080 -e DB_TYPE=PostgreSQL -e DB_USER=postgresql -e DB_PASSWORD=postgresql -e DB_HOST=10.0.0.1:5432 atomhopper:latest-alpine
```



```
2 changes: 1 addition & 1 deletion documentation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
</parent>

<groupId>org.atomhopper</groupId>
Expand Down
2 changes: 1 addition & 1 deletion hopper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<version>1.2.36-SNAPSHOT</version>
<version>1.2.35</version>
</parent>

<groupId>org.atomhopper</groupId>
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.2.36-SNAPSHOT</version>
<version>1.2.35</version>
<name>ATOM Hopper - ATOMpub Server Collection</name>

<url>http://atomhopper.org/</url>
Expand Down Expand Up @@ -398,12 +398,12 @@
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/rackerlabs/atom-hopper.git</url>
<url>https://maven.pkg.github.com/rackerlabs/atom-hopper</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/rackerlabs/atom-hopper.git</url>
<url>https://maven.pkg.github.com/rackerlabs/atom-hopper</url>
</snapshotRepository>
</distributionManagement>

Expand Down
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
</parent>

<groupId>org.atomhopper</groupId>
Expand Down
2 changes: 1 addition & 1 deletion test-suite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
</parent>

<groupId>org.atomhopper</groupId>
Expand Down
2 changes: 1 addition & 1 deletion test-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.atomhopper</groupId>
<artifactId>parent</artifactId>
<version>1.2.35-SNAPSHOT</version>
<version>1.2.35</version>
</parent>

<groupId>org.atomhopper</groupId>
Expand Down