Skip to content

Commit

Permalink
Deployed 807292c to 2024.10 with MkDocs 1.6.0 and mike 2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Geert van Geest committed Oct 21, 2024
1 parent 64f3f49 commit d897c8f
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 242 deletions.
56 changes: 48 additions & 8 deletions 2024.10/course_material/day1/apptainer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -760,24 +760,64 @@ <h2 id="material">Material</h2>
<iframe width="560" height="315" src="https://www.youtube.com/embed/d3kxtzUutjk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

<ul>
<li><a href="https://sylabs.io/guides/3.7/user-guide/">Apptainer documentation</a></li>
<li><a href="https://apptainer-hub.org/">Apptainer hub</a></li>
<li><a href="https://apptainer.org/docs/user/latest/">Apptainer documentation</a></li>
<li><a href="https://pythonspeed.com/articles/containers-filesystem-data-processing/">An article on Docker vs Apptainer</a></li>
<li><a href="https://snakemake.readthedocs.io/en/stable/snakefiles/deployment.html#containerization-of-conda-based-workflows">Using conda and containers with snakemake</a></li>
</ul>
<h2 id="exercises">Exercises</h2>
<h3 id="login-to-remote">Login to remote</h3>
<p>If you are enrolled in the course, you have received an e-mail with an IP, username, private key and password. To do the Apptainer exercises we will login to a remote server. Below you can find instructions on how to login.</p>
<p>Login to the remote server with the following command:</p>
<div class="highlight"><pre><span></span><code><span class="c1"># replace username with your username and ip_address with the ip address you received</span>
ssh<span class="w"> </span>-i<span class="w"> </span>key_username.pem<span class="w"> </span>username@ip_address
<p>VScode is a code editor that can be used to edit files and run commands locally, but also on a remote server. In this subchapter we will set up VScode to work remotely.</p>
<div class="admonition note">
<p class="admonition-title">If not working with VScode</p>
<p>If you are not working with VScode, you can login to the remote server with the following command:</p>
<div class="highlight"><pre><span></span><code>ssh<span class="w"> </span>-i<span class="w"> </span>key_username.pem<span class="w"> </span>username@123.456.789.123
</code></pre></div>
<p>If you want to edit files directly on the server, you can mount a directory with <code>sshfs</code>. </p>
</div>
<div class="admonition note">
<p class="admonition-title">Key permissions</p>
<p>If you&rsquo;re on Linux/Mac you might have to set the permissions for the ssh key:</p>
<p class="admonition-title">Required installations</p>
<p>For this exercise it is easiest if you use <a href="https://code.visualstudio.com/download">VScode</a>. In addition you would need to have followed the instructions to set up remote-ssh:</p>
<ul>
<li><a href="https://code.visualstudio.com/docs/remote/troubleshooting#_installing-a-supported-ssh-client">OpenSSH compatible client</a>. This is usually pre-installed on your OS. You can check whether the command <code>ssh</code> exists. </li>
<li>The Remote-SSH extension. To install, open VSCode and click on the extensions icon (four squares) on the left side of the window. Search for <code>Remote-SSH</code> and click on <code>Install</code>.</li>
</ul>
</div>
<div class="tabbed-set tabbed-alternate" data-tabs="1:2"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><input id="__tabbed_1_2" name="__tabbed_1" type="radio" /><div class="tabbed-labels"><label for="__tabbed_1_1">Windows</label><label for="__tabbed_1_2">mac OS/Linux</label></div>
<div class="tabbed-content">
<div class="tabbed-block">
<p>Open a PowerShell and <code>cd</code> to the directory where you have stored your private key. After that, move it to <code>~\.ssh</code>:</p>
<div class="highlight"><pre><span></span><code><span class="nb">mv </span><span class="p">.\</span><span class="n">key_username</span><span class="p">.</span><span class="n">pem</span> <span class="p">~\.</span><span class="n">ssh</span>
</code></pre></div>
</div>
<div class="tabbed-block">
<p>Open a terminal, and <code>cd</code> to the directory where you have stored your private key. After that, change the file permissions of the key and move it to <code>~/.ssh</code>:</p>
<div class="highlight"><pre><span></span><code>chmod<span class="w"> </span><span class="m">400</span><span class="w"> </span>key_username.pem
mv<span class="w"> </span>key_username.pem<span class="w"> </span>~/.ssh
</code></pre></div>
</div>
</div>
</div>
<p>Open VScode and click on the green or blue button in the bottom left corner. Select <code>Connect to Host...</code>, and then on <code>Configure SSH Host...</code>. Specify a the location for the config file. Use the same directory as where your keys are stored (so <code>~/.ssh/config</code>). A skeleton config file will be provided. Edit it, so it looks like this (replace <code>username</code> with your username, and specify the correct IP at <code>HostName</code>):</p>
<div class="tabbed-set tabbed-alternate" data-tabs="2:2"><input checked="checked" id="__tabbed_2_1" name="__tabbed_2" type="radio" /><input id="__tabbed_2_2" name="__tabbed_2" type="radio" /><div class="tabbed-labels"><label for="__tabbed_2_1">Windows</label><label for="__tabbed_2_2">MacOS/Linux</label></div>
<div class="tabbed-content">
<div class="tabbed-block">
<div class="highlight"><pre><span></span><code>Host sib_course_remote
User username
HostName 123.456.789.123
IdentityFile ~\.ssh\key_username.pem
</code></pre></div>
</div>
<div class="tabbed-block">
<div class="highlight"><pre><span></span><code>Host sib_course_remote
User username
HostName 123.456.789.123
IdentityFile ~/.ssh/key_username.pem
</code></pre></div>
</div>
</div>
</div>
<p>Save and close the config file. Now click again the green or blue button in the bottom left corner. Select <code>Connect to Host...</code>, and then on <code>sib_course_remote</code>. You will be asked which operating system is used on the remote. Specify &lsquo;Linux&rsquo;. </p>
<h3 id="pulling-an-image">Pulling an image</h3>
<p>Apptainer can take several image formats (e.g. a <code>docker</code> image), and convert them into it&rsquo;s own <code>.sif</code> format. Unlike <code>docker</code> this image doesn&rsquo;t live in a local image cache, but it&rsquo;s stored as an actual file.</p>
<p><strong>Exercise:</strong> On the remote server, pull the docker image that has the adjusted default <code>CMD</code> that we have pushed to dockerhub <a href="../dockerfiles/#using-cmd">in this exercise</a> (<code>ubuntu-figlet-df:v3</code>) with <code>apptainer pull</code>. The syntax is:</p>
Expand Down Expand Up @@ -840,7 +880,7 @@ <h3 id="executing-an-image">Executing an image</h3>
|____/ \___/|_| |_| |_|\___|\__|_| |_|_|_| |_|\__, | \___|_|___/\___|
|___/
</code></pre></div>
<div class="tabbed-set tabbed-alternate" data-tabs="1:2"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><input id="__tabbed_1_2" name="__tabbed_1" type="radio" /><div class="tabbed-labels"><label for="__tabbed_1_1">R</label><label for="__tabbed_1_2">Python</label></div>
<div class="tabbed-set tabbed-alternate" data-tabs="3:2"><input checked="checked" id="__tabbed_3_1" name="__tabbed_3" type="radio" /><input id="__tabbed_3_2" name="__tabbed_3" type="radio" /><div class="tabbed-labels"><label for="__tabbed_3_1">R</label><label for="__tabbed_3_2">Python</label></div>
<div class="tabbed-content">
<div class="tabbed-block">
<p>Pulling the <code>search_biomart_datasets</code> image:</p>
Expand Down
Loading

0 comments on commit d897c8f

Please sign in to comment.