Skip to content

Commit

Permalink
info on java
Browse files Browse the repository at this point in the history
  • Loading branch information
eeholmes committed Nov 7, 2024
1 parent 2a12667 commit 6eef7eb
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 29 deletions.
2 changes: 1 addition & 1 deletion book/configuration_files.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This is a standard format. You can add version pinning.

environment.yml
```
name: optional
name: required
channels:
- conda-forge
dependencies:
Expand Down
8 changes: 4 additions & 4 deletions book/customizing.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ USER ${NB_USER}

## Repository file structure

Here is a typical repo structure. Only the Dockerfile is required. The rest are optional. The files names, `apt.txt`, `environment.yml`, `requirements.txt` and `install.R` are optional. You can name these files other names and still use them in the pyrocket scripts. `Desktop`, `start` and `postBuild` must be named exactly this to use them in the pyrocket scripts (these scripts do not take filename arguments).
Here is a typical repo structure. Only the Dockerfile is required. The rest are optional. The exact files names, `apt.txt`, `environment.yml`, `requirements.txt`, `install.R`, etc are optional, meaning you can name these files whatever you want. The pyrocket scripts take filename or directory arguments.

```
your-repo/
Expand All @@ -58,7 +58,7 @@ your-repo/
│ └── qgis.png
```

Read [configuration_files](configuration_files.html) to learn about apt.txt, environment.yml, install.R, requirements.txt, postBuild, and start. Read [Desktop](desktop.html) to learn about the Desktop folder and files for applications.
Read [configuration_files](configuration_files.html) to learn about the files. Read [Desktop](desktop.html) to learn about the Desktop folder and files for applications.

## Examples

Expand All @@ -83,7 +83,7 @@ RUN rm environment.yml

environment.yml
```
name: optional
name: required
channels:
- conda-forge
dependencies:
Expand Down Expand Up @@ -163,7 +163,7 @@ RUN PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && \
USER ${NB_USER}
```

You have access to all the rocker_scripts and you can run these similar to the line above.
You have access to all the rocker scripts and you can run these similar to the line above.



Expand Down
18 changes: 12 additions & 6 deletions book/desktop.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ looks for files with the ending `.desktop`, `.xml` (optional), and `.png` or `.s

py-rocket-base puts these `.desktop` files in `/usr/share/Desktop`. Typically these desktop files are in `~/Desktop`. But in a JupyterHub, the home directory is often persistent and py-rocket-base tries not to alter the user home directory. Also there might be orphaned desktop files in `~/Desktop` and so the user desktop UI would be inconsistent between users. Using `/usr/share/Desktop` does mean that users cannot add their own persistent applications to xfce4 Desktop but this would be difficult anyhow without root access in many cases.

py-rocket-base has Java (`openjdk-11-jdk` and `openjdk-11-jre`) pre-installed as part of the rocker R/RStudio installation. So Java applications do work as long as they work with this version of Java.
```
openjdk version "11.0.24" 2024-07-16
OpenJDK Runtime Environment (build 11.0.24+8-post-Ubuntu-1ubuntu322.04)
OpenJDK 64-Bit Server VM (build 11.0.24+8-post-Ubuntu-1ubuntu322.04, mixed mode, sharing)
```

## Adding an application in your child docker image

Expand All @@ -20,7 +26,7 @@ USER ${NB_USER}

### Create the Desktop directory

Create the directory and add the .desktop and optional .png and .xml files. The pyrocket script `install_desktop.sh` will move them to the correct places (`/usr/share/applications` and `/usr/share/Desktop`, `/usr/share/mime/packages` and icon locations).
Create a directory for the Desktop file and add the .desktop and optional .png and .xml files. The pyrocket script `install_desktop.sh` will move them to the correct places (`/usr/share/applications` and `/usr/share/Desktop`, `/usr/share/mime/packages` and icon locations).

```
your-repo/
Expand All @@ -35,15 +41,15 @@ your-repo/

#### .desktop file

The `.desktop` file is a configuration file that describes how an application is launched. The required parts are Name, Exec and Type. MimeType specifies what types of files the application can use (optional).
The `.desktop` file is a configuration file that describes how an application is launched. The required parts are Name, Exec and Type. MimeType specifies what types of files the application can use (optional). If you included an icon in your Desktop directory, then that will be registered and you can use the filename without a path. However, sometimes the icon is installed with the application and in that case you need the full path. See the icon section below.

cdat.desktop
```
[Desktop Entry]
Type=Application
Name=CWUtils
GenericName=CoastWatch Data Analysis Tool
Icon=/srv/repo/Desktop/cdat.png
Icon=cdat
TryExec=cdat
Exec=cdat %F
Terminal=false
Expand All @@ -70,7 +76,7 @@ If an icon is installed with your application, it will be in the installation fi
```
Icon=/srv/conda/envs/notebook/share/qgis/images/icons/qgis-icon-512x512.png
```
or if you include an icon in your `Desktop` directory, it will be in `/srv/repo/Desktop`.
or if you include an icon in your `Desktop` directory, it will be in `/srv/repo/Desktop` (but in that case it is also registered as an icon so you can just use `cdat`).
```
Icon=/srv/repo/Desktop/cdat.png
```
Expand All @@ -84,7 +90,7 @@ How you install the application really varies. Here are 2 examples.

* add `qgis` to `environment.yml`
* add `libgl1-mesa-glx` to `apt.txt`
* add the .desktop file to Desktop directory
* add the `qgis.desktop` file to your Desktop directory

qgis.desktop
```
Expand Down Expand Up @@ -135,7 +141,7 @@ Categories=Qt;Education;Science;Geography;
Keywords=map;globe;
```

Add `cdat.png` icon to Desktop directory.
Add `cdat.png` icon to Desktop directory. How do you know that the command to open the application is `cdat`? You read the application installation documentation and it will tell you how to open the application from a terminal (command line).

## What's happening

Expand Down
2 changes: 1 addition & 1 deletion docs/configuration_files.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ <h2 data-number="2.1" class="anchored" data-anchor-id="install-conda-packages.sh
RUN rm environment.yml</code></pre>
<p>This is a standard format. You can add version pinning.</p>
<p>environment.yml</p>
<pre><code>name: optional
<pre><code>name: required
channels:
- conda-forge
dependencies:
Expand Down
8 changes: 4 additions & 4 deletions docs/customizing.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ <h3 data-number="1.1.3" class="anchored" data-anchor-id="calling-the-scripts"><s
</section>
<section id="repository-file-structure" class="level2" data-number="1.2">
<h2 data-number="1.2" class="anchored" data-anchor-id="repository-file-structure"><span class="header-section-number">1.2</span> Repository file structure</h2>
<p>Here is a typical repo structure. Only the Dockerfile is required. The rest are optional. The files names, <code>apt.txt</code>, <code>environment.yml</code>, <code>requirements.txt</code> and <code>install.R</code> are optional. You can name these files other names and still use them in the pyrocket scripts. <code>Desktop</code>, <code>start</code> and <code>postBuild</code> must be named exactly this to use them in the pyrocket scripts (these scripts do not take filename arguments).</p>
<p>Here is a typical repo structure. Only the Dockerfile is required. The rest are optional. The exact files names, <code>apt.txt</code>, <code>environment.yml</code>, <code>requirements.txt</code>, <code>install.R</code>, etc are optional, meaning you can name these files whatever you want. The pyrocket scripts take filename or directory arguments.</p>
<pre><code>your-repo/
├── Dockerfile
├── apt.txt
Expand All @@ -262,7 +262,7 @@ <h2 data-number="1.2" class="anchored" data-anchor-id="repository-file-structure
│ ├── qgis.desktop
│ ├── qgis.xml
│ └── qgis.png</code></pre>
<p>Read <a href="configuration_files.html">configuration_files</a> to learn about apt.txt, environment.yml, install.R, requirements.txt, postBuild, and start. Read <a href="desktop.html">Desktop</a> to learn about the Desktop folder and files for applications.</p>
<p>Read <a href="configuration_files.html">configuration_files</a> to learn about the files. Read <a href="desktop.html">Desktop</a> to learn about the Desktop folder and files for applications.</p>
</section>
<section id="examples" class="level2" data-number="1.3">
<h2 data-number="1.3" class="anchored" data-anchor-id="examples"><span class="header-section-number">1.3</span> Examples</h2>
Expand All @@ -279,7 +279,7 @@ <h3 data-number="1.3.1" class="anchored" data-anchor-id="add-some-python-package
RUN /pyrocket_scripts/install-conda-packages.sh environment.yml
RUN rm environment.yml</code></pre>
<p>environment.yml</p>
<pre><code>name: optional
<pre><code>name: required
channels:
- conda-forge
dependencies:
Expand Down Expand Up @@ -336,7 +336,7 @@ <h3 data-number="1.3.4" class="anchored" data-anchor-id="add-r-geospatial-packag
RUN PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin &amp;&amp; \
/rocker_scripts/install_geospatial.sh
USER ${NB_USER}</code></pre>
<p>You have access to all the rocker_scripts and you can run these similar to the line above.</p>
<p>You have access to all the rocker scripts and you can run these similar to the line above.</p>


</section>
Expand Down
16 changes: 10 additions & 6 deletions docs/desktop.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ <h1 class="title"><span class="chapter-number">4</span>&nbsp; <span class="chapt

<p>py-rocket-base includes the <a href="https://www.xfce.org/">xfce4 Desktop UI</a> where you can run applications. It is built off <a href="https://www.freedesktop.org/wiki/Software/">freedesktop</a> (which is helpful to know if you are debugging and configuring). A common application is to run QGIS or java-based applications. py-rocket-base looks for files with the ending <code>.desktop</code>, <code>.xml</code> (optional), and <code>.png</code> or <code>.svg</code> (optional) associated with an application in a directory called Desktop in your repo.</p>
<p>py-rocket-base puts these <code>.desktop</code> files in <code>/usr/share/Desktop</code>. Typically these desktop files are in <code>~/Desktop</code>. But in a JupyterHub, the home directory is often persistent and py-rocket-base tries not to alter the user home directory. Also there might be orphaned desktop files in <code>~/Desktop</code> and so the user desktop UI would be inconsistent between users. Using <code>/usr/share/Desktop</code> does mean that users cannot add their own persistent applications to xfce4 Desktop but this would be difficult anyhow without root access in many cases.</p>
<p>py-rocket-base has Java (<code>openjdk-11-jdk</code> and <code>openjdk-11-jre</code>) pre-installed as part of the rocker R/RStudio installation. So Java applications do work as long as they work with this version of Java.</p>
<pre><code>openjdk version "11.0.24" 2024-07-16
OpenJDK Runtime Environment (build 11.0.24+8-post-Ubuntu-1ubuntu322.04)
OpenJDK 64-Bit Server VM (build 11.0.24+8-post-Ubuntu-1ubuntu322.04, mixed mode, sharing)</code></pre>
<section id="adding-an-application-in-your-child-docker-image" class="level2" data-number="4.1">
<h2 data-number="4.1" class="anchored" data-anchor-id="adding-an-application-in-your-child-docker-image"><span class="header-section-number">4.1</span> Adding an application in your child docker image</h2>
<p>Use the pyrocket script <code>install-desktop.sh</code> to set up the desktop and move your files to the proper location. Provide a path to a directory with your Desktop files as the argument to the script. Here is the code for your Docker file. This script must be run as root.</p>
Expand All @@ -217,7 +221,7 @@ <h2 data-number="4.1" class="anchored" data-anchor-id="adding-an-application-in-
USER ${NB_USER}</code></pre>
<section id="create-the-desktop-directory" class="level3" data-number="4.1.1">
<h3 data-number="4.1.1" class="anchored" data-anchor-id="create-the-desktop-directory"><span class="header-section-number">4.1.1</span> Create the Desktop directory</h3>
<p>Create the directory and add the .desktop and optional .png and .xml files. The pyrocket script <code>install_desktop.sh</code> will move them to the correct places (<code>/usr/share/applications</code> and <code>/usr/share/Desktop</code>, <code>/usr/share/mime/packages</code> and icon locations).</p>
<p>Create a directory for the Desktop file and add the .desktop and optional .png and .xml files. The pyrocket script <code>install_desktop.sh</code> will move them to the correct places (<code>/usr/share/applications</code> and <code>/usr/share/Desktop</code>, <code>/usr/share/mime/packages</code> and icon locations).</p>
<pre><code>your-repo/
├── Dockerfile
├── optional extra files
Expand All @@ -227,13 +231,13 @@ <h3 data-number="4.1.1" class="anchored" data-anchor-id="create-the-desktop-dire
│ └── qgis.png</code></pre>
<section id="desktop-file" class="level4" data-number="4.1.1.1">
<h4 data-number="4.1.1.1" class="anchored" data-anchor-id="desktop-file"><span class="header-section-number">4.1.1.1</span> .desktop file</h4>
<p>The <code>.desktop</code> file is a configuration file that describes how an application is launched. The required parts are Name, Exec and Type. MimeType specifies what types of files the application can use (optional).</p>
<p>The <code>.desktop</code> file is a configuration file that describes how an application is launched. The required parts are Name, Exec and Type. MimeType specifies what types of files the application can use (optional). If you included an icon in your Desktop directory, then that will be registered and you can use the filename without a path. However, sometimes the icon is installed with the application and in that case you need the full path. See the icon section below.</p>
<p>cdat.desktop</p>
<pre><code>[Desktop Entry]
Type=Application
Name=CWUtils
GenericName=CoastWatch Data Analysis Tool
Icon=/srv/repo/Desktop/cdat.png
Icon=cdat
TryExec=cdat
Exec=cdat %F
Terminal=false
Expand All @@ -252,7 +256,7 @@ <h4 data-number="4.1.1.3" class="anchored" data-anchor-id="icons"><span class="h
<p>You can also use an absolute file path.</p>
<p>If an icon is installed with your application, it will be in the installation files.</p>
<pre><code>Icon=/srv/conda/envs/notebook/share/qgis/images/icons/qgis-icon-512x512.png</code></pre>
<p>or if you include an icon in your <code>Desktop</code> directory, it will be in <code>/srv/repo/Desktop</code>.</p>
<p>or if you include an icon in your <code>Desktop</code> directory, it will be in <code>/srv/repo/Desktop</code> (but in that case it is also registered as an icon so you can just use <code>cdat</code>).</p>
<pre><code>Icon=/srv/repo/Desktop/cdat.png</code></pre>
</section>
</section>
Expand All @@ -263,7 +267,7 @@ <h3 data-number="4.1.2" class="anchored" data-anchor-id="install-the-application
<ul>
<li>add <code>qgis</code> to <code>environment.yml</code></li>
<li>add <code>libgl1-mesa-glx</code> to <code>apt.txt</code></li>
<li>add the .desktop file to Desktop directory</li>
<li>add the <code>qgis.desktop</code> file to your Desktop directory</li>
</ul>
<p>qgis.desktop</p>
<pre><code># From: https://github.com/qgis/QGIS/blob/ltr-3_28/linux/org.qgis.qgis.desktop.in
Expand Down Expand Up @@ -304,7 +308,7 @@ <h3 data-number="4.1.2" class="anchored" data-anchor-id="install-the-application
StartupNotify=false
Categories=Qt;Education;Science;Geography;
Keywords=map;globe;</code></pre>
<p>Add <code>cdat.png</code> icon to Desktop directory.</p>
<p>Add <code>cdat.png</code> icon to Desktop directory. How do you know that the command to open the application is <code>cdat</code>? You read the application installation documentation and it will tell you how to open the application from a terminal (command line).</p>
</section>
</section>
<section id="whats-happening" class="level2" data-number="4.2">
Expand Down
Loading

0 comments on commit 6eef7eb

Please sign in to comment.