Difference between revisions of "Clément Démoulins"
From LRDE
(→Docker) |
|||
(19 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
Exemple, on veut extraire les papiers de Vaucanson du dépôt commun ''lrde-publis''. |
Exemple, on veut extraire les papiers de Vaucanson du dépôt commun ''lrde-publis''. |
||
− | <syntaxhighlight lang="bash |
+ | <syntaxhighlight lang="bash"> |
# Clone du dépôt |
# Clone du dépôt |
||
git clone git@git:lrde-publis.git |
git clone git@git:lrde-publis.git |
||
Line 18: | Line 18: | ||
git reflog expire --expire=now --all |
git reflog expire --expire=now --all |
||
git repack -ad |
git repack -ad |
||
− | </syntaxhighlight> |
||
− | |||
− | == Compilation dans ''/lrde/dev'' == |
||
− | |||
− | Compilation classique d'un paquet : |
||
− | <syntaxhighlight lang="bash" enclose="div"> |
||
− | source /lrde/dev/profile && ./configure CXXFLAGS="-O3" CFLAGS="-O3" --prefix=/lrde/dev/$(uname -m)/stow/$(basename $PWD) && make && make install |
||
− | </syntaxhighlight> |
||
− | |||
− | Compilation de gcc : |
||
− | <syntaxhighlight lang="bash" enclose="div"> |
||
− | |||
− | </syntaxhighlight> |
||
− | |||
− | Compilation de clang : |
||
− | <syntaxhighlight lang="bash" enclose="div"> |
||
− | source /lrde/dev/profile |
||
− | CC=gcc-4.9 CXX=g++-4.9 ./configure CXXFLAGS="-O3" CFLAGS="-O3" --prefix=/lrde/dev/$(uname -m)/stow/$(basename $PWD) |
||
− | make |
||
− | </syntaxhighlight> |
||
− | |||
− | Compilation de opencv : |
||
− | <syntaxhighlight lang="bash" enclose="div"> |
||
− | source /lrde/dev/profile |
||
− | cmake \ |
||
− | -D WITH_OPENCL=ON \ |
||
− | -D WITH_OPENGL=ON \ |
||
− | -D BUILD_TESTS=OFF \ |
||
− | -D BUILD_EXAMPLES=OFF \ |
||
− | -D CMAKE_BUILD_TYPE=Release \ |
||
− | -D CMAKE_INSTALL_PREFIX=/lrde/dev/$(uname -m)/stow/$(basename $PWD) \ |
||
− | -D CMAKE_SKIP_RPATH=ON \ |
||
− | . |
||
− | make |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
== Commandes bien pratique de post installation == |
== Commandes bien pratique de post installation == |
||
− | |||
− | === Déploiement de ma config === |
||
− | <syntaxhighlight lang="bash" enclose="div"> |
||
− | apt-get update |
||
− | apt-get install -y vim-nox htop tree git tmux curl zsh |
||
− | mkdir -p ~/.ssh; |
||
− | curl http://sao-paulo.lrde.epita.fr/cluster/files/admin-ssh-key.pub -o ~/.ssh/authorized_keys; |
||
− | curl http://sao-paulo.lrde.epita.fr/cluster/files/known_hosts -o ~/.ssh/known_hosts; |
||
− | curl http://sao-paulo.lrde.epita.fr/cluster/files/id_rsa-dotfiles -o ~/.ssh/id_rsa-dotfiles; |
||
− | curl http://sao-paulo.lrde.epita.fr/cluster/files/id_rsa-dotfiles.pub -o ~/.ssh/id_rsa-dotfiles.pub; |
||
− | curl http://sao-paulo.lrde.epita.fr/cluster/files/ssh_config -o ~/.ssh/config; |
||
− | chmod 600 ~/.ssh/id_rsa-dotfiles; |
||
− | git clone --quiet dotfiles:clement/dotfiles.git ~/.dotfiles; |
||
− | (cd ~/.dotfiles && ./install.sh); |
||
− | chsh $USER -s /usr/bin/zsh; |
||
− | </syntaxhighlight> |
||
− | |||
− | === sources.list === |
||
− | |||
− | <syntaxhighlight lang="bash" enclose="div"> |
||
− | wget http://sao-paulo.lrde.epita.fr/cluster/files/sources.list -O /etc/apt/sources.list; |
||
− | wget http://sao-paulo.lrde.epita.fr/cluster/files/security.sources.list -O /etc/apt/sources.list.d/security.sources.list; |
||
− | apt-get update; |
||
− | </syntaxhighlight> |
||
=== cron-apt === |
=== cron-apt === |
||
Line 88: | Line 30: | ||
wget http://sao-paulo.lrde.epita.fr/cluster/files/cron-apt-2-security-upgrade -O /etc/cron-apt/action.d/2-security-upgrade; |
wget http://sao-paulo.lrde.epita.fr/cluster/files/cron-apt-2-security-upgrade -O /etc/cron-apt/action.d/2-security-upgrade; |
||
wget http://sao-paulo.lrde.epita.fr/cluster/files/cron-apt-security.conf -O /etc/cron-apt/apt-security-upgrade.conf; |
wget http://sao-paulo.lrde.epita.fr/cluster/files/cron-apt-security.conf -O /etc/cron-apt/apt-security-upgrade.conf; |
||
− | </syntaxhighlight> |
||
− | |||
− | === deb-multimedia + ffmpeg === |
||
− | |||
− | <syntaxhighlight lang="bash" enclose="div"> |
||
− | echo "deb http://www.deb-multimedia.org wheezy main non-free" > /etc/apt/sources.list.d/deb-multimedia.list |
||
− | apt-get update |
||
− | apt-get install deb-multimedia-keyring |
||
− | apt-get update |
||
− | apt-get install libav{filter,format,util,device,codec}-dev libav{codec54,util52,filter3,device54} libswscale-dev |
||
− | </syntaxhighlight> |
||
− | |||
− | === glusterfs 3.5 === |
||
− | |||
− | <syntaxhighlight lang="bash" enclose="div"> |
||
− | wget -O - http://download.gluster.org/pub/gluster/glusterfs/3.5/3.5.0/Debian/pubkey.gpg | apt-key add - |
||
− | echo 'deb [ arch=amd64 ] http://download.gluster.org/pub/gluster/glusterfs/3.5/3.5.0/Debian/apt wheezy main' > /etc/apt/sources.list.d/gluster.list |
||
− | apt-get update |
||
− | apt-get install glusterfs-client |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
Line 113: | Line 36: | ||
<syntaxhighlight lang="bash" enclose="div"> |
<syntaxhighlight lang="bash" enclose="div"> |
||
apt-get update |
apt-get update |
||
− | apt-get install -y autofs autofs-ldap nslcd |
+ | apt-get install -y autofs autofs-ldap nslcd libnss-ldapd nfs-common glusterfs-client |
apt-get purge nscd |
apt-get purge nscd |
||
wget http://sao-paulo.lrde.epita.fr/cluster/files/autofs.default -O /etc/default/autofs; |
wget http://sao-paulo.lrde.epita.fr/cluster/files/autofs.default -O /etc/default/autofs; |
||
Line 135: | Line 58: | ||
: Démarrage classique d'un container en mode daemon. |
: Démarrage classique d'un container en mode daemon. |
||
; docker ps -a |
; docker ps -a |
||
− | : Liste les |
+ | : Liste les containers |
; docker images -a |
; docker images -a |
||
: Liste les images |
: Liste les images |
||
+ | ; docker rm $(docker ps -a -q) |
||
+ | : Delete all stopped containers |
||
+ | ; docker rmi $(docker images -q) |
||
+ | : Delete ALL images |
||
+ | ; docker rmi $(docker images -q --filter "dangling=true") |
||
+ | : Delete untagged images |
||
=== Liens === |
=== Liens === |
||
Line 150: | Line 79: | ||
* [https://wiki.archlinux.org/index.php/Systemd-nspawn systemd-nspawn], similaire à docker mais basé sur systemd |
* [https://wiki.archlinux.org/index.php/Systemd-nspawn systemd-nspawn], similaire à docker mais basé sur systemd |
||
* [https://linuxcontainers.org/ LXC], technologie équivalente à docker mais prévu pour "booter" le container |
* [https://linuxcontainers.org/ LXC], technologie équivalente à docker mais prévu pour "booter" le container |
||
+ | * [https://github.com/coreos/rocket Rocket] |
||
− | * |
||
+ | * [https://github.com/docker/swarm/ Swarm], orchestrateur pour docker |
||
+ | * [https://github.com/docker/compose/ Compose], orchestrateur pour docker (≠ de Swarm ?) |
||
+ | * [https://coreos.com/ CoreOS], OS serveur basé sur des containers |
||
+ | |||
+ | |||
+ | == Récupération de disques == |
||
+ | |||
+ | * [http://linuxfr.org/news/ddrescue-dd_rescue-myrescue-recuperer-ses-donnees-apres-un-crash-disque recuperer-ses-donnees-apres-un-crash-disque] |
||
+ | |||
+ | == Paquet Debian == |
||
+ | |||
+ | <syntaxhighlight lang=bash> |
||
+ | # Création d'une image 'cow' pour jessie |
||
+ | cowbuilder --create --basepath /var/cache/pbuilder/base-jessie.cow --distribution jessie |
||
+ | # Mise à jour |
||
+ | cowbuilder --update --basepath /var/cache/pbuilder/base-jessie.cow --distribution jessie |
||
+ | |||
+ | # Création du paquet avec gbp (si tout va bien) |
||
+ | gbp buildpackage |
||
+ | </syntaxhighlight> |
||
+ | |||
+ | == Ré-encodage vidéo == |
||
+ | |||
+ | <syntaxhighlight lang=bash> |
||
+ | ffmpeg -i "concat:$(echo *.MTS | sed 's/ /|/g')" -c copy raw.mp4 |
||
+ | ffmpeg -i raw.mp4 -codec:v h264_nvenc -gpu 2 -crf 25 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart output_1080p_crf25.mp4 |
||
+ | </syntaxhighlight> |
Latest revision as of 13:43, 16 July 2020
Extraire des sous dossiers d'un dépôt git
Exemple, on veut extraire les papiers de Vaucanson du dépôt commun lrde-publis.
# Clone du dépôt
git clone git@git:lrde-publis.git
git clone --no-hardlinks lrde-publis vcsn-publis
cd vcsn-publis
# Filtre tout sauf ce qui match la pattern : (\.fsmnlp|\.ciaa|\.poosc|\.vaucanson|\.gitignore|\.gitmodules)$
git filter-branch --prune-empty --index-filter "git rm -r --cached --ignore-unmatch $(git log -p | sed -rne 's/^diff --git a\/([^/]+)\/?.* b\/.*$/\1/ p' | sort -u | egrep -v '(\.fsmnlp|\.ciaa|\.poosc|\.vaucanson|\.gitignore|\.gitmodules)$' | xargs echo)" HEAD
# Nettoyage du dépôt
git remote rm origin
git update-ref -d refs/original/refs/heads/master
git reflog expire --expire=now --all
git repack -ad
Commandes bien pratique de post installation
cron-apt
apt-get update;
apt-get install -y cron-apt;
wget http://sao-paulo.lrde.epita.fr/cluster/files/cron-apt-config -O /etc/cron-apt/config;
wget http://sao-paulo.lrde.epita.fr/cluster/files/cron-apt-2-security-upgrade -O /etc/cron-apt/action.d/2-security-upgrade;
wget http://sao-paulo.lrde.epita.fr/cluster/files/cron-apt-security.conf -O /etc/cron-apt/apt-security-upgrade.conf;
LDAP
apt-get update
apt-get install -y autofs autofs-ldap nslcd libnss-ldapd nfs-common glusterfs-client
apt-get purge nscd
wget http://sao-paulo.lrde.epita.fr/cluster/files/autofs.default -O /etc/default/autofs;
wget http://sao-paulo.lrde.epita.fr/cluster/files/autofs.if-up -O /etc/network/if-up.d/autofs;
chmod +x /etc/network/if-up.d/autofs;
wget http://sao-paulo.lrde.epita.fr/cluster/files/ldap.conf -O /etc/ldap/ldap.conf;
wget http://sao-paulo.lrde.epita.fr/cluster/files/cacert.pem -O /etc/ssl/certs/lrde-cacert.pem;
wget http://sao-paulo.lrde.epita.fr/cluster/files/nsswitch.conf -O /etc/nsswitch.conf;
wget http://sao-paulo.lrde.epita.fr/cluster/files/nslcd.conf -O /etc/nslcd.conf;
Docker
Commandes
- docker build -t TAG_NAME .
- Construit une image docker à partir d'un Dockerfile
- docker run -t -i IMAGE CMD
- Démarre un container intéractif à partir d'une image, si aucune commande n'est spécifiée, la commande définie par l'image est exécutée.
- docker run -d IMAGE
- Démarrage classique d'un container en mode daemon.
- docker ps -a
- Liste les containers
- docker images -a
- Liste les images
- docker rm $(docker ps -a -q)
- Delete all stopped containers
- docker rmi $(docker images -q)
- Delete ALL images
- docker rmi $(docker images -q --filter "dangling=true")
- Delete untagged images
Liens
Outils tiers
- systemd-nspawn, similaire à docker mais basé sur systemd
- LXC, technologie équivalente à docker mais prévu pour "booter" le container
- Rocket
- Swarm, orchestrateur pour docker
- Compose, orchestrateur pour docker (≠ de Swarm ?)
- CoreOS, OS serveur basé sur des containers
Récupération de disques
Paquet Debian
# Création d'une image 'cow' pour jessie
cowbuilder --create --basepath /var/cache/pbuilder/base-jessie.cow --distribution jessie
# Mise à jour
cowbuilder --update --basepath /var/cache/pbuilder/base-jessie.cow --distribution jessie
# Création du paquet avec gbp (si tout va bien)
gbp buildpackage
Ré-encodage vidéo
ffmpeg -i "concat:$(echo *.MTS | sed 's/ /|/g')" -c copy raw.mp4
ffmpeg -i raw.mp4 -codec:v h264_nvenc -gpu 2 -crf 25 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart output_1080p_crf25.mp4