Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfile and use docker in CI #2166

Merged
merged 2 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
-Add Dockerfile.
-Add docker-tests profile.
-Update CI to use docker image.
-Update docs.
  • Loading branch information
lorenzo-gomez-windhover committed Mar 8, 2022
commit 296ef8f382f58d5cc4c665893ea305ba348951ab
11 changes: 9 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@ name: Phoebus build

on: [push, pull_request]


env:
MAVEN_OPTS: -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120


jobs:
build:
runs-on: ubuntu-latest
container:
image: lgomezwhl/phoebus-ci:latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
java-version: '11'
- name: Build
run: mvn --batch-mode install
run: mvn -Pdocker-tests --batch-mode install
- name: Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
21 changes: 21 additions & 0 deletions docs/source/docker.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Docker
===============

In an effort to ensure consistency of deployment, testing and build environments, we have a Dockerfile that developers
may use to build a docker image. The following instructions assume that the developer is using linux and has Docker installed::

cd misc/
sudo docker build -t phoebus:latest .
sudo docker run -it phoebus:latest



From another shell(make sure to leave the previous shell open)::

sudo docker cp phoebus [CONTAINER_ID]:/


You may also pull the following image from docker hub if you don't want to build the image yourself::

sudo docker pull lgomezwhl/phoebus-ci:latest

42 changes: 42 additions & 0 deletions docs/source/eclipse_debugging.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Eclipse Debugging
=================

Download Eclipse Oxygen 4.7.1a or later from http://download.eclipse.org/eclipse/downloads/

Start Eclipse like this::

export JAVA_HOME=/path/to/your/jdk-9-or-later
export PATH="$JAVA_HOME/bin:$PATH"
eclipse/eclipse -consoleLog

Check Eclipse Preferences::

Java, Installed JREs: JDK 9-or-later should be the default
Java, Compiler: JDK Compliance should be "9" or higher

Debugging with Eclipse

This assumes the project has been imported as a maven project into Eclipse(see instructions in README)::

1. Open Eclipse
2. Go to `Run->External Tools->External Run COnfigurations`
3. Create a new `Program` configuration. Set location to `usr/bin/java` on linux.
This is the location of the Java executable. For any other OS, it should not be too hard
to find that directory.
4. Set `Working Directory` to `phoebus/phoebus-product/target`.
5. Set arguments to:
```
--add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar path_to_repo/phoebus/phoebus-product/target/product-4.6.6-SNAPSHOT.jar
```
6. Click `Run`. The Eclipse console should output a port number. Write it down; we'll use it for
debugging later on.
7. Go to `Debug Configurations`
8. Create a new `Remote Java Application`
9. Click on the `Source` tab and make sure all of the sub-modules/projects of the phoebus project
are checked. This will allow you to travel through source code when debugging code in Eclipse.
10. For port, add the port from step 6.
11. Click `Debug`


Now this should connect to your JVM process you started on step 6 and you start debugging your code. Happy debugging!
2 changes: 2 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Developer Documentation:
localization
preference_properties
changelog
docker
eclipse_debugging

Appendix
========
Expand Down
11 changes: 11 additions & 0 deletions misc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu:18.04
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason for using ubuntu:18.04? It is not the latest LTS version for Ubuntu.
Have you tried using the official images for OpenJDK or even Maven?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reason. I just forgot that Ubuntu 18 is not LTS anymore :).

RUN apt update
lorenzo-gomez-windhover marked this conversation as resolved.
Show resolved Hide resolved
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
RUN apt-get install -y openjdk-11-jdk
RUN apt-get install -y maven
RUN apt-get install -y openjfx
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/" >> /root/.bashrc
19 changes: 19 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,25 @@
</plugin>
</plugins>
</build>
</profile>
<!-- The docker-tests profile sets the ignore_local_ipv6
environment variable to true since IPV6 is not supported in Github Actions at the moment. See ticket #2161 -->
<profile>
<id>docker-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<systemPropertyVariables>
<ignore_local_ipv6>true</ignore_local_ipv6>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!-- a profile for generating javadocs and sources -->
<profile>
Expand Down