README.md 3.72 KB
Newer Older
1 2
Phylodev
========
3

4 5 6 7 8 9 10
Creates a nixos-container suitable for developments and testing of phyloalps. This requires a NixOS as the base system.

There are 3 parts:

* A nixos configuration, which is the base NixOS system of the container
* A script "init-phylodb-container.sh", to run as root, to launch and configure the container
* A script "store/init.sh" which is called inside the container, this is where most of the phyloalps configuration is done
11

12
The result is a running nixos-container with a devel/test phyloalps application running inside.
13

Bruno Bzeznik committed
14 15 16 17
There's another container (phylotest) for running the tests (see bellow).

Installing and building the phylodb container:
----------------------------------------------
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
* Into the file `/etc/nixos/configuration.nix` of your NixOS host (as root), add the container configuration as an imported file:
  
  ```
  imports =
  [ # Include the results of the hardware scan.
    ./hardware-configuration.nix
    # Include containers configurations
    ./phylodb-container.nix
  ];
  ```
* Into the file `/etc/nixos/configuration.nix` of your NixOS host (as root), add a host entry for the phylodev fake domain:
  
  ```
  networking.hosts = {                               
   "127.0.0.1" = [ "localhost" "data.phylodev.org" ];
   "::1" = [ "localhost" ];                          
   };                                                 
  ```

* Copy the container configuration file (as root):
  
  ```
  cp phylodb-container.nix /etc/nixos/
Bruno Bzeznik committed
41 42 43 44 45 46
  ```  
* Rebuild your NixOS for the container creation:
 
  ```
  nixos-rebuid switch
  ```
47

Bruno Bzeznik committed
48
* Clone phylodb and phylodump (for example into `~/git/phylodb` and `~/git/phylodump`) 
49 50
* Check that you don't have any local http server running on your host (or it will conflict with the phylodev one)

51 52 53
* Launch the initialization script that will start the container and finalize the phylodb installation:

  ```
Bruno Bzeznik committed
54
  sudo ./init-phylodb-container.sh ~/git/phylodb ~/git/phylodump
55 56
  ```
  
Bruno Bzeznik committed
57
* Connect your browser to http://data.phylodev.org (the default login is "admin" and the password is "phylodev").
58 59 60 61 62 63 64 65 66 67 68 69 70
  
* If necessary, you can log in to the container as root:

  ```
  sudo nixos-container root-login phylodb
  ```

* To wipe the container (for restarting the setup process):

  ```
  sudo nixos-container stop phylodb
  sudo rm -rf /var/lib/containers/phylodb
  ```
Bruno Bzeznik committed
71 72 73 74 75 76 77 78 79 80 81 82 83

Tests
-----
* Into the file `/etc/nixos/configuration.nix` of your NixOS host (as root), add an include of the file for the phylotest container:
  
  ```
  imports =
  [ # Include the results of the hardware scan.
    ./hardware-configuration.nix
    # Include containers configurations
    ./phylodb-container.nix
    ./phylotest-container.nix
  ];
Bruno Bzeznik committed
84
  ```
Bruno Bzeznik committed
85 86 87 88 89 90 91 92 93 94 95 96 97

* Copy the container configuration file (as root):
  
  ```
  cp phylotest-container.nix /etc/nixos/

 ```  
* Rebuild your NixOS for the container creation:
 
  ```
  nixos-rebuid switch
  ```
* Start and finalize the tests container
Bruno Bzeznik committed
98

Bruno Bzeznik committed
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
  ```
  sudo ./init-phylotest-container.sh
  ```
 
Running the tests
-----------------

The `run-tests.sh` script may be used to start the tests. It will create the phylodb and phylotest containers if they are not already running; so if your only goal is to run the tests, you can directly start this script after the installation of the containers into your system (ie copy `phylodb-container.nix` and `phylotest-container.nix` files into /etc/nixos and rebuild).

The tests are written in python, with the *webtest* module into the `store/phylo-webtests.py` file.

Example:
```
sudo ./run-tests.sh ~/git/phylodb ~/git/phylodump
```

And if you need to rebuild the phylodb container with changes you've made into your local copy, just stop the container and re-run the script:
```
sudo nixos-container stop phylodb
sudo ./run-tests.sh ~/git/phylodb ~/git/phylodump
```