WSL laptop link and dev/server TOML - online edit of handbook/troggle/troglaptop.html [PosixPath('/home/philip/expo/expoweb/handbook/troggle/troglaptop.html')]

This commit is contained in:
Philip Sargent 2024-12-15 02:12:08 +00:00
parent d159e55b36
commit d3863a3b82

View File

@ -26,7 +26,7 @@ need to write any new software for what you need to do. Look at the tools and re
<p>Maybe what you need is simply some fixes or workarounds in the imported data files, not in the python code.
<h3>Prerequisites</h3>
<p>You need to already know really quite a lot about what troggle does, and how it is used in practice. Also you will have installed quite a lot of the software such as tunnel, therion, survex etc. as documented in <a href="../computing/wsllaptop.html">your bulk update laptop configuration</a>. In particular read the information there about VS code and git.
<p>You need to already know really quite a lot about what troggle does, and how it is used in practice. Also you will have installed quite a lot of the software such as tunnel, therion, survex etc. as documented in <a href="../computing/bulkupdatelaptop.html">your bulk update laptop configuration</a>. In particular read the information there about VS code and git.
<p>This page is a work in progess. Text will be moved here from
@ -47,7 +47,8 @@ http://expo.survex.com/repositories/troggle/.git/tree/README.txt
</ul>
<li>Windows 10 or 11 machine
<ul>
<li>Install WSL Ubuntu 24.04 LTS</a>
<li>Configure &#9775; <a href="../computing/wsllaptop.html">WSL on a WIndows laptop</a>. The standard documentation for Ubuntu or debian below all works, but you should first skim the
&#9728; <a href="../computing/winlaptop.html">Windows expo laptop</a> configuration too.
</ul>
</ul>
<p>Before you do anything else, get yourself set up with a <a href="../computing/keyexchange.html">key-pair</a> to access the software on the expo server properly.
@ -65,10 +66,7 @@ http://expo.survex.com/repositories/troggle/.git/tree/README.txt
</ul>
</ul>
<p>The install script (see below) will create the virtual environment.
<p>Before the install scripts work on a bare Ubuntu installation, you will need to have git installed. This is in-built on Ubuntu 24.04 but on other (and earlier) Linux distros you will need to do:
<br><var>sudo apt intall git</var>
<br> manually.
<p>Do familiarise yourself with the directory structure on the expo server, which we will be duplicating (partly) as docmented in <a href="serverconfig.html">The Expo Server</a>. We are not here doing a full install of all the software and scripts on the server, just the minimum to run, test and debug troggle on Django.
<p>There are two scripts in the <var>troggle</var> folder which will do semi-automatically what is described below. Have a look at
<ul>
@ -79,20 +77,10 @@ which you can read without installing by looking in:<br>
<a href="https://expo.survex.com/repositories/troggle/.git/tree/_deploy/wsl">troggle/.git/tree/_deploy/wsl</a>.
<p>You will run <var>os-trog24.04.sh</var> just once to install the basics,and you will run <var>venv-trog.sh</var> just once initially.
<p>We have two configurations for the virtual environment: 'dev' which uses the latest python and Django for speed, and 'server' which mimics the versions currently running on the server. In December 2024 Django is 5 releases ahead of the version on the server (5.1 versus 3.2). Each has a list of ancilliary packages with the appropriate versions in dev.toml and server.toml.
<p><var>os-trog.sh</var> takes a few minutes initially, but then about an hour when it installs therion and tunnel as these drag in a huge number of dependencies.
<h3>Files and directories</h3>
<p>Do familiarise yourself with the directory structure on the expo server, which we will be duplicating (partly) as docmented in <a href="serverconfig.html">The Expo Server</a>. We are not here doing a full install of all the software and scripts on the server, just the minimum to run, test and debug troggle on Django.
<h3>WSL on Windows</h3>
<p>[You will need to read this is you are doing anything even very slightly off the beaten tracke: <a href="../computing/wsllaptop.html">WSL/Troggle</a>].<p>
<p>The standard documentation for Ubuntu or debian below all works, but you should first skim the
<a href="../computing/winlaptop.html">Windows expo laptop</a> configuration too.
<p>You will run <var>os-trog24.04.sh</var> just once to install all the basics,and you will run <var>venv-trog.sh</var> just once initially.
<p>We have two configurations for the virtual environment: 'dev' which uses the latest python and Django for speed, and 'server' which mimics the versions currently running on the server. [In December 2024 Django is 5 releases ahead of the version on the server (5.1 versus 3.2). Each has a list of ancilliary packages with the appropriate versions in dev.toml and server.toml.] <var>venv-trog.sh</var> deals with all this python-specific stuff, libraries and Django plug-ins.
<p><var>os-trog.sh</var> takes a few minutes initially, but then about an hour when it installs survex, therion and tunnel as these drag in a huge number of dependencies.
<h3>Why no Docker container?</h3>
<p>Yes, it is true that this would greatly speed up on-boarding new programmers. Or <a href="https://podman.io/">podman</a>.
@ -106,7 +94,7 @@ provisioning so that systems are rebuilt cleanly. <a href="http://www.cuyc.org.u
<h2 id="git">Configuring ubuntu</h2>
<p>In your home folder run <br>
~$ <var>bash os-trog24.04.sh</var>
<br>copy it from the .git repo online to get hold of it.
<br>copy it from the .git repo online to get hold of it. Run it in <var>/home/username</var> and it will create a folder <var>expo</var> and clone all the repositories into it after installing the software you need. It installs some of <var>expofiles</var> but not <var>expofiles/photos/</var>.
<!--
<pre><code>sudo apt install python3 python3-pip -y
@ -134,14 +122,7 @@ git config --global user.name "Your Name"
git config --global pull.rebase true
</code></pre>
<h4>Pull the repositories</h4>
We now pull the required repositories:
<pre><code>cd ~/expo
git clone ssh://expo@expo.survex.com/home/expo/troggle
git clone ssh://expo@expo.survex.com/home/expo/loser
git clone ssh://expo@expo.survex.com/home/expo/expoweb
git clone ssh://expo@expo.survex.com/home/expo/drawings
</code></pre>
<h4 id="EXPOFILESREMOTE">Remote EXPOFILES</h4>
<p>If you do not have a local copy of the 40GB /expofiles/, don't worry. Later on we can set <var>'EXPOFILESREMOTE = True'</var> in the
@ -175,7 +156,7 @@ environment (a 'venv'), not in the main linux system.
<p>In order to avoid compatability issues when deploying our code, we should develop using the same libraries that will be used in production of expo.survex.com. Expo.survex.com currently uses python 3.11.2, python 3.12 (standard with Ubuntu 24.04) is backwardly compatable as long as you do not use any new functions it should be fine. Venv allows us to specify which python libraries to use.</p>
<p>[We also develop with Django 5 even though the server is still running Django 3.2, but so long as we are carefule, and test code before pushng to the server, this is fine.]
<p>
<strike>
Create and activate the virtual enviroment:
<pre><code>cd ~/expo
@ -191,6 +172,28 @@ Install the python libraries
<p>In case you have python version problems with venv, look at the instructions for <a href="/handbook/computing/wsllaptop.html_edit">python3.11 on WSL2</a>.
</strike>
<pre><code>cd ~/expo
source .venv/bin/activate
</code></pre>
will mean that you can start checking that the development version of the system (Django 5, python 3.13 etc.) is working.
<p>To swap to the server mimic environment, do:
<pre><code>deactivate
cd ~/expo/troggle
cp <font color=red>server.toml</font> pyproject.toml
uv sync
source .venv/bin/activate
</code></pre>
to swap back to the development environment, do
<pre><code>deactivate
cd ~/expo/troggle
cp <font color=red>dev.toml</font> pyproject.toml
uv sync
source .venv/bin/activate
</code></pre>
boh of these are extremely quick because they us <var>uv</var> and everything is cached.
<h4>do the basic Django health checks</h4>
@ -465,8 +468,10 @@ Return to: <a href="trognotes.html">Troggle programmers' guide</a><br />
Troggle index:
<a href="trogindex.html">Index of all troggle documents</a><br />
Go to: &#8251; <a href="../computing/basiclaptop.html">Basic laptop</a><br />
Go to: &#8258; <a href="../computingsurveylaptop.html">Survey laptop</a><br />
Go to: &#9775; <a href="../computingwinlaptop.html">Windows Bulk Update laptop</a><br />
Go to: &#8258; <a href="../computing/surveylaptop.html">Survey laptop</a><br />
Go to: &#9734; <a href="../computing/bulkupdatelaptop.html"> Bulk Update laptop</a><br />
Go to: &#9728; <a href="../computing/winlaptop.html">Windows Bulk Update laptop</a><br />
Go to: &#9775; <a href="../computing/wsllaptop.html">WSL laptop</a><br />
Go to: &#9874; <a href="troglaptop.html">Troggle development laptop</a><br />
<hr /></body>
</html>