基本のdocker-composeコマンド

docker-composeファイルの作成

lamp環境を構築する
※「./php533/Dockerfile」にDockerfileを作成している想定

# vi docker-compose.yml
-------------------------
version : "3"
services:
  mariadb:
    image: mariadb
    restart: always
    ports:
      - 3306:3306
    volumes:
      - "./mariadb:/var/lib/mysql"
      - "./initdb.d:/docker-entrypoint-initdb.d"
    environment:
      - MYSQL_ROOT_PASSWORD=nekodamashi
      - MYSQL_DATABASE=test
      - MYSQL_USER=hiro
      - MYSQL_PASSWORD=nyanko

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

  php533:
    build: ./php533
    volumes:
      - "./html:/var/www/html"
    restart: always
    ports:
      - "80:80"
    depends_on:
      - mariadb
-------------------------

コンテナイメージのbuild

# docker-compose build php533

キャッシュを使わずに再buildする場合は下記

# docker-compose build --no-cache php533

コンテナ開始/再起動

# docker-compose up -d

コンテナ停止

# docker-compose stop

コンテナ開始(停止したコンテナのスタート)

# docker-compose start

コンテナを停止して削除

# docker-compose down

基本のdockerコマンド

基本操作

イメージ検索

# docker search ubuntu

イメージ取得

# docker pull ubuntu

コンテナ作成

# docker run --name container_name -it ubuntu /bin/bash

コンテナ確認

# docker ps

コンテナ操作

# docker exec -it container_name /bin/bash

コンテナ起動

# docker start container_name

コンテナ停止

# docker stop container_name

コンテナ削除

# docker rm container_name

イメージ確認

# docker images

イメージ削除

# docker rmi ubuntu

イメージ作成

Dockerfile作成

※古いWebアプリを動かすためにPHP5環境を構築する

# mkdir php533
# vi php533/Dockerfile
----------------
FROM centos:7
ENV PHP_VERSION 5.3.3

# タイムゾーンをJSTに変更
RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
ENV TZ Asia/Tokyo

# apache + PHP5 インストール
RUN yum install -y php php-devel php-mbstring php-pdo \
php-gd php-mysql php-pgsql php-xml php-mcrypt php-pecl-zip
RUN yum install -y httpd
RUN yum clean all

# 80ポートでapache起動
EXPOSE 80
CMD ["/usr/sbin/apachectl","-DFOREGROUND"]
----------------

イメージビルド

# docker build -t php533 . -f ./php533/Dockerfile

コンテナ起動

# docker run --name container_name -d -p 8080:80 php533

Ubuntu20.04 FFmpeg + AviSynth + JoinLogoScp + delogo で自動CMカットエンコード環境構築

avisynth+ の公式インストール手順
AviSynthPlus/posix.rst at master · AviSynth/AviSynthPlus · GitHub


avisynth+ のインストール

# apt update
# apt install build-essential cmake git ninja-build checkinstall

# cd /usr/local/src
# git clone --depth 1 -b v3.6.1 https://github.com/AviSynth/AviSynthPlus.git
# cd AviSynthPlus
# mkdir avisynth-build
# cd avisynth-build
# CC=gcc-9 CXX=gcc-9 LD=gcc-9 cmake ../ -G Ninja
# ninja
# ninja install
# ldconfig


ffmpeg のインストール

# apt install nasm libfdk-aac-dev libx264-dev libx265-dev

# cd /usr/local/src
# git clone --depth 1 -b n4.3.1 git://git.ffmpeg.org/ffmpeg.git
# cd ffmpeg
# ./configure \
      --enable-gpl \
      --enable-version3 \
      --disable-doc \
      --disable-debug \
      --enable-avisynth \
      --enable-libfdk-aac \
      --enable-libx264 \
      --enable-libx265 \
      --enable-nonfree
# make
# make install


・l-smash のインストール

# cd /usr/local/src
# git clone --depth 1 https://github.com/l-smash/l-smash.git
# cd l-smash
# ./configure --enable-shared
# make
# make install
# ldconfig


・l-smash-works のインストール(avisynth で l-smash を使用するためのプラグイン

# apt install python3-pip
# pip3 install meson==0.62.0

# cd /usr/local/src
# git clone --depth 1 -b 20200728 https://github.com/HolyWu/L-SMASH-Works.git
# cd L-SMASH-Works/AviSynth
# LDFLAGS="-Wl,-Bsymbolic" meson build
# cd build
# ninja -v
# ninja install
# ldconfig


・JoinLogoScpTrialSet for Linux and Avisynth+3.5.x のインストール
https://github.com/tobitti0/JoinLogoScpTrialSetLinux

# cd /usr/local/src
# git clone --depth 1 --recursive https://github.com/tobitti0/JoinLogoScpTrialSetLinux.git
# cd JoinLogoScpTrialSetLinux/modules/chapter_exe/src/
# make
# cp -a chapter_exe /usr/local/bin/.
# cd ../../logoframe/src/
# make
# cp -a logoframe /usr/local/bin/.
# cd ../../join_logo_scp/src/
# make
# cp -a join_logo_scp /usr/local/bin/.


・join_logo_scp の動作確認

# cd ~
# vi join_temp.avs
TSFilePath="GR27_test.ts"
LWLibavVideoSource(TSFilePath, repeat=true, dominance=1)
AudioDub(last,LWLibavAudioSource(TSFilePath, av_sync=true))

# chapter_exe -v join_temp.avs -oa temp_inscp.txt
# logoframe join_temp.avs -logo GR27.lgd -oa temp_inlogo.txt
# join_logo_scp -inlogo temp_inlogo.txt -inscp temp_inscp.txt -incmd JL_標準.txt -o temp_join_logo_scp.txt

# cat temp_join_logo_scp.txt
※Trim情報が記載されていること


・透過性ロゴ フィルタ for AviSynth+ 3.5.x & Linux のインストール
https://github.com/tobitti0/delogo-AviSynthPlus-Linux

# apt install gcc-9 g++-9

# cd /usr/local/src/
# git clone --depth 1 https://github.com/tobitti0/delogo-AviSynthPlus-Linux.git
# cd delogo-AviSynthPlus-Linux/src
# make CC=gcc-9 CXX=gcc-9 LD=gcc-9
# make install
# ldconfig


・delogo の動作確認

# cd ~
# vi delogo_temp.avs
TSFilePath="GR27_test.ts"
LWLibavVideoSource(TSFilePath, repeat=true, dominance=1)
AudioDub(last,LWLibavAudioSource(TSFilePath, av_sync=true))
EraseLOGO(logofile="GR27.lgd", interlaced=true)

# ffmpeg -f avisynth -i delogo_temp.avs -c:v  libx264 -c:a libfdk_aac GR27_test.mp4

Gitの使い方

本番環境Git

$ cd ~/
$ mkdir local_git
$ cd local_git
$ git init
$ touch test.txt
$ git add test.txt
$ git commit -m 'first commit'

更新管理用Gitの作成

$ cd ~/
$ mkdir remote_git
$ cd remote_git
$ git clone --bare ~/local_git/ .

本番環境Git

$ cd ~/local_git
$ touch test2.txt
$ git add test2.txt
$ git commit -m 'first commit'
$ git remote add origin ~/remote_git/
$ git push origin master

テスト環境Git

$ cd ~/
$ mkdir test_git
$ cd test_git
$ git clone ssh://git@192.168.0.24/~/remote_git/ test_git/

コマンド早見表
https://qiita.com/kohga/items/dccf135b0af395f69144

CentOS8 インストールしたらやること

・hostnameの変更

# hostnamectl set-hostname <HOSTNAME>

SELinux無効化 と firewalld無効化
http://kt-hiro.hatenablog.com/entry/20120730/1343653945

・NTP(chrony)設定
http://kt-hiro.hatenablog.com/entry/2019/11/28/200135

・UUIDの調べ方
http://kt-hiro.hatenablog.com/entry/20110531/1306770300

NFS設定
http://kt-hiro.hatenablog.com/entry/20141212/1418378655

・afp設定
http://kt-hiro.hatenablog.com/entry/2019/11/28/200609

・smb設定
http://kt-hiro.hatenablog.com/entry/20141211/1418313057

KVM環境構築
http://kt-hiro.hatenablog.com/entry/2019/11/28/195728

KVM PCIパススルー設定
http://kt-hiro.hatenablog.com/entry/20150616/1434434879

KVM virt-install仮想マシンをインストールする一例
http://kt-hiro.hatenablog.com/entry/20170624/1498321204

CentOS8 netatalkのインストール

コンパイルに必要なパッケージをインストール

# yum install gcc make
# yum install libgcrypt-devel libdb-devel

コンパイル

# cd /usr/local/src/
# wget http://sourceforge.net/projects/netatalk/files/netatalk/3.1.12/netatalk-3.1.12.tar.gz
# tar zvxf netatalk-3.1.12.tar.gz
# cd netatalk-3.1.12
# ./configure --with-init-style=redhat-systemd 
※systemdに組み込む
# make
# make install

設定ファイル

# vi /usr/local/etc/afp.conf
[Global]
  vol preset = default_for_all_volumes
  log file = /var/log/netatalk.log

[default_for_all_volumes]
    file perm = 0600
    directory perm = 0700

[TimeMachine]
  path=/mnt/storage-1/TimeMachine
  time machine=yes

起動設定

# systemctl enable netatalk.service
# systemctl start netatalk.service

CentOS8 NTP(Chrony)のインストール

・インストールと自動起動設定

# yum -y install chrony

# vi /etc/chrony.conf
server ntp.nict.jp iburst
server ntp1.jst.mfeed.ad.jp iburst
server ntp2.jst.mfeed.ad.jp iburst

# systemctl start chronyd
# systemctl enable chronyd

・同期状態の確認

# chronyc sources