Commit aec77369 by Bruno Bzeznik

Nixos-container is the working solution

parent de5a1db9
Recherche d'un process de création de containers
================================================
Phylodev
========
Docker
------
- Voir fichiers dans https://git.metabarcoding.org/phyloalps/phylodev/tree/master/docker
- Utilisation de l'image nix-docker https://github.com/LnL7/nix-docker
- ECHEC: l'installation de postgres nécessite la création d'un user postgres, ce qui implique une implem fonctionnelle de pam-linux, hors cela ne marche pas avec cette image, voir ici: https://github.com/LnL7/nix-docker/issues/17
- Michael Mercier (collègue du LIG) a essayé de faire une image Docker à partir de l'image iso, mais cela n'est pas trivial: "y a un squashfs dans l'iso qui contient le store, faudrait faire un petit docker file qui import le store et lance l'init qui est dans la config du boot loader pour avoir un Nixos complet qui tourne"
- Docker-compose: si on arrive à franchir ce cap, alors on pourrait utiliser docker-compose pour orchestrer les différents containers
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
Nixos-containers
----------------
Une approche intéressante: https://nixos.org/nixos/manual/#ch-containers (tests en cours...)
The result is a running nixos-container with a devel/test phyloalps application running inside.
Nixops
Usage:
------
Nixops permet de déployer des VMs sous NixOS, depuis n'importe quel OS (nécéssite NIX, mais pas NIXOS contrairement aux Nixos-containers). Il y aurait un backend "container".
* 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/
```
* Launch the initialization script that will start the container and finalize the phylodb installation:
```
sudo ./init-phylodb-container.sh ~/git/phylodb
```
* Connect your browser to http://data.phylodev.org
* 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
```
Recherche d'un process de création de containers
================================================
Docker
------
- Voir fichiers dans https://git.metabarcoding.org/phyloalps/phylodev/tree/master/docker
- Utilisation de l'image nix-docker https://github.com/LnL7/nix-docker
- ECHEC: l'installation de postgres nécessite la création d'un user postgres, ce qui implique une implem fonctionnelle de pam-linux, hors cela ne marche pas avec cette image, voir ici: https://github.com/LnL7/nix-docker/issues/17
- Michael Mercier (collègue du LIG) a essayé de faire une image Docker à partir de l'image iso, mais cela n'est pas trivial: "y a un squashfs dans l'iso qui contient le store, faudrait faire un petit docker file qui import le store et lance l'init qui est dans la config du boot loader pour avoir un Nixos complet qui tourne"
- Docker-compose: si on arrive à franchir ce cap, alors on pourrait utiliser docker-compose pour orchestrer les différents containers
Nixos-containers
----------------
Une approche intéressante: https://nixos.org/nixos/manual/#ch-containers (tests en cours...)
Nixops
------
Nixops permet de déployer des VMs sous NixOS, depuis n'importe quel OS (nécéssite NIX, mais pas NIXOS contrairement aux Nixos-containers). Il y aurait un backend "container".
Phylodev
========
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
The result is a running nixos-container with a devel/test phyloalps application running inside.
Usage:
------
* 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/
```
* Launch the initialization script that will start the container and finalize the phylodb installation:
```
sudo ./init-phylodb-container.sh ~/git/phylodb
```
* Connect your browser to http://data.phylodev.org
* 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
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment