Skip to content

Commit

Permalink
wip readme; fix dockerfile.perl
Browse files Browse the repository at this point in the history
  • Loading branch information
akotlar committed Sep 18, 2024
1 parent ee445c8 commit 0e706e7
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 29 deletions.
4 changes: 2 additions & 2 deletions Dockerfile.perl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# needed for minimal installs for Perl to compile
RUN apt install -y unminimize && yes | unminimize

COPY perl /bystro/install
COPY perl /bystro/perl
COPY go /bystro/go
COPY install /bystro/install

Expand All @@ -20,4 +20,4 @@
RUN cd /bystro && ./install-apt.sh

# Ensure .profile gets sourced when the container starts
CMD ["/bin/bash", "-l"]
CMD ["/bin/bash", "-c", "source ~/.profile && exec bash"]
4 changes: 2 additions & 2 deletions install/install-perlbrew-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ if ! perlbrew list | grep -q "$VERSION"; then
nCores=$(getconf _NPROCESSORS_ONLN)
if [[ "$NOTEST" -eq 0 ]]; then
echo "Installing Perl $VERSION with $nCores cores (running tests)"
perlbrew install "$VERSION" -j "$nCores"
perlbrew install "$VERSION" -n -j "$nCores"
else
echo "Installing Perl $VERSION with $nCores cores (skipping tests)"
perlbrew install "$VERSION" -j "$nCores" -n
perlbrew install "$VERSION" -n -j "$nCores" -n
fi
else
echo "Perl version $VERSION is already installed."
Expand Down
98 changes: 73 additions & 25 deletions perl/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,86 @@
# Bystro Annotator Perl package
# Bystro Annotator Package

## Installing Bystro using docker
## Installing Bystro Annotator using Docker

To build a docker image using the `Dockerfile`, run the following:
To build a Docker image using the `Dockerfile`, run the following:

```bash
cd ../ && docker build -t bystro-perl -f Dockerfile.perl .
cd ../ && docker build -t bystro-annotator -f Dockerfile.perl .
```

## Installing Bystro using `cpam`
## Installing Bystro Annotator Bare Metal / Locally

The instructions for installing Bystro locally uses [`cpanm`](https://metacpan.org/pod/App::cpanminus).
The instructions for installing Bystro locally use [`cpm`](https://metacpan.org/pod/App::cpanminus).

Assuming that you've cloned the repository and are working on it locally, then the dependencies can mostly be installed with cpanm.
To install `cpm`, run the following:

- If using the system Perl:

```bash
curl -fsSL https://raw.githubusercontent.com/skaji/cpm/main/cpm | sudo perl - install -g App::cpm
```

- If using local Perl through [perlbrew](https://perlbrew.pl) or [plenv](https://github.com/tokuhirom/plenv), or system Perl but with [local::lib](https://srcc.stanford.edu/farmshare/software-perllocallib) to ensure that libraries are installed locally (thus not requiring `sudo privileges`):

```bash
curl -fsSL https://raw.githubusercontent.com/skaji/cpm/main/cpm | perl - install -g App::cpm
```

Assuming that you've cloned the repository and are working on it locally, then the dependencies can mostly be installed with cpm.
But there are a few one-off dependencies that require a slightly modified approach.

One-off dependencies can be installed as follows:

```bash
cpanm --quiet https://github.com/bystrogenomics/msgpack-perl.git
cpanm --quiet --notest MouseX::Getopt
git clone --depth 1 --recurse-submodules https://github.com/salortiz/LMDB_File.git \
&& cd LMDB_File \
&& cpanm --quiet . \
&& cd .. \
&& rm -rf LMDB_File
# NOTE: you will need mysql_config to install this
# ubuntu 22.04 LTS => sudo apt install -y libmariadb-dev libmariadb-dev-compat
# amazon 2023 => sudo yum install -y <mariadb105>
cpanm --quiet DBD::MariaDB@1.23
cpm install -g --test https://github.com/bystrogenomics/msgpack-perl.git

ALIEN_INSTALL_TYPE=share cpm install -g --test Alien::LMDB
cpm install -g --test LMDB_File
cpm install -g MouseX::Getopt # fails due to differences from expected output; unimportant
```

The remaining dependencies are installed like this:
- Please note, that if you are using Perl > 5.36.0, you will need to manually install LMDB_File 0.14, which will require `make`

```bash
ALIEN_INSTALL_TYPE=share cpm install -g --test Alien::LMDB
git clone --depth 1 --recurse-submodules https://github.com/salortiz/LMDB_File.git \
&& cd LMDB_File \
&& git checkout 34acb71d7d86575fe7abb3f7ad95e8653019b282 \
&& perl Makefile.PL && make distmeta \
&& ln -s MYMETA.json META.json && ln -s MYMETA.yml META.yml \
&& cpm install --show-build-log-on-failure -g . \
&& cd ..
```

- Alternatively you can use [cpanm](https://metacpan.org/dist/App-cpanminus/view/bin/cpanm) to install the LMDB_File 0.14 dependencies:

```bash
ALIEN_INSTALL_TYPE=share cpm install -g --test Alien::LMDB
git clone --depth 1 --recurse-submodules https://github.com/salortiz/LMDB_File.git \
&& cd LMDB_File \
&& cpanm . \
&& cd .. \
&& rm -rf LMDB_File
```

One of the dependencies, DBD::MariaDB, requires mysql_config to be installed. From DBD::MariaDB documentation:

```bash
cpanm --installdeps .
```
MariaDB/MySQL
You need not install the actual MariaDB or MySQL database server, the client files and the development files are sufficient. They are distributed either in Connector/C package or as part of server package. You need at least MySQL version 4.1.8.
For example, Fedora, RedHat, CentOS Linux distribution comes with RPM files (using YUM) mariadb-devel, mariadb-embedded-devel, mysql-devel or mysql-embedded-devel (use yum search to find exact package names). Debian and Ubuntu comes with DEB packages libmariadb-dev, libmariadbclient-dev, libmariadbd-dev, libmysqlclient-dev or libmysqld-dev (use apt-cache search to find exact package names).
In some cases MariaDB or MySQL libraries depends on external libpcre, libaio, libnuma, libjemalloc or libwrap libraries. If it is that case, they needs to be installed before MariaDB/MySQL libraries.
These are sufficient, if the MariaDB/MySQL server is located on a foreign machine. You may also create client files by compiling from the MariaDB/MySQL source distribution and using
```

We provide the commands to install the dependencies for Ubuntu 22.04 LTS and Amazon Linux 2023, see `../install/install-apt-deps.sh` for Debian based systems like Ubuntu and `../install/install-rpm-deps.sh` for Centos/RedHat based systems like Amazon Linux 2023.

Once the dependencies are installed, you can install the remaining dependencies with `cpm`:

````
After installing dependencies, use `prove -lr t` to run tests.
Expand All @@ -45,18 +90,21 @@ Bystro uses [`Dist::Zilla`](https://github.com/rjbs/dist-zilla) for packaging an
This approach requires installing `Dist::Zilla` and author dependencies and one off-dependencies described in the above.
```bash
# Install cpm
curl -fsSL https://raw.githubusercontent.com/skaji/cpm/main/cpm | perl - install -g App::cpm
# Install Dist::Zilla and Archive::Tar::Wrapper (to slightly speed up building)
cpanm --quiet Dist::Zilla Archive::Tar::Wrapper
cpm install -g Dist::Zilla Archive::Tar::Wrapper
# Install build dependencies
dzil authordeps --missing | cpanm --quiet
dzil authordeps --missing | cpanm
# Install Bystro dependencies
dzil listdeps --missing | cpanm --quiet
dzil authordeps --missing | cpanm
# Install Bystro
dzil install
```
````

## Install Bystro using `cpm`

Expand Down
6 changes: 6 additions & 0 deletions perl/cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ requires "DBI" => "0";
requires "DDP" => "0";
requires "Data::MessagePack" => "0";
requires "Digest::MD5" => "0";
requires "Fcntl" => "0";
requires "File::Basename" => "0";
requires "File::Glob" => "0";
requires "File::Which" => "0";
Expand Down Expand Up @@ -39,6 +40,7 @@ requires "Pod::Usage" => "0";
requires "Scalar::Util" => "0";
requires "String::Strip" => "0";
requires "Sys::CpuAffinity" => "0";
requires "Time::HiRes" => "0";
requires "Time::localtime" => "0";
requires "Try::Tiny" => "0";
requires "Type::Params" => "0";
Expand All @@ -54,9 +56,13 @@ on 'test' => sub {
requires "Exporter" => "0";
requires "ExtUtils::MakeMaker" => "0";
requires "File::Spec" => "0";
requires "File::Temp" => "0";
requires "IO::Compress::Gzip" => "0";
requires "IO::Uncompress::Gunzip" => "0";
requires "Test::Exception" => "0";
requires "Test::More" => "0";
requires "Types::Common::String" => "0";
requires "YAML::Tiny" => "0";
};

on 'test' => sub {
Expand Down

0 comments on commit 0e706e7

Please sign in to comment.