-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
1000 lines (728 loc) · 49.9 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[yoshuki43's blog]]></title>
<link href="http://yoshuki43.github.io/atom.xml" rel="self"/>
<link href="http://yoshuki43.github.io/"/>
<updated>2018-05-22T16:50:54+09:00</updated>
<id>http://yoshuki43.github.io/</id>
<author>
<name><![CDATA[yoshuki43]]></name>
<email><![CDATA[[email protected]]]></email>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Koto TestnetのInsightとFaucet]]></title>
<link href="http://yoshuki43.github.io/blog/2018/04/02/koto-testnet-insight-and-faucet/"/>
<updated>2018-04-02T17:37:33+09:00</updated>
<id>http://yoshuki43.github.io/blog/2018/04/02/koto-testnet-insight-and-faucet</id>
<content type="html"><![CDATA[<h2>はじめに</h2>
<p><a href="https://yoshuki43.github.io/blog/2018/03/17/create-koto-testnet-locally/">以前</a>作成したKotoのTestnetにInsightとFaucetを追加してみました。</p>
<ul>
<li>テストネットサービストップ(構築中): <a href="https://koto-testnet.poolof.work/">https://koto-testnet.poolof.work/</a></li>
<li>Insight: <a href="https://koto-insight-testnet.poolof.work/">https://koto-insight-testnet.poolof.work/</a></li>
<li>Faucet(蛇口): <a href="https://koto-testnet.poolof.work/faucet/">https://koto-testnet.poolof.work/faucet/</a></li>
</ul>
<p>Faucetは100Kotoまで取り出せます。1日10回の制限があります。</p>
<h2>Testnetの使い方</h2>
<p>使い方(再録):</p>
<p>(1) <code>-testnet</code>オプションをつけてkotodを起動する。</p>
<blockquote><p>kotod -testnet …</p></blockquote>
<p>Testnetのブロックやログは<code>~/.koto/testnet3/</code>以下に保存されます。</p>
<p>(2)<code>koto-testnet.poolof.work</code>をaddnodeする。</p>
<blockquote><p>koto-cli –testnet addnode koto-testnet.poolof.work add</p></blockquote>
<p>公式のTestnetが動いたことを考えて、<a href="https://yoshuki43.github.io/blog/2018/03/17/create-koto-testnet-locally/">以前のTestnetの記事</a>を参考に、dnsseedの変更をしたほうがいいかも。</p>
<!-- more -->
<h2>Koto Faucet</h2>
<p>Pythonで作ってみました。</p>
<p>特徴:</p>
<ul>
<li>Flask + Flask-WTF + SQLAlchemy + uWSGI</li>
<li>CSRF Protection (Flask-WTFの機能)</li>
<li>reCAPTCHA (Flask-WTFの機能)</li>
</ul>
<p>ソースは以下で公開しています。</p>
<ul>
<li>Koto Faucet (Github)<br/>
<a href="https://github.com/yoshuki43/koto-faucet">https://github.com/yoshuki43/koto-faucet</a></li>
</ul>
<p>見た目はもう少し何とかしたいです。</p>
<p>Flask以下全部初めて使用したので、本当にこの書き方であっているかはわかりません…。
特に、送金部分が別スレッドでWebアプリと別に動くつくりにしましたが、FlaskやuWSGI的にどうなのか?もよくわからず。</p>
<p>とりあえず、思ったようには動いてはいるようです。</p>
<h2>Insight</h2>
<p>インストールに関しては<a href="https://yoshuki43.github.io/blog/2018/03/17/install-insight/">以前</a>の記事を参照のこと。</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[K-NOMPをnginxを使ってHTTPSで公開する]]></title>
<link href="http://yoshuki43.github.io/blog/2018/04/02/k-nomp-nginx-https/"/>
<updated>2018-04-02T16:41:28+09:00</updated>
<id>http://yoshuki43.github.io/blog/2018/04/02/k-nomp-nginx-https</id>
<content type="html"><![CDATA[<h2>nginxでK-NOMPにアクセスできるようにする</h2>
<p>前提</p>
<ul>
<li>K-NOMPは8080ポートでインストールされている</li>
<li>http(s)://your.domain.com/ で公開する</li>
<li>Debian 8で確認しています</li>
</ul>
<h3>準備</h3>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sudo apt-get update
</span><span class='line'>sudo apt-get install -y nginx git</span></code></pre></td></tr></table></div></figure>
<h3>とりあえずHTTP用の設定を用意します</h3>
<!-- more -->
<p>sudo vi /etc/nginx/sites-available/your.domain.com.conf</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>server {
</span><span class='line'> listen 80;
</span><span class='line'> server_name your.domain.com;
</span><span class='line'> location / {
</span><span class='line'> proxy_pass http://localhost:8080;
</span><span class='line'> proxy_redirect off;
</span><span class='line'> }
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>
<p>site-enableにリンク</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sudo ln -s /etc/nginx/sites-available/your.domain.com.conf /etc/nginx/sites-enabled/</span></code></pre></td></tr></table></div></figure>
<p>nginxを再起動</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sudo systemctl restart nginx</span></code></pre></td></tr></table></div></figure>
<h3>確認</h3>
<p><code>http://your.domain.com/</code> にアクセスして、K-NOMPの画面が表示されることを確認します。</p>
<h2>HTTPS化する</h2>
<h3>証明書の取得</h3>
<p>Let’s Encrypt(certbot)に任せます。
「–nginx」を指定すると、certbotが自動でnginxの設定を書き換えてくれます。</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sudo su -
</span><span class='line'>cd
</span><span class='line'>git clone https://github.com/certbot/certbot
</span><span class='line'>cd certbot
</span><span class='line'>./certbot-auto --nginx -d your.domain.com -m [email protected] --agree-tos
</span><span class='line'> => 途中で2回入力を求められるので、それぞれ「y」、「2」を入力する。 </span></code></pre></td></tr></table></div></figure>
<p>※ 2を選ぶとHTTPポートからHTTPSポートに転送する設定が入ります。</p>
<h3>確認</h3>
<p><code>https://your.domain.com/</code> にアクセスして、HTTPSが有効なこと、証明書が有効なことを確認します。</p>
<h3>証明書の自動更新設定</h3>
<p>Let’s Encryptの証明書は3か月で期限切れになるので、その前に更新しなければなりません。</p>
<p>2か月おきくらいに手動でやってもいいですが、面倒がないように自動化します。</p>
<p>crntab -e (rootで実行)</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>PATH=/usr/bin:/bin:/usr/sbin
</span><span class='line'>10 20 * * 1 /root/certbot/certbot-auto renew --non-interactive >> /root/certbot.log 2>&1</span></code></pre></td></tr></table></div></figure>
<p>毎週月曜日20時10分にチェックし、期限30日前になったら更新してくれます。
複数の証明書をとっていても、これだけでOK(のはず)です。</p>
<ul>
<li>2018/05/22追記<br/>
crontab設定にPATHを追加<br/>
cronのPATHのデフォルトは<code>/usr/bin:/bin</code>であり、/usr/sbinにあるnginxが実行できず、nginxプラグインが失敗するためPATH設定が必要となります。</li>
</ul>
<h2>他にやっておくこと</h2>
<h3>デフォルトのnginxの設定</h3>
<p>HTTPポートにIPアドレスでアクセスすると、nginxのデフォルト設定が使用されます。
気になるなら変更しましょう。<br/>
(<code>/var/www/html/index.html</code>を空にする等?)</p>
<h3>Qualys SSL ReportでA+評価をとりたい</h3>
<ul>
<li>Qualys SSL Report<br/>
<a href="https://www.ssllabs.com/ssltest/index.html">https://www.ssllabs.com/ssltest/index.html</a></li>
</ul>
<p><code>/etc/nginx/nginx.conf</code>を編集</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>ssl_prefer_server_ciphers on;
</span><span class='line'>ssl_ciphers "ECDHE+RSAGCM:ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:!aNULL:!eNull:!EXPORT:!DES:!3DES:!MD5:!DSS";</span></code></pre></td></tr></table></div></figure>
<p>自分の環境では、以上でA+になりました。</p>
<p>以下をやるとさらに高評化になりますが、8080ポートにアクセスできなくなる(HTTPSを強制されるため)ので注意しましょう。</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>location / {
</span><span class='line'> :
</span><span class='line'> add_header Strict-Transport-Security max-age=15768000;
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Testnet用にKotoのInsightをインストールする]]></title>
<link href="http://yoshuki43.github.io/blog/2018/03/17/install-insight/"/>
<updated>2018-03-17T13:59:43+09:00</updated>
<id>http://yoshuki43.github.io/blog/2018/03/17/install-insight</id>
<content type="html"><![CDATA[<h2>準備</h2>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>#kotod/bitcore-nodeコンパイルに必要なもの
</span><span class='line'>sudo apt-get update
</span><span class='line'>sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib \
</span><span class='line'> autoconf libtool ncurses-dev unzip git python python-zmq zlib1g-dev \
</span><span class='line'> wget bsdmainutils automake curl libzmq3-dev
</span><span class='line'>
</span><span class='line'>#Node.js一式
</span><span class='line'>curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
</span><span class='line'>sudo apt-get install -y nodejs
</span><span class='line'>
</span><span class='line'>#ソースダウンロード
</span><span class='line'>git clone https://github.com/wo01/koto
</span><span class='line'>git clone https://github.com/wo01/bitcore-node-koto
</span><span class='line'>git clone https://github.com/wo01/insight-api-koto
</span><span class='line'>git clone https://github.com/wo01/insight-ui-koto</span></code></pre></td></tr></table></div></figure>
<h2>インストール</h2>
<h3>Insight用のKotodをコンパイル</h3>
<p>insightではgetblockhashes等、通常のKotodでサポートしていない(削除された?)RPCコマンドを使用するため、特別なバージョンのKotodが必要です。</p>
<!-- more -->
<p>上記リポジトリのブランチにinsight用のKotodが入っています。</p>
<p>非公式Testnetを使う場合は、ここでdnsseedの設定を変更しておきましょう。</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>vi koto/src/chainparam.cpp
</span><span class='line'> ...</span></code></pre></td></tr></table></div></figure>
<p>※詳細は<a href="https://yoshuki43.github.io/blog/2018/03/17/create-koto-testnet-locally/">前回の記事</a>を参照のこと。</p>
<p>コンパイル手順:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>cd koto
</span><span class='line'>git checkout v1.0.14-bitcore
</span><span class='line'>./zcutil/build.sh --disable-rust
</span><span class='line'>cp src/kotod ../bitcore-node-koto/bin/</span></code></pre></td></tr></table></div></figure>
<p>※「~/.zcash-params」の準備も忘れずに。</p>
<h3>bitcore-node-kotoの準備</h3>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>cd ../bitcore-node-koto
</span><span class='line'>npm install</span></code></pre></td></tr></table></div></figure>
<h3>ノード作成とUIプラグインのインストール</h3>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>cd ..
</span><span class='line'>./bitcore-node-koto/bin/bitcore-node create testnet
</span><span class='line'>cd testnet
</span><span class='line'>../bitcore-node-koto/bin/bitcore-node install ../insight-api-koto
</span><span class='line'>../bitcore-node-koto/bin/bitcore-node install ../insight-ui-koto</span></code></pre></td></tr></table></div></figure>
<h3>設定</h3>
<p>networkをtestnetにします。</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="nt">"network"</span><span class="p">:</span> <span class="s2">"testnet"</span><span class="p">,</span>
</span><span class='line'> <span class="nt">"port"</span><span class="p">:</span> <span class="mi">3001</span><span class="p">,</span>
</span><span class='line'> <span class="nt">"services"</span><span class="p">:</span> <span class="p">[</span>
</span><span class='line'> <span class="s2">"bitcoind"</span><span class="p">,</span>
</span><span class='line'> <span class="s2">"insight-api-koto"</span><span class="p">,</span>
</span><span class='line'> <span class="s2">"insight-ui-koto"</span><span class="p">,</span>
</span><span class='line'> <span class="s2">"web"</span>
</span><span class='line'> <span class="p">],</span>
</span><span class='line'> <span class="nt">"servicesConfig"</span><span class="p">:</span> <span class="p">{</span>
</span><span class='line'> <span class="nt">"bitcoind"</span><span class="p">:</span> <span class="p">{</span>
</span><span class='line'> <span class="nt">"spawn"</span><span class="p">:</span> <span class="p">{</span>
</span><span class='line'> <span class="nt">"datadir"</span><span class="p">:</span> <span class="s2">"./data"</span><span class="p">,</span>
</span><span class='line'> <span class="nt">"exec"</span><span class="p">:</span> <span class="s2">"/home/koto/bitcore-node-koto/bin/kotod"</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
<h3>とりあえず実行してみる</h3>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="err">../bitcore-node-koto/bin/bitcore-node</span> <span class="err">start</span>
</span></code></pre></td></tr></table></div></figure>
<p>以下のことを確認する。</p>
<ul>
<li>Blocksが増えていく</li>
<li><a href="http://localhost:3001/">http://localhost:3001/</a> にアクセスできる</li>
</ul>
<p>Ctrl-Cで終了</p>
<h3>kotod設定</h3>
<p>初期設定のままだとbitcore-node(insight)のログと一緒にkotodの出力が表示さててしまい、非常にうざいので、kotodの表示を止めます。</p>
<p>vi data/koto.conf</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="err">#これを最後の行に追加</span>
</span><span class='line'><span class="err">showmetrics=</span><span class="mi">0</span>
</span></code></pre></td></tr></table></div></figure>
<h2>systemdで起動</h2>
<p>前提</p>
<ul>
<li>kotoユーザで実行</li>
<li>ホームディレクトリ直下に、上記手順でインストールした</li>
</ul>
<p>/etc/systemd/system/insight.conf</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
</pre></td><td class='code'><pre><code class='ini'><span class='line'><span class="k">[Unit]</span>
</span><span class='line'><span class="na">Description</span> <span class="o">=</span> <span class="s">Koto Blockchain Explorer</span>
</span><span class='line'>
</span><span class='line'><span class="k">[Service]</span>
</span><span class='line'><span class="na">ExecStart</span> <span class="o">=</span> <span class="s">/home/koto/bitcore-node-koto/bin/bitcore-node start</span>
</span><span class='line'><span class="na">WorkingDirectory</span><span class="o">=</span><span class="s">/home/koto/testnet</span>
</span><span class='line'><span class="na">Restart</span> <span class="o">=</span> <span class="s">always</span>
</span><span class='line'><span class="na">Type</span> <span class="o">=</span> <span class="s">simple</span>
</span><span class='line'><span class="na">User</span><span class="o">=</span><span class="s">koto</span>
</span><span class='line'><span class="na">Group</span><span class="o">=</span><span class="s">koto</span>
</span><span class='line'>
</span><span class='line'><span class="k">[Install]</span>
</span><span class='line'><span class="na">WantedBy</span> <span class="o">=</span> <span class="s">multi-user.target</span>
</span></code></pre></td></tr></table></div></figure>
<p>実行</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='ini'><span class='line'><span class="err">sudo</span> <span class="err">systemctl</span> <span class="err">daemon-reload</span>
</span><span class='line'><span class="err">sudo</span> <span class="err">systemctl</span> <span class="err">enable</span> <span class="err">insight</span>
</span><span class='line'><span class="err">sudo</span> <span class="err">systemctl</span> <span class="err">start</span> <span class="err">insight</span>
</span></code></pre></td></tr></table></div></figure>
<p>確認</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span>systemctl status insight
</span><span class='line'>● insight.service - Koto Blockchain Explorer
</span><span class='line'> Loaded: loaded <span class="o">(</span>/etc/systemd/system/insight.service<span class="p">;</span> disabled<span class="o">)</span>
</span><span class='line'> Active: active <span class="o">(</span>running<span class="o">)</span> since Sat 2018-03-17 13:56:29 JST<span class="p">;</span> 28min ago
</span><span class='line'> Main PID: <span class="m">13350</span> <span class="o">(</span>bitcore<span class="o">)</span>
</span><span class='line'> CGroup: /system.slice/insight.service
</span><span class='line'> ├─13350 bitcore
</span><span class='line'> └─13361 /home/koto/bitcore-node-koto/bin/kotod --conf<span class="o">=</span>/home/koto/testnet/data/koto.conf --datadir<span class="o">=</span>/home/koto/...
</span></code></pre></td></tr></table></div></figure>
<h2>追記</h2>
<h3>アクセスするURLを<code>/insight/</code>から<code>/</code>に変えたい。</h3>
<p><code>bitcore-node.json</code>を以下のように変える。</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'>service <span class="o">{</span>
</span><span class='line'> :
</span><span class='line'> <span class="s2">"servicesConfig"</span>: <span class="o">{</span>
</span><span class='line'> :
</span><span class='line'> <span class="s2">"insight-ui-koto"</span>: <span class="o">{</span>
</span><span class='line'> <span class="s2">"routePrefix"</span>: <span class="s2">""</span>
</span><span class='line'> <span class="o">}</span>
</span><span class='line'> <span class="o">}</span>
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>
<p>apiのURLを変えた場合は、apiPrefixも設定する必要があると思われる。(未確認)</p>
<h3>insightが使用するkotodが使用するポートを変えたい</h3>
<p>P2PポートとRPCポートだけでいいなら<code>data/koto.conf</code>に以下を追加すればよい。</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='ini'><span class='line'><span class="na">port</span><span class="o">=</span><span class="s">12345</span>
</span><span class='line'><span class="na">rcpport</span><span class="o">=</span><span class="s">12346</span>
</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[ローカルにKotoのTestnetを作成してみる]]></title>
<link href="http://yoshuki43.github.io/blog/2018/03/17/create-koto-testnet-locally/"/>
<updated>2018-03-17T11:08:30+09:00</updated>
<id>http://yoshuki43.github.io/blog/2018/03/17/create-koto-testnet-locally</id>
<content type="html"><![CDATA[<h2>はじめに</h2>
<p>2018年3月現在、KotoにはTestnetが存在しません。
KotoのソースにはTestnet用のdnsseedとして「dnsseed.testnet.koto.cash」が設定されていますが、DNS問い合わせしても値が返ってきません。</p>
<p>ということで、プライベートなTestnetを立てる方法を探ってみました。</p>
<p>ポイントは二つ:</p>
<ul>
<li>Genesis Block(最初のブロック)に定義されている日時からある程度時間が経つとマイニングできなく(ブロックダウンロード待ちに)なってしまうので、それをどうにかする。</li>
<li>最低2個のkotodがネットワークに参加していないとマイニングできない。</li>
</ul>
<p><strong>(自分で建てるのがめんどくさい人向け)</strong></p>
<!-- more -->
<p>下記手順を行ったtestnetを<code>koto-testnet.poolof.work</code>で公開しています。
上記ホストをaddnodeすれば接続できるので、自由に使ってください。<br/>
※ただし予告なくサービス停止するかもしれません。</p>
<p>使い方:</p>
<p>(1) <code>-testnet</code>オプションをつけてkotodを起動する。</p>
<blockquote><p>kotod -testnet …</p></blockquote>
<p>(2) <code>koto-testnet.poolof.work</code>をaddnodeする。</p>
<blockquote><p>koto-cli –testnet addnode koto-testnet.poolof.work add</p></blockquote>
<h2>Kotodを改造する</h2>
<h3>日時対策</h3>
<p>単純にOSの時間を2017/12/10 13:10:55(Genesis Blockのタイムスタンプ)付近に変えてもいいが、ここでは日時(等)のチェックをしているところをつぶしてしまうことで実現します。</p>
<p>チェック関数は<code>main.cpp</code>の<code>IsInitialBlockDownload()</code>なので、その先頭に<code>return false;</code>を入れてあげます。</p>
<p>main.cpp:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='c++'><span class='line'><span class="kt">bool</span> <span class="nf">IsInitialBlockDownload</span><span class="p">()</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="k">return</span> <span class="nb">false</span><span class="p">;</span> <span class="c1">// <=この行を挿入</span>
</span><span class='line'> <span class="k">const</span> <span class="n">CChainParams</span><span class="o">&</span> <span class="n">chainParams</span> <span class="o">=</span> <span class="n">Params</span><span class="p">();</span>
</span><span class='line'> <span class="n">LOCK</span><span class="p">(</span><span class="n">cs_main</span><span class="p">);</span>
</span><span class='line'> <span class="k">if</span> <span class="p">(</span><span class="n">fImporting</span> <span class="o">||</span> <span class="n">fReindex</span><span class="p">)</span>
</span><span class='line'> <span class="k">return</span> <span class="nb">true</span><span class="p">;</span>
</span></code></pre></td></tr></table></div></figure>
<h3>dnsseed設定を変更</h3>
<p>公式にTestnetが動き出したときにプライベートTestnetが影響を与えてしまわないように、公式のdnsseed設定を消しておきます。
ついでに自サーバのホスト名(または、IPアドレス)をdnsseedとして設定しておきます。</p>
<p>chainparam.cpp:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class='c++'><span class='line'><span class="cm">/**</span>
</span><span class='line'><span class="cm"> * Testnet (v3)</span>
</span><span class='line'><span class="cm"> */</span>
</span><span class='line'><span class="k">class</span> <span class="nc">CTestNetParams</span> <span class="o">:</span> <span class="k">public</span> <span class="n">CMainParams</span> <span class="p">{</span>
</span><span class='line'><span class="k">public</span><span class="o">:</span>
</span><span class='line'> <span class="n">CTestNetParams</span><span class="p">()</span> <span class="p">{</span>
</span><span class='line'> <span class="o">:</span>
</span><span class='line'> <span class="n">vFixedSeeds</span><span class="p">.</span><span class="n">clear</span><span class="p">();</span>
</span><span class='line'> <span class="n">vSeeds</span><span class="p">.</span><span class="n">clear</span><span class="p">();</span>
</span><span class='line'> <span class="c1">//vSeeds.push_back(CDNSSeedData("koto.cash", "dnsseed.testnet.koto.cash")); // <= 消す</span>
</span><span class='line'> <span class="n">vSeeds</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">CDNSSeedData</span><span class="p">(</span><span class="s">"koto-testnet.poolof.work"</span><span class="p">,</span> <span class="s">"koto-testnet.poolof.work"</span><span class="p">));</span> <span class="c1">// <= 追加</span>
</span></code></pre></td></tr></table></div></figure>
<h3>コンパイル</h3>
<p>既にビルド済みの場合は、srcディレクトリでmake kotodを実行します。</p>
<blockquote><p>cd koto<br/>
cd src<br/>
make kotod</p></blockquote>
<p>まだビルドしていない場合は、普通にビルドします。</p>
<blockquote><p>./zcutil/build.sh –disable-rust</p></blockquote>
<p>ビルドし終わったら/usr/local/binへコピーします。(自分の環境では。)</p>
<blockquote><p>sudo cp kotod /usr/local/bin</p></blockquote>
<h2>Kotodをポートを変えて2個実行する</h2>
<h3>設定</h3>
<p>1個目はデフォルトのテストネット設定を使用。</p>
<ul>
<li>~/.koto</li>
<li>ポートは18433(p2p)と18432(rpc)</li>
</ul>
<p>2個目のKotod:</p>
<ul>
<li>~/.kotosを使う</li>
<li>ポートは18443(p2p)と18442(rpc)</li>
<li>2個目のKotodが1個目に接続する。</li>
</ul>
<p>設定ファイルは以下のようにしています。</p>
<p>1個目:~/.koto/koto.conf</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='ini'><span class='line'><span class="na">rpcuser</span><span class="o">=</span><span class="s">rpcuser</span>
</span><span class='line'><span class="na">rpcpassword</span><span class="o">=</span><span class="s">rpcpass</span>
</span><span class='line'><span class="na">rpcbind</span><span class="o">=</span><span class="s">0.0.0.0</span>
</span><span class='line'><span class="na">rpcallowip</span><span class="o">=</span><span class="s">0.0.0.0/0</span>
</span><span class='line'><span class="na">server</span><span class="o">=</span><span class="s">1</span>
</span><span class='line'><span class="na">minetolocalwallet</span><span class="o">=</span><span class="s">1</span>
</span><span class='line'><span class="na">testnet</span><span class="o">=</span><span class="s">1</span>
</span></code></pre></td></tr></table></div></figure>
<p>2個目:~/.kotos/koto.conf</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class='ini'><span class='line'><span class="na">rpcuser</span><span class="o">=</span><span class="s">rpcuser</span>
</span><span class='line'><span class="na">rpcpassword</span><span class="o">=</span><span class="s">rpcpass</span>
</span><span class='line'><span class="na">rpcbind</span><span class="o">=</span><span class="s">0.0.0.0</span>
</span><span class='line'><span class="na">rpcallowip</span><span class="o">=</span><span class="s">0.0.0.0/0</span>
</span><span class='line'><span class="na">port</span><span class="o">=</span><span class="s">18443</span>
</span><span class='line'><span class="na">rpcport</span><span class="o">=</span><span class="s">18442</span>
</span><span class='line'><span class="na">connect</span><span class="o">=</span><span class="s">localhost</span>
</span><span class='line'><span class="na">server</span><span class="o">=</span><span class="s">1</span>
</span><span class='line'><span class="na">minetolocalwallet</span><span class="o">=</span><span class="s">1</span>
</span><span class='line'><span class="na">datadir</span><span class="o">=</span><span class="s">/home/koto/.kotos</span>
</span></code></pre></td></tr></table></div></figure>
<p>port, rpcport, connect, datadirをそれぞれ設定しています。</p>
<h3>systemd設定</h3>
<p>ユーザ「koto」で実行する前提です。上記の設定ファイルもその前提で作成しています。</p>
<p>/etc/systemd/system/kotod-testnet.service:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
</pre></td><td class='code'><pre><code class='ini'><span class='line'><span class="k">[Unit]</span>
</span><span class='line'><span class="na">Description</span><span class="o">=</span><span class="s">Bitcoin daemon</span>
</span><span class='line'><span class="na">After</span><span class="o">=</span><span class="s">network.target</span>
</span><span class='line'>
</span><span class='line'><span class="k">[Service]</span>
</span><span class='line'><span class="na">ExecStart</span><span class="o">=</span><span class="s">/usr/local/bin/kotod -testnet -daemon -conf=/home/koto/.koto/koto.conf -pid=/home/koto/.koto/koto-testnet.pid</span>
</span><span class='line'><span class="na">User</span><span class="o">=</span><span class="s">koto</span>
</span><span class='line'><span class="na">Group</span><span class="o">=</span><span class="s">koto</span>
</span><span class='line'><span class="na">Type</span><span class="o">=</span><span class="s">forking</span>
</span><span class='line'><span class="na">PIDFile</span><span class="o">=</span><span class="s">/home/koto/.koto/koto-testnet.pid</span>
</span><span class='line'><span class="na">Restart</span><span class="o">=</span><span class="s">on-failure</span>
</span><span class='line'><span class="na">PrivateTmp</span><span class="o">=</span><span class="s">true</span>
</span><span class='line'>
</span><span class='line'><span class="k">[Install]</span>
</span><span class='line'><span class="na">WantedBy</span><span class="o">=</span><span class="s">multi-user.target</span>
</span></code></pre></td></tr></table></div></figure>
<p>/etc/systemd/system/kotod-testnet-slave.service:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
</pre></td><td class='code'><pre><code class='ini'><span class='line'><span class="k">[Unit]</span>
</span><span class='line'><span class="na">Description</span><span class="o">=</span><span class="s">Koto cash daemon (testnet/slave)</span>
</span><span class='line'><span class="na">After</span><span class="o">=</span><span class="s">network.target</span>
</span><span class='line'>
</span><span class='line'><span class="k">[Service]</span>
</span><span class='line'><span class="na">ExecStart</span><span class="o">=</span><span class="s">/usr/local/bin/kotod -testnet -daemon -conf=/home/koto/.kotos/koto.conf -pid=/home/koto/.kotos/koto-testnet.pid</span>
</span><span class='line'><span class="na">User</span><span class="o">=</span><span class="s">koto</span>
</span><span class='line'><span class="na">Group</span><span class="o">=</span><span class="s">koto</span>
</span><span class='line'><span class="na">Type</span><span class="o">=</span><span class="s">forking</span>
</span><span class='line'><span class="na">PIDFile</span><span class="o">=</span><span class="s">/home/koto/.kotos/koto-testnet.pid</span>
</span><span class='line'><span class="na">Restart</span><span class="o">=</span><span class="s">on-failure</span>
</span><span class='line'><span class="na">PrivateTmp</span><span class="o">=</span><span class="s">true</span>
</span><span class='line'>
</span><span class='line'><span class="k">[Install]</span>
</span><span class='line'><span class="na">WantedBy</span><span class="o">=</span><span class="s">multi-user.target</span>
</span></code></pre></td></tr></table></div></figure>
<h3>実行</h3>
<p>実行します。</p>
<blockquote><p>sudo systemctl daemon-reload<br/>
sudo systemctl start kotod-testnet<br/>
sudo systemctl start kotod-testnet-slave</p></blockquote>
<p><code>koto-cli --testnet getinfo</code>を実行してconnectionsが1になっていれば成功しているはずです。</p>
<h2>マイニングしてみる</h2>
<p>cpuminer-yescryptをコンパイルしましょう。</p>
<blockquote><p> minerd –algo=yescrypt –userpass=rpcuser:rpcpass -o 127.0.0.1:18432</p></blockquote>
<p>これで猛烈な勢いでマイニングが進むはず。</p>
<h2>その後の作業</h2>
<h3>日時対策を元に戻す</h3>
<p>1度マイニングしてしまえば日時対策は不要です。</p>
<p><code>main.cpp</code>の修正の影響がどこまであるかわからないので、<code>main.cpp</code>を元に戻したkotodを再コンパイルし、サービスを再起動します。</p>
<h3>ToDo</h3>
<ul>
<li>testnet用のinsightを立てる</li>
<li>testnet用の蛇口(Fauset)を作る</li>
<li>dnsseed(DNSサーバ)を立てる</li>
</ul>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Octopressインストール方法]]></title>
<link href="http://yoshuki43.github.io/blog/2018/02/09/octpass/"/>
<updated>2018-02-09T14:13:16+09:00</updated>
<id>http://yoshuki43.github.io/blog/2018/02/09/octpass</id>
<content type="html"><![CDATA[<h2>Octopressとは</h2>
<p>OctopressはJekyllを使ったブログ構築用フレームワーク。
GitHub Pagesと連携できる。</p>
<p>Octopress<br/>
<a href="http://octopress.org/">http://octopress.org/</a></p>
<p>インストール<br/>
<a href="http://octopress.org/docs/setup/">http://octopress.org/docs/setup/</a></p>
<p>テーマ一覧<br/>
<a href="https://github.com/imathis/octopress/wiki/3rd-Party-Octopress-Themes">https://github.com/imathis/octopress/wiki/3rd-Party-Octopress-Themes</a></p>
<h2>インストール</h2>
<h3>準備</h3>
<!-- more -->
<p>ruby環境の構築</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sudo apt-get update
</span><span class='line'>sudo apt-get install -y ruby ruby-dev git
</span><span class='line'>git clone https://github.com/rbenv/rbenv.git ~/.rbenv
</span><span class='line'>cd ~/.rbenv && src/configure && make -C src
</span><span class='line'>git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build</span></code></pre></td></tr></table></div></figure>
<p>以下の行を「~/.bash_profile」に追記</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>export PATH="$HOME/.rbenv/bin:$PATH"
</span><span class='line'>eval "$(rbenv init -)"</span></code></pre></td></tr></table></div></figure>
<p>反映</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>source ~/.bash_profile</span></code></pre></td></tr></table></div></figure>
<p>ruby環境を作成(バージョンは<a href="https://pages.github.com/versions/">ここ</a>のrubyと同じにするとよい。)</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'> rbenv install 2.4.2
</span><span class='line'> rbenv global 2.4.2
</span><span class='line'> gem install bundler
</span><span class='line'> #rakeは特定バージョンが必要なのでインストールしないこと!rake</span></code></pre></td></tr></table></div></figure>
<p>node.jsをインストール(ExecJSで必要になるため。)</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
</span><span class='line'>sudo apt-get install -y nodejs</span></code></pre></td></tr></table></div></figure>
<h3>Octopressインストール</h3>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git clone git://github.com/imathis/octopress.git octopress
</span><span class='line'>cd octopress
</span><span class='line'>rbenv rehash
</span><span class='line'>bundle install
</span><span class='line'>rake install</span></code></pre></td></tr></table></div></figure>
<h3>テーマ変更</h3>
<p>このへんからよさげなテーマを選ぶ。</p>
<p><a href="https://github.com/imathis/octopress/wiki/3rd-Party-Octopress-Themes">https://github.com/imathis/octopress/wiki/3rd-Party-Octopress-Themes</a></p>
<p>GitHubをDeploy先として登録</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>「ユーザ名.github.io」というリポジトリをGitHubに作っておく。
</span><span class='line'>
</span><span class='line'>$ rake setup_github_pages
</span><span class='line'> :
</span><span class='line'>Repository url: https://github.com/<username>/<username>.github.io
</span><span class='line'> :
</span><span class='line'>$ rake generate
</span><span class='line'>$ rake deploy</span></code></pre></td></tr></table></div></figure>
<p>「<a href="">https://<username>.github.io/</a>」にアクセスしてみる。</p>
<h3>設定</h3>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>vi _config.yml</span></code></pre></td></tr></table></div></figure>
<p>ブログ以外のファイルも入れたい?<br/>
-> sourceフォルダにGitHub Pagesにアップロードしたいファイルを入れる。</p>
<h2>ブログを書く</h2>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ rake new_post['1st post']
</span><span class='line'>mkdir -p source/_posts
</span><span class='line'>Creating new post: source/_posts/2018-02-09-1st-post.markdown</span></code></pre></td></tr></table></div></figure>
<p>ファイルが作成されるので、編集する。</p>
<p>マークダウンヘルプ<br/>
<a href="https://github.com/higuma/markdown_cheat_sheet">https://github.com/higuma/markdown_cheat_sheet</a><br/>
<a href="https://help.github.com/articles/basic-writing-and-formatting-syntax">https://help.github.com/articles/basic-writing-and-formatting-syntax</a></p>
<p>VSCodeを使用していれば、マークダウンを開いた画面の右上にある「プレビューを横に表示」ボタンでプレビュー画面を表示できる。(Ctrk+K vでもOK?)</p>
<p>追記:<br/>
VSCodeの拡張機能「Markdown Preview Github Styling」をインストールすれば、よりGitHubに近い形でプレビューを表示できる。</p>
<p>書き終わったら先ほどと同じようにgenerate->deployする。</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rake generate
</span><span class='line'>rake deploy</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Kotoイメージで遊んでみた]]></title>
<link href="http://yoshuki43.github.io/blog/2018/02/09/1st-post/"/>
<updated>2018-02-09T13:42:34+09:00</updated>
<id>http://yoshuki43.github.io/blog/2018/02/09/1st-post</id>
<content type="html"><![CDATA[<p>テストテストテスト。</p>
<p>このブログは<a href="http://octopress.org/">Octopress</a>を使用して作成しています。</p>
<p>以下はテスト記事。</p>
<h2>Kotoイメージで遊んでみた</h2>
<ul>
<li><a href="https://yoshuki43.github.io/koto/koto.html">回してみた</a></li>
<li><a href="https://yoshuki43.github.io/koto/phy.html">落としてみた</a></li>
</ul>
<p>Javascript+WebGLな3D Engineの「<a href="https://threejs.org/">Three.js</a>」と物理エンジン「<a href="https://github.com/lo-th/Oimo.js/">oimo.js</a>」を使用しています。</p>
]]></content>
</entry>
</feed>