$ pgrep -a chrony
1951 /usr/sbin/chronyd
$ chronyc sources -v
インストール不要で、デフォルトでchronydが起動しているのね
ソフトウェアエンジニアの技術ブログ:Software engineer tech blog
随机应变 ABCD: Always Be Coding and … : хороший
$ pgrep -a chrony
1951 /usr/sbin/chronyd
$ chronyc sources -v
インストール不要で、デフォルトでchronydが起動しているのね
$ sudo less /var/log/httpd/error_log
SSL Library Error: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small AH00016: Configuration Failed
キーが短すぎるの意味がそのままで、今は1024bitだと短いと判断されるらしい。
2048で作り直す必要がある。
うーん、前途多難だな
### 作成手順
ネットワークを作る -> MySQLコンテナを作る -> Redmineコンテナを作る -> 確認 -> 後始末
※WordPressとほぼ同じ構成だがオプションの名前が異なる
$ sudo docker network create redmine000net2
$ sudo docker run –name mysql000ex13 -dit –net=redmine000net2 -e MYSQL_ROOT_PASSWORD=myrootpass -e MYSQL_DATABASE=redmine000db -e MYSQL_USER=redmine000kun -e MYSQL_PASSWORD=rkunpass mysql –character-set-server=utf8mb4 –collation-server=utf8mb4_unicode_ci –default-authentication-plugin=mysql_native_password
$ sudo docker run -dit –name redmine000ex14 –network redmine000net2 -p 8086:3000 -e REDMINE_DB_MYSQL=mysql000ex13 -e REDMINE_DB_DATABASE=redmine000db -e REDMINE_DB_USERNAME=redmine000kun -e REDMINE_DB_PASSWORD=rkunpass redmine
うおおおおおお
何これ?
Dockerfile
FROM ubuntu:20.04 RUN apt update && apt upgrade -y # postfix install RUN DEBIAN_FRONTEND=noninteractive apt install postfix -y # SMTPにはSMTP AUTHが必要 # SMTP AUTHの為のSASLにはCyrus SaslとCyrus IAMPを使う RUN apt install sasl2-bin -y RUN DEBIAN_FRONTEND=noninteractive apt install cyrus-imapd -y # コンテナ起動のスクリプト COPY ./entrypoint.sh / ENTRYPOINT ["sh", "/entrypoint.sh"]
docker-compose.yml
version: '3.3' services: docker-ubuntu-postfix-example: build: context: ./ dockerfile: Dockerfile image: docker-ubuntu-postfix-example-image:latest container_name: docker-ubuntu-postfix-example-container volumes: # Postfixの設定をマウントする - type: bind source: ./configs/main.cf target: /etc/postfix/main.cf # SASL認証のパスワードをマウントする - type: bind source: ./configs/sasl_passwd target: /etc/postfix/sasl_passwd
entrypoint.sh
#!/bin/bash # postfix起動 postfix start # Postfixは/var/spool/postfixにchrootするので、 # /etc/resolv.confではなく/var/spool/postfix/etc/resolv.confを見に行く。 cp /etc/resolv.conf /var/spool/postfix/etc/resolv.conf # SASL認証用テーブル作成 chown root:root /tec/postfix/sasl_passwd postmap /etc/postfix/sasl_passwd # postfixの設定を反映させる postfix reload # コンテナの起動を維持 tail -f /dev/null
configs/main.cf
L postfixを使う場合
# ログの出力設定 mainlog_file = /var/log/mail.log # SMTPリレーの設定 relayhost = [smtp.mailtrap.io]:2525 smtp_sasl_auth_enable = yes smtp_sasl_mechanism_filter = plain smtp_sasl_security_options = noanonymous smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
configs/sasl_passwd
-> postfixのcredential情報
<メールサーバのFQDN>]:587 <ユーザ名>:<パスワード> #★
$ sudo docker-compose build –no-cache
$ sudo docker-compose up -d
$ sudo docker exec -it docker-ubuntu-postfix-example-container /bin/bash
root@7b16a3765167:/# sendmail your-email@example.com
From:your-email@example.com
To:your-email@example.com
Subject:Hello World
Hello World
.
現在、EC2を1台立てて、そこにALBをつけている状態です。
integrated service で create accelerator
そうするとipが二つ発行され、いずれのIPからもアクセスできる様になる。
なるほどね。
### HttpOnly属性
httponly属性を指定すると、HTTPテキスト内のスクリプトからCookieをアクセスできなくなる。
クロスサイト・スクリプティングの脆弱性があっても、その脆弱性によってCookieを盗まれるという事態を防止できる。
php.ini
session.cookie_httponly = 1
### URLエンコードとは
あ -> %E3%81%82 など日本語文字などをURLに使って良い文字の組み合わせに変換すること
パーセントエンコードとも言われることがある
URLデコードは %E3%81%82 -> あ など
1.コンピュート
Compute Engine, Container Engine, App engine
2.ストレージ
Cloud Storage, Cloud SQL, Cloud Bigtable, Cloud Datastore
3.ネットワーキング
Cloud Virtual Network, Cloud Load Balancing, Cloud CDN, Cloud DNS
4.ビックデータ
BiQuery, Cloud Dataflow, Cloud Dataproc, Cloud Pub/Sub
5.IoT
Cloud IoT Core
6.機械学習
Cloud Vision API, Cloud Translation API, Cloud Speech API, Cloud Machine Learning
7.管理ツール
Cloud Console, Cloud Shell, Stackdriver, Cloud IAM
プロジェクト単位で開発する
### リージョン
GCPのデータセンターが存在
リージョンの中に複数のゾーンが存在
全てのリージョンにまたがって、単一のサブネットが構成される
なんとなくイメージはつくが、まずはCompute Engineを動かしたい
$ cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
$ php -v
-bash: php: command not found
$ sudo yum update
$ sudo yum install epel-release
$ sudo yum update epel-release
$ sudo rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-8.rpm
$ sudo rpm –import http://rpms.remirepo.net/RPM-GPG-KEY-remi
$ export LC_ALL=C
$ printenv | grep LC
$ sudo yum config-manager –set-enabled remi
$ sudo yum module reset php
$ sudo yum module install php:remi-8.0
$ sudo yum install php php-devel php-pdo php-mysqlnd php-mbstring php-gd
$ php -v
PHP 8.0.3 (cli) (built: Mar 2 2021 16:37:06) ( NTS gcc x86_64 )
ヒョエエええええええ
@Controller
画面遷移用のコントローラーに付与
@RestController
リクエストを受け付けるコントローラークラス
@RequestMapping(“path”)
マッピングするURLの接頭辞を設定
@GetMapping(“path”)
GETメソッドを受け取るメソッド
@PostMapping(“path”)
POSTメソッドを受け取る為のメソッドに付与
@Service
サービスクラス
@ComponentScan
特定のアノテーションが付与されたクラスのBeanをDIに登録
@Bean
DIコンテナに管理させたいBeanを生成するメソッドに付与
@Data
コンパイル時に、setter, getter, toString, equals, hashCodeなどのメソッド生成
@Autowired
特定のアノテーションを付与したクラスのインスタンスを使用できるようにする
@ModelAttribute
返り値は自動的にmodelに追加
@Validated
Bean Validationアノテーションが評価され、結果がBindingResultに格納
@PathVariable
Rest形式のパラメータを受け取る
@RequestParam
リクエストパラメータを受け取る
@Entity
JPAエンティティ
@Table(name=”table name”)
エンティティに対応するテーブル名を指定
@GeneratedValue
auto increment
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator=”シーケンス名”)
SEQ_IDで自動採番
@Transactional
クラス内に付与するとDBのトランザクション制御
@AllArgsConstructor
全フィールドを引数にもつコンストラクタ生成
@NoArgsConstructor
引数がないコンストラクタ
@Column
カラムに名前や制約を設定
@Query(“JPQL”)
データへのアクセスを自作する際に使用
@NotNull, @NotEmpty, @NotBlank, @Size(min=,max), @Email, @AssertTrue, @AssertFalse, @Pattern, @DateTimeFormat
@SpringBootApplication
Spring Bootの様々な設定を自動的に有効にする
@EnableAutoConfiguration
Spring Bootの様々な設定を自動的に有効にする
@Configuration
JavaConfig用のクラスであることを示す
@Qualifier(“Bean name”)
同じ型のBeanがDIコンテナに複数登録されている場合に適用する
アノテーションをきちんと理解しないと、SpringBootは使いこなせんな。
基本
<form action="#" method="POST" enctype="multipart/form-data"> <input type="file" name="file"><br><br> <input type="submit" value="upload"> </form>
bootstrap
<form action="#" method="POST" enctype="multipart/form-data"> <div class="form-group"> <label for="inputFile">File input</label> <div class="custom-file"> <input type="file" class="custom-file-input" id="inputFile"> <label class="custom-file-label" for="inputFile" data-browse="参照">ファイル選択</label> </div> </div> <br> <button type="submit" class="btn btn-primary">Submit</button> </form> </div> <script src="https://cdn.jsdelivr.net/npm/bs-custom-file-input/dist/bs-custom-file-input.js"></script> <script> bsCustomFileInput.init(); </script>
画像変更
<form action="#" method="POST" enctype="multipart/form-data"> <img src="https://placehold.jp/200x150.png" class="img-icon"> <div class="preview"></div><br> <div class="form-group"> <label for="inputFile">File input</label> <div class="custom-file"> <input type="file" class="custom-file-input" id="inputFile" name="file1"> <label class="custom-file-label" for="inputFile" data-browse="参照">ファイル選択</label> </div> </div> <br> <button type="submit" class="btn btn-primary">Submit</button> </form> </div> <script src="https://cdn.jsdelivr.net/npm/bs-custom-file-input/dist/bs-custom-file-input.js"></script> <script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script> <script> bsCustomFileInput.init(); $(function(){ $('form').on('change', 'input[name="file1"]', function(e) { var file = e.target.files[0], reader = new FileReader(), $preview = $(".preview"); t = this; if(file.type.indexOf("image") < 0){ return false; } document.getElementsByClassName("img-icon")[0].style.display = "none"; reader.onload = (function(file) { return function(e) { $preview.empty(); $preview.append($('<img>').attr({ src: e.target.result, width: "250px", height: "200px", class: "preview", title: file.name })); }; })(file); reader.readAsDataURL(file); }); }); </script>
object-fit: containにしておきます。
OK^^