summaryrefslogblamecommitdiffstats
path: root/archives/extend/2014-March.txt
blob: f510662a353b9247604afabaadc6af9b66aedbdd (plain) (tree)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
From psihonavt at gmail.com  Mon Mar  3 21:49:33 2014
From: psihonavt at gmail.com (Anton Koval')
Date: Mon, 3 Mar 2014 22:49:33 +0200
Subject: [99s-extend] usage of make_* command
Message-ID: <CAD9h6NFVnE3y6QDj9WPMA8sKZWwzE6==9c8MzJitE=GYEocgmw@mail.gmail.com>

Hello,

I have next structure of my project:
.
??? deps
?   ??? cowboy
?   ??? cowlib
?   ??? erlang_iconv
?   ??? erlydtl
?   ??? mochiweb_xpath
?   ??? ranch
??? ebin
?   ??? fetchers.beam
?   ??? parsers.beam
?   ??? wasearch_sup.beam
??? erlang.mk
??? Makefile
??? _rel
?   ??? ....
??? relx
??? relx.config
??? src
?   ??? fetchers.erl
?   ??? main_handler.erl
?   ??? parsers.erl
?   ??? tests
?   ?   ??? parsers_SUITE_data
?   ?   ??? parsers_SUITE.erl
?   ?   ??? ....
?   ??? wasearch_app.erl
?   ??? wasearch.app.src
?   ??? wasearch_sup.erl
??? templates
    ??? index.dtl

I would prefer to store tests not in `src` directory but rather in `tests`
subdirectory.
Erlang.mk README says: You can run an individual test suite by using the
special test_* targets. For example if you have a common_test suite named
spdy and you want to run only this suite and not the others, you can use
the make test_spdy command.
And of course `make test_parsers`  returns `no rule to make target` error.
Is there a way to run suites from custom directory with
`make_<mod_name_with_suite>` command?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ninenines.eu/archives/extend/attachments/20140303/52007acc/attachment.html>

From mark.nijhof at cre8ivethought.com  Thu Mar  6 00:47:08 2014
From: mark.nijhof at cre8ivethought.com (Mark Nijhof)
Date: Thu, 6 Mar 2014 00:47:08 +0100
Subject: [99s-extend] Cowboy pre request filter
Message-ID: <CACE=TJris=4eTreF13p+bSmhfEqoKtpfj3PGyMCup1zfCRurkQ@mail.gmail.com>

Hi,

I want to create a module that basically sits between the incoming request
and the http handler for that request to ensure a request is authenticated
(using a cookie), if the request is not authenticated then I like to
redirect to a specific login page (which should not be filtered).

Is this possible with Cowboy? Should I use the onrequest hook (not sure if
I can force redirects from there) for that or is there a better way?

Cheers,

-Mark

-- 
Mark Nijhof
t:   @MarkNijhof <https://twitter.com/MarkNijhof>
s:  marknijhof
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ninenines.eu/archives/extend/attachments/20140306/a517215b/attachment.html>

From mark.nijhof at cre8ivethought.com  Thu Mar  6 10:52:01 2014
From: mark.nijhof at cre8ivethought.com (Mark Nijhof)
Date: Thu, 6 Mar 2014 10:52:01 +0100
Subject: [99s-extend] Cowboy pre request filter
In-Reply-To: <CACE=TJris=4eTreF13p+bSmhfEqoKtpfj3PGyMCup1zfCRurkQ@mail.gmail.com>
References: <CACE=TJris=4eTreF13p+bSmhfEqoKtpfj3PGyMCup1zfCRurkQ@mail.gmail.com>
Message-ID: <CACE=TJqaoxrqsCSnN44s_5x4MabgWBVfaN_pecVrShnUuU-9aQ@mail.gmail.com>

I also found the answer to my own question: custom middleware

I just created:

   1 -module(authentication_middleware).
   2
   3 -behaviour(cowboy_middleware).
   4
   5 -export([execute/2]).
   6
   7 execute(Req, Env) ->
   8
   9     {Path, Req1} = cowboy_req:path(Req),
  10
  11     case Path of
  12         <<"/login.html">> ->
  13             {ok, Req1, Env};
  14         <<"/do_login">> ->
  15             {ok, Req1, Env};
  16         _ ->
  17             case id3as_security:is_request_authenticated(Req1) of
  18                 {error, eauth, Req2} ->
  19                     {ok, Req4} = cowboy_req:reply(303,
[{<<"Location">>, <<"/login.html">>}], "", Req2),
  20                     {halt, Req4};
  21                 {authenticated, _Id, Req2} ->
  22                    {ok, Req2, Env}
  23             end
  24     end.

And put this between the cowboy_router and cowboy_handler and life is all
good.

-Mark



On Thu, Mar 6, 2014 at 12:47 AM, Mark Nijhof <mark.nijhof at cre8ivethought.com
> wrote:

> Hi,
>
> I want to create a module that basically sits between the incoming request
> and the http handler for that request to ensure a request is authenticated
> (using a cookie), if the request is not authenticated then I like to
> redirect to a specific login page (which should not be filtered).
>
> Is this possible with Cowboy? Should I use the onrequest hook (not sure if
> I can force redirects from there) for that or is there a better way?
>
> Cheers,
>
> -Mark
>
> --
> Mark Nijhof
> t:   @MarkNijhof <https://twitter.com/MarkNijhof>
> s:  marknijhof
>
>


-- 
Mark Nijhof
t:   @MarkNijhof <https://twitter.com/MarkNijhof>
s:  marknijhof
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ninenines.eu/archives/extend/attachments/20140306/24422ef2/attachment.html>

From essen at ninenines.eu  Thu Mar  6 15:40:59 2014
From: essen at ninenines.eu (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=)
Date: Thu, 06 Mar 2014 15:40:59 +0100
Subject: [99s-extend] usage of make_* command
In-Reply-To: <CAD9h6NFVnE3y6QDj9WPMA8sKZWwzE6==9c8MzJitE=GYEocgmw@mail.gmail.com>
References: <CAD9h6NFVnE3y6QDj9WPMA8sKZWwzE6==9c8MzJitE=GYEocgmw@mail.gmail.com>
Message-ID: <[email protected]>

Tests should be in ./tests, not ./src/tests.

If you put them in ./tests everything you mentioned will work.

On 03/03/2014 09:49 PM, Anton Koval' wrote:
> Hello,
>
> I have next structure of my project:
> .
> ??? deps
> ?   ??? cowboy
> ?   ??? cowlib
> ?   ??? erlang_iconv
> ?   ??? erlydtl
> ?   ??? mochiweb_xpath
> ?   ??? ranch
> ??? ebin
> ?   ??? fetchers.beam
> ?   ??? parsers.beam
> ?   ??? wasearch_sup.beam
> ??? erlang.mk <http://erlang.mk>
> ??? Makefile
> ??? _rel
> ?   ??? ....
> ??? relx
> ??? relx.config
> ??? src
> ?   ??? fetchers.erl
> ?   ??? main_handler.erl
> ?   ??? parsers.erl
> ?   ??? tests
> ?   ?   ??? parsers_SUITE_data
> ?   ?   ??? parsers_SUITE.erl
> ?   ?   ??? ....
> ?   ??? wasearch_app.erl
> ?   ??? wasearch.app.src
> ?   ??? wasearch_sup.erl
> ??? templates
>      ??? index.dtl
>
> I would prefer to store tests not in `src` directory but rather in
> `tests` subdirectory.
> Erlang.mk README says: You can run an individual test suite by using the
> special |test_*| targets. For example if you have a common_test suite
> named |spdy| and you want to run only this suite and not the others, you
> can use the |make test_spdy| command.
> And of course `make test_parsers`  returns `no rule to make target` error.
> Is there a way to run suites from custom directory with
> `make_<mod_name_with_suite>` command?
>
>
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>

-- 
Lo?c Hoguin
http://ninenines.eu


From psihonavt at gmail.com  Thu Mar  6 15:50:01 2014
From: psihonavt at gmail.com (Anton Koval')
Date: Thu, 6 Mar 2014 16:50:01 +0200
Subject: [99s-extend] usage of make_* command
In-Reply-To: <[email protected]>
References: <CAD9h6NFVnE3y6QDj9WPMA8sKZWwzE6==9c8MzJitE=GYEocgmw@mail.gmail.com>
 <[email protected]>
Message-ID: <CAD9h6NHaXQFX518wFdLNpycFVuu0bXN4NKzMqztnVN0rLu6BeA@mail.gmail.com>

Thank you for answer.
Is it common way (for OTP-based application) to store tests in `tests`
subdirectory rather then in `src/tests/`?


On Thu, Mar 6, 2014 at 4:40 PM, Lo?c Hoguin <essen at ninenines.eu> wrote:

> Tests should be in ./tests, not ./src/tests.
>
> If you put them in ./tests everything you mentioned will work.
>
>
> On 03/03/2014 09:49 PM, Anton Koval' wrote:
>
>> Hello,
>>
>> I have next structure of my project:
>> .
>> ??? deps
>> ?   ??? cowboy
>> ?   ??? cowlib
>> ?   ??? erlang_iconv
>> ?   ??? erlydtl
>> ?   ??? mochiweb_xpath
>> ?   ??? ranch
>> ??? ebin
>> ?   ??? fetchers.beam
>> ?   ??? parsers.beam
>> ?   ??? wasearch_sup.beam
>> ??? erlang.mk <http://erlang.mk>
>>
>> ??? Makefile
>> ??? _rel
>> ?   ??? ....
>> ??? relx
>> ??? relx.config
>> ??? src
>> ?   ??? fetchers.erl
>> ?   ??? main_handler.erl
>> ?   ??? parsers.erl
>> ?   ??? tests
>> ?   ?   ??? parsers_SUITE_data
>> ?   ?   ??? parsers_SUITE.erl
>> ?   ?   ??? ....
>> ?   ??? wasearch_app.erl
>> ?   ??? wasearch.app.src
>> ?   ??? wasearch_sup.erl
>> ??? templates
>>      ??? index.dtl
>>
>> I would prefer to store tests not in `src` directory but rather in
>> `tests` subdirectory.
>> Erlang.mk README says: You can run an individual test suite by using the
>> special |test_*| targets. For example if you have a common_test suite
>> named |spdy| and you want to run only this suite and not the others, you
>> can use the |make test_spdy| command.
>> And of course `make test_parsers`  returns `no rule to make target` error.
>> Is there a way to run suites from custom directory with
>> `make_<mod_name_with_suite>` command?
>>
>>
>> _______________________________________________
>> Extend mailing list
>> Extend at lists.ninenines.eu
>> https://lists.ninenines.eu/listinfo/extend
>>
>>
> --
> Lo?c Hoguin
> http://ninenines.eu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ninenines.eu/archives/extend/attachments/20140306/6fa8fe3b/attachment.html>

From essen at ninenines.eu  Thu Mar  6 15:51:58 2014
From: essen at ninenines.eu (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=)
Date: Thu, 06 Mar 2014 15:51:58 +0100
Subject: [99s-extend] usage of make_* command
In-Reply-To: <CAD9h6NHaXQFX518wFdLNpycFVuu0bXN4NKzMqztnVN0rLu6BeA@mail.gmail.com>
References: <CAD9h6NFVnE3y6QDj9WPMA8sKZWwzE6==9c8MzJitE=GYEocgmw@mail.gmail.com>	<[email protected]>
 <CAD9h6NHaXQFX518wFdLNpycFVuu0bXN4NKzMqztnVN0rLu6BeA@mail.gmail.com>
Message-ID: <[email protected]>

Sorry I meant ./test/ not ./tests/

But yes. That's how OTP does it.

On 03/06/2014 03:50 PM, Anton Koval' wrote:
> Thank you for answer.
> Is it common way (for OTP-based application) to store tests in `tests`
> subdirectory rather then in `src/tests/`?
>
>
> On Thu, Mar 6, 2014 at 4:40 PM, Lo?c Hoguin <essen at ninenines.eu
> <mailto:essen at ninenines.eu>> wrote:
>
>     Tests should be in ./tests, not ./src/tests.
>
>     If you put them in ./tests everything you mentioned will work.
>
>
>     On 03/03/2014 09:49 PM, Anton Koval' wrote:
>
>         Hello,
>
>         I have next structure of my project:
>         .
>         ??? deps
>         ?   ??? cowboy
>         ?   ??? cowlib
>         ?   ??? erlang_iconv
>         ?   ??? erlydtl
>         ?   ??? mochiweb_xpath
>         ?   ??? ranch
>         ??? ebin
>         ?   ??? fetchers.beam
>         ?   ??? parsers.beam
>         ?   ??? wasearch_sup.beam
>         ??? erlang.mk <http://erlang.mk> <http://erlang.mk>
>
>         ??? Makefile
>         ??? _rel
>         ?   ??? ....
>         ??? relx
>         ??? relx.config
>         ??? src
>         ?   ??? fetchers.erl
>         ?   ??? main_handler.erl
>         ?   ??? parsers.erl
>         ?   ??? tests
>         ?   ?   ??? parsers_SUITE_data
>         ?   ?   ??? parsers_SUITE.erl
>         ?   ?   ??? ....
>         ?   ??? wasearch_app.erl
>         ?   ??? wasearch.app.src
>         ?   ??? wasearch_sup.erl
>         ??? templates
>               ??? index.dtl
>
>         I would prefer to store tests not in `src` directory but rather in
>         `tests` subdirectory.
>         Erlang.mk README says: You can run an individual test suite by
>         using the
>         special |test_*| targets. For example if you have a common_test
>         suite
>         named |spdy| and you want to run only this suite and not the
>         others, you
>         can use the |make test_spdy| command.
>         And of course `make test_parsers`  returns `no rule to make
>         target` error.
>         Is there a way to run suites from custom directory with
>         `make_<mod_name_with_suite>` command?
>
>
>         _________________________________________________
>         Extend mailing list
>         Extend at lists.ninenines.eu <mailto:Extend at lists.ninenines.eu>
>         https://lists.ninenines.eu/__listinfo/extend
>         <https://lists.ninenines.eu/listinfo/extend>
>
>
>     --
>     Lo?c Hoguin
>     http://ninenines.eu
>
>

-- 
Lo?c Hoguin
http://ninenines.eu


From lloyd at writersglen.com  Thu Mar  6 21:29:59 2014
From: lloyd at writersglen.com (lloyd at writersglen.com)
Date: Thu, 6 Mar 2014 15:29:59 -0500 (EST)
Subject: [99s-extend] Trying to grok erlang.mk
Message-ID: <[email protected]>

Hello,

To secure my understanding of erlang.mk, I've been trying to create the simplest possible example I can imagine. Which gives me this:

min
   erlang.mk
   Makefile
   src
      min.app.src
      min.erl

*** Where Makefile is:

PROJECT = min

include erlang.mk

*** min.app.src is:

{application, min,
         [{description,[]},
          {vsn,"0.1.0"},
          {registered,[]},
          {applications,[kernel,stdlib]},
          {env,[]},
          {modules,[]}]}.

*** and min.erl is:

-module(min).

-export([hello/0]).

hello() ->
   io:format("Hello min!~n~n").

*** But when I call make, I get this:

/min$ make
 ERLC   min.erl
 APP    min .app.src
cat: src/min: No such file or directory
cat: .app.src: No such file or directory
sed: can't read .app: No such file or directory
make: *** [app] Error 2

*** Observations

min.erl compiles just  fine
min.app.src breaks the compile

*** Questions: 

1) How can I correct this?
2) How can I structure directories and make files for a project that involves several applications?

Many thanks,

LRP


*********************************************
My books:

THE GOSPEL OF ASHES
http://thegospelofashes.com

Strength is not enough. Do they have the courage 
and the cunning? Can they survive long enough to 
save the lives of millions?  

FREEIN' PANCHO
http://freeinpancho.com

A community of misfits help a troubled boy find his way 

AYA TAKEO
http://ayatakeo.com

Star-crossed love, war and power in an alternative 
universe

Available through Amazon or by request from your 
favorite bookstore


**********************************************



From ivan at llaisdy.com  Fri Mar  7 13:37:27 2014
From: ivan at llaisdy.com (Ivan Uemlianin)
Date: Fri, 07 Mar 2014 12:37:27 +0000
Subject: [99s-extend] Trying to grok erlang.mk
In-Reply-To: <[email protected]>
References: <[email protected]>
Message-ID: <[email protected]>

Dear Lloyd

I've just tried this with file layout and contents copied from your 
email, and make works fine here I'm afraid.

One odd thing I noticed in your make output ...

 > /min$ make
 >   ERLC   min.erl
 >   APP    min .app.src
 > cat: src/min: No such file or directory
 > cat: .app.src: No such file or directory
 > sed: can't read .app: No such file or directory
 > make: *** [app] Error 2

... is that in the APP line, the filename min.app.src has a space in it, 
and it looks (in the cat lines) like it's broken down into src/min and 
.app.src (ie ./.app.src).  I can't imagine why that's happening, but 
that's what's causing the problem I should think.

 > 2) How can I structure directories and make files for a project
 >    that involves several applications?

I don't know if it's the "correct" way with erlang.mk but, as a refugee 
from rebar, I have apps set out rebar-style and use old-school recursive 
make. e.g.:

max/
   erlang.mk
   Makefile
   apps/
     app1/
       Makefile
       src/
     app2/
       Makefile
       src/

Top level Makefile doesn't need to include erlang.mk, and has lines like:

all:
	$(MAKE) -C apps/app1
	$(MAKE) -C apps/app2

Lower level Makefiles include erlang.mk.

Best wishes

Ivan


On 06/03/2014 20:29, lloyd at writersglen.com wrote:
> Hello,
>
> To secure my understanding of erlang.mk, I've been trying to create the simplest possible example I can imagine. Which gives me this:
>
> min
>     erlang.mk
>     Makefile
>     src
>        min.app.src
>        min.erl
>
> *** Where Makefile is:
>
> PROJECT = min
>
> include erlang.mk
>
> *** min.app.src is:
>
> {application, min,
>           [{description,[]},
>            {vsn,"0.1.0"},
>            {registered,[]},
>            {applications,[kernel,stdlib]},
>            {env,[]},
>            {modules,[]}]}.
>
> *** and min.erl is:
>
> -module(min).
>
> -export([hello/0]).
>
> hello() ->
>     io:format("Hello min!~n~n").
>
> *** But when I call make, I get this:
>
> /min$ make
>   ERLC   min.erl
>   APP    min .app.src
> cat: src/min: No such file or directory
> cat: .app.src: No such file or directory
> sed: can't read .app: No such file or directory
> make: *** [app] Error 2
>
> *** Observations
>
> min.erl compiles just  fine
> min.app.src breaks the compile
>
> *** Questions:
>
> 1) How can I correct this?
> 2) How can I structure directories and make files for a project that involves several applications?
>
> Many thanks,
>
> LRP
>
>
> *********************************************
> My books:
>
> THE GOSPEL OF ASHES
> http://thegospelofashes.com
>
> Strength is not enough. Do they have the courage
> and the cunning? Can they survive long enough to
> save the lives of millions?
>
> FREEIN' PANCHO
> http://freeinpancho.com
>
> A community of misfits help a troubled boy find his way
>
> AYA TAKEO
> http://ayatakeo.com
>
> Star-crossed love, war and power in an alternative
> universe
>
> Available through Amazon or by request from your
> favorite bookstore
>
>
> **********************************************
>
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>

-- 
============================================================
Ivan A. Uemlianin PhD
Llaisdy
Speech Technology Research and Development

                     ivan at llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
               github.com/llaisdy
                      www.linkedin.com/in/ivanuemlianin

                         festina lente
============================================================


From essen at ninenines.eu  Fri Mar  7 17:56:01 2014
From: essen at ninenines.eu (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=)
Date: Fri, 07 Mar 2014 17:56:01 +0100
Subject: [99s-extend] Trying to grok erlang.mk
In-Reply-To: <[email protected]>
References: <[email protected]>
Message-ID: <[email protected]>

On 03/06/2014 09:29 PM, lloyd at writersglen.com wrote:
> PROJECT = min

You probably have an extra space at the end here, and erlang.mk doesn't 
trim them I guess. Please open a ticket!

-- 
Lo?c Hoguin
http://ninenines.eu


From ivan at llaisdy.com  Fri Mar  7 17:58:40 2014
From: ivan at llaisdy.com (Ivan Uemlianin)
Date: Fri, 07 Mar 2014 16:58:40 +0000
Subject: [99s-extend] Trying to grok erlang.mk
In-Reply-To: <[email protected]>
References: <[email protected]>
 <[email protected]>
Message-ID: <[email protected]>

Yes, that's it!  I've just tried it.

Good old make :)

On 07/03/2014 16:56, Lo?c Hoguin wrote:
> On 03/06/2014 09:29 PM, lloyd at writersglen.com wrote:
>> PROJECT = min
>
> You probably have an extra space at the end here, and erlang.mk doesn't
> trim them I guess. Please open a ticket!
>

-- 
============================================================
Ivan A. Uemlianin PhD
Llaisdy
Speech Technology Research and Development

                     ivan at llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
               github.com/llaisdy
                      www.linkedin.com/in/ivanuemlianin

                         festina lente
============================================================


From lloyd at writersglen.com  Mon Mar 10 20:44:27 2014
From: lloyd at writersglen.com (lloyd at writersglen.com)
Date: Mon, 10 Mar 2014 15:44:27 -0400 (EDT)
Subject: [99s-extend] =?utf-8?q?Getting_started_error=3A___behaviour_cowbo?=
 =?utf-8?q?y=5Fhttp=5Fhandler_undefined?=
Message-ID: <[email protected]>

Hello,

I've slavishly emulated the "Getting started" example in the guide: 

http://ninenines.eu/docs/en/cowboy/HEAD/guide/getting_started/

But, when I compile I get this error:

yada yada
 ERLC   hello_erlang_app.erl hello_handler.erl hello_erlang_sup.erl
compile: warnings being treated as errors
src/hello_handler.erl:2: behaviour cowboy_http_handler undefined
make: *** [ebin/hello_erlang.app] Error 1

Cowboy seems to be correctly loaded and compiled as a dependency. I can see .../cowboy/ebin/cowboy_http_handler.beam

However, when I remove the line -behavior(cowboy_http_handler) from hello_handler.erl, system compiles and creates release just fine.

% -behavior(cowboy_http_handler).

Could this be a bug in Getting started or some dunder-headed thing on my end?

Thanks,

LRP


*********************************************
My books:

THE GOSPEL OF ASHES
http://thegospelofashes.com

Strength is not enough. Do they have the courage 
and the cunning? Can they survive long enough to 
save the lives of millions?  

FREEIN' PANCHO
http://freeinpancho.com

A community of misfits help a troubled boy find his way 

AYA TAKEO
http://ayatakeo.com

Star-crossed love, war and power in an alternative 
universe

Available through Amazon or by request from your 
favorite bookstore


**********************************************



From essen at ninenines.eu  Mon Mar 10 21:36:22 2014
From: essen at ninenines.eu (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=)
Date: Mon, 10 Mar 2014 21:36:22 +0100
Subject: [99s-extend] Getting started error: behaviour
 cowboy_http_handler undefined
In-Reply-To: <[email protected]>
References: <[email protected]>
Message-ID: <[email protected]>

Try updating Erlang or Cowboy, this isn't the first time this happens 
and I fixed something at some point.

Also see if you have ERL_LIBS already defined, in which case there might 
be a bug in Cowboy.

On 03/10/2014 08:44 PM, lloyd at writersglen.com wrote:
> Hello,
>
> I've slavishly emulated the "Getting started" example in the guide:
>
> http://ninenines.eu/docs/en/cowboy/HEAD/guide/getting_started/
>
> But, when I compile I get this error:
>
> yada yada
>   ERLC   hello_erlang_app.erl hello_handler.erl hello_erlang_sup.erl
> compile: warnings being treated as errors
> src/hello_handler.erl:2: behaviour cowboy_http_handler undefined
> make: *** [ebin/hello_erlang.app] Error 1
>
> Cowboy seems to be correctly loaded and compiled as a dependency. I can see .../cowboy/ebin/cowboy_http_handler.beam
>
> However, when I remove the line -behavior(cowboy_http_handler) from hello_handler.erl, system compiles and creates release just fine.
>
> % -behavior(cowboy_http_handler).
>
> Could this be a bug in Getting started or some dunder-headed thing on my end?
>
> Thanks,
>
> LRP
>
>
> *********************************************
> My books:
>
> THE GOSPEL OF ASHES
> http://thegospelofashes.com
>
> Strength is not enough. Do they have the courage
> and the cunning? Can they survive long enough to
> save the lives of millions?
>
> FREEIN' PANCHO
> http://freeinpancho.com
>
> A community of misfits help a troubled boy find his way
>
> AYA TAKEO
> http://ayatakeo.com
>
> Star-crossed love, war and power in an alternative
> universe
>
> Available through Amazon or by request from your
> favorite bookstore
>
>
> **********************************************
>
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>

-- 
Lo?c Hoguin
http://ninenines.eu


From lloyd at writersglen.com  Wed Mar 12 23:51:04 2014
From: lloyd at writersglen.com (lloyd at writersglen.com)
Date: Wed, 12 Mar 2014 18:51:04 -0400 (EDT)
Subject: [99s-extend]
 =?utf-8?q?Getting_started_error=3A_behaviour_cowboy?=
 =?utf-8?q?=5Fhttp=5Fhandler_undefined?=
In-Reply-To: <[email protected]>
References: <[email protected]>
 <[email protected]>
Message-ID: <[email protected]>

Hi Lo?c,

Thanks for help.

I'm running cowboy master from GitHub and Erlang R16B02.

$ echo $ERL_LIBS

...gives me a directory that no longer exists; don't know how it got there, what it should be, or how to change it.

E.g.: /home/lloyd/Programming/Erlang/zippity/apps

I've looked in .erlang and tried $ export ERL_LIBS=<my path to hello_erlang/ebin>.

Thanks again,

LRP

-----Original Message-----
From: "Lo?c Hoguin" <essen at ninenines.eu>
Sent: Monday, March 10, 2014 4:36pm
To: lloyd at writersglen.com, extend at lists.ninenines.eu
Subject: Re: [99s-extend] Getting started error: behaviour cowboy_http_handler undefined

Try updating Erlang or Cowboy, this isn't the first time this happens 
and I fixed something at some point.

Also see if you have ERL_LIBS already defined, in which case there might 
be a bug in Cowboy.

On 03/10/2014 08:44 PM, lloyd at writersglen.com wrote:
> Hello,
>
> I've slavishly emulated the "Getting started" example in the guide:
>
> http://ninenines.eu/docs/en/cowboy/HEAD/guide/getting_started/
>
> But, when I compile I get this error:
>
> yada yada
>   ERLC   hello_erlang_app.erl hello_handler.erl hello_erlang_sup.erl
> compile: warnings being treated as errors
> src/hello_handler.erl:2: behaviour cowboy_http_handler undefined
> make: *** [ebin/hello_erlang.app] Error 1
>
> Cowboy seems to be correctly loaded and compiled as a dependency. I can see .../cowboy/ebin/cowboy_http_handler.beam
>
> However, when I remove the line -behavior(cowboy_http_handler) from hello_handler.erl, system compiles and creates release just fine.
>
> % -behavior(cowboy_http_handler).
>
> Could this be a bug in Getting started or some dunder-headed thing on my end?
>
> Thanks,
>
> LRP
>
>
> *********************************************
> My books:
>
> THE GOSPEL OF ASHES
> http://thegospelofashes.com
>
> Strength is not enough. Do they have the courage
> and the cunning? Can they survive long enough to
> save the lives of millions?
>
> FREEIN' PANCHO
> http://freeinpancho.com
>
> A community of misfits help a troubled boy find his way
>
> AYA TAKEO
> http://ayatakeo.com
>
> Star-crossed love, war and power in an alternative
> universe
>
> Available through Amazon or by request from your
> favorite bookstore
>
>
> **********************************************
>
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>

-- 
Lo?c Hoguin
http://ninenines.eu




From essen at ninenines.eu  Wed Mar 12 23:57:16 2014
From: essen at ninenines.eu (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=)
Date: Wed, 12 Mar 2014 23:57:16 +0100
Subject: [99s-extend] Getting started error: behaviour
 cowboy_http_handler undefined
In-Reply-To: <[email protected]>
References: <[email protected]>
 <[email protected]> <[email protected]>
Message-ID: <[email protected]>

Can you try again after running "unset ERL_LIBS"?

On 03/12/2014 11:51 PM, lloyd at writersglen.com wrote:
> Hi Lo?c,
>
> Thanks for help.
>
> I'm running cowboy master from GitHub and Erlang R16B02.
>
> $ echo $ERL_LIBS
>
> ...gives me a directory that no longer exists; don't know how it got there, what it should be, or how to change it.
>
> E.g.: /home/lloyd/Programming/Erlang/zippity/apps
>
> I've looked in .erlang and tried $ export ERL_LIBS=<my path to hello_erlang/ebin>.
>
> Thanks again,
>
> LRP
>
> -----Original Message-----
> From: "Lo?c Hoguin" <essen at ninenines.eu>
> Sent: Monday, March 10, 2014 4:36pm
> To: lloyd at writersglen.com, extend at lists.ninenines.eu
> Subject: Re: [99s-extend] Getting started error: behaviour cowboy_http_handler undefined
>
> Try updating Erlang or Cowboy, this isn't the first time this happens
> and I fixed something at some point.
>
> Also see if you have ERL_LIBS already defined, in which case there might
> be a bug in Cowboy.
>
> On 03/10/2014 08:44 PM, lloyd at writersglen.com wrote:
>> Hello,
>>
>> I've slavishly emulated the "Getting started" example in the guide:
>>
>> http://ninenines.eu/docs/en/cowboy/HEAD/guide/getting_started/
>>
>> But, when I compile I get this error:
>>
>> yada yada
>>    ERLC   hello_erlang_app.erl hello_handler.erl hello_erlang_sup.erl
>> compile: warnings being treated as errors
>> src/hello_handler.erl:2: behaviour cowboy_http_handler undefined
>> make: *** [ebin/hello_erlang.app] Error 1
>>
>> Cowboy seems to be correctly loaded and compiled as a dependency. I can see .../cowboy/ebin/cowboy_http_handler.beam
>>
>> However, when I remove the line -behavior(cowboy_http_handler) from hello_handler.erl, system compiles and creates release just fine.
>>
>> % -behavior(cowboy_http_handler).
>>
>> Could this be a bug in Getting started or some dunder-headed thing on my end?
>>
>> Thanks,
>>
>> LRP
>>
>>
>> *********************************************
>> My books:
>>
>> THE GOSPEL OF ASHES
>> http://thegospelofashes.com
>>
>> Strength is not enough. Do they have the courage
>> and the cunning? Can they survive long enough to
>> save the lives of millions?
>>
>> FREEIN' PANCHO
>> http://freeinpancho.com
>>
>> A community of misfits help a troubled boy find his way
>>
>> AYA TAKEO
>> http://ayatakeo.com
>>
>> Star-crossed love, war and power in an alternative
>> universe
>>
>> Available through Amazon or by request from your
>> favorite bookstore
>>
>>
>> **********************************************
>>
>> _______________________________________________
>> Extend mailing list
>> Extend at lists.ninenines.eu
>> https://lists.ninenines.eu/listinfo/extend
>>
>

-- 
Lo?c Hoguin
http://ninenines.eu


From lloyd at writersglen.com  Thu Mar 13 00:43:16 2014
From: lloyd at writersglen.com (lloyd at writersglen.com)
Date: Wed, 12 Mar 2014 19:43:16 -0400 (EDT)
Subject: [99s-extend]
 =?utf-8?q?Getting_started_error=3A_behaviour_cowboy?=
 =?utf-8?q?=5Fhttp=5Fhandler_undefined?=
In-Reply-To: <[email protected]>
References: <[email protected]>
 <[email protected]> 
 <[email protected]> <[email protected]>
Message-ID: <[email protected]>

Hi,

That fixed it!

But where can I go to understand why and prevent it in future? 

I've googled ERL_LIBS, but not found much enlightenment. Should there possibly be a note in Cowboy docs? Or is this something idiosyncratic to my system?

Many thanks!

Lloyd

-----Original Message-----
From: "Lo?c Hoguin" <essen at ninenines.eu>
Sent: Wednesday, March 12, 2014 6:57pm
To: lloyd at writersglen.com
Cc: extend at lists.ninenines.eu
Subject: Re: [99s-extend] Getting started error: behaviour cowboy_http_handler undefined

Can you try again after running "unset ERL_LIBS"?

On 03/12/2014 11:51 PM, lloyd at writersglen.com wrote:
> Hi Lo?c,
>
> Thanks for help.
>
> I'm running cowboy master from GitHub and Erlang R16B02.
>
> $ echo $ERL_LIBS
>
> ...gives me a directory that no longer exists; don't know how it got there, what it should be, or how to change it.
>
> E.g.: /home/lloyd/Programming/Erlang/zippity/apps
>
> I've looked in .erlang and tried $ export ERL_LIBS=<my path to hello_erlang/ebin>.
>
> Thanks again,
>
> LRP
>
> -----Original Message-----
> From: "Lo?c Hoguin" <essen at ninenines.eu>
> Sent: Monday, March 10, 2014 4:36pm
> To: lloyd at writersglen.com, extend at lists.ninenines.eu
> Subject: Re: [99s-extend] Getting started error: behaviour cowboy_http_handler undefined
>
> Try updating Erlang or Cowboy, this isn't the first time this happens
> and I fixed something at some point.
>
> Also see if you have ERL_LIBS already defined, in which case there might
> be a bug in Cowboy.
>
> On 03/10/2014 08:44 PM, lloyd at writersglen.com wrote:
>> Hello,
>>
>> I've slavishly emulated the "Getting started" example in the guide:
>>
>> http://ninenines.eu/docs/en/cowboy/HEAD/guide/getting_started/
>>
>> But, when I compile I get this error:
>>
>> yada yada
>>    ERLC   hello_erlang_app.erl hello_handler.erl hello_erlang_sup.erl
>> compile: warnings being treated as errors
>> src/hello_handler.erl:2: behaviour cowboy_http_handler undefined
>> make: *** [ebin/hello_erlang.app] Error 1
>>
>> Cowboy seems to be correctly loaded and compiled as a dependency. I can see .../cowboy/ebin/cowboy_http_handler.beam
>>
>> However, when I remove the line -behavior(cowboy_http_handler) from hello_handler.erl, system compiles and creates release just fine.
>>
>> % -behavior(cowboy_http_handler).
>>
>> Could this be a bug in Getting started or some dunder-headed thing on my end?
>>
>> Thanks,
>>
>> LRP
>>
>>
>> *********************************************
>> My books:
>>
>> THE GOSPEL OF ASHES
>> http://thegospelofashes.com
>>
>> Strength is not enough. Do they have the courage
>> and the cunning? Can they survive long enough to
>> save the lives of millions?
>>
>> FREEIN' PANCHO
>> http://freeinpancho.com
>>
>> A community of misfits help a troubled boy find his way
>>
>> AYA TAKEO
>> http://ayatakeo.com
>>
>> Star-crossed love, war and power in an alternative
>> universe
>>
>> Available through Amazon or by request from your
>> favorite bookstore
>>
>>
>> **********************************************
>>
>> _______________________________________________
>> Extend mailing list
>> Extend at lists.ninenines.eu
>> https://lists.ninenines.eu/listinfo/extend
>>
>

-- 
Lo?c Hoguin
http://ninenines.eu




From essen at ninenines.eu  Thu Mar 13 00:46:57 2014
From: essen at ninenines.eu (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=)
Date: Thu, 13 Mar 2014 00:46:57 +0100
Subject: [99s-extend] Getting started error: behaviour
 cowboy_http_handler undefined
In-Reply-To: <[email protected]>
References: <[email protected]>
 <[email protected]> <[email protected]>
 <[email protected]> <[email protected]>
Message-ID: <[email protected]>

It's explained here: http://www.erlang.org/doc/man/code.html

I am not sure why it caused issues on your system, possibly Erlang 
ignored it because there was an invalid folder in there. I don't really 
know.

On 03/13/2014 12:43 AM, lloyd at writersglen.com wrote:
> Hi,
>
> That fixed it!
>
> But where can I go to understand why and prevent it in future?
>
> I've googled ERL_LIBS, but not found much enlightenment. Should there possibly be a note in Cowboy docs? Or is this something idiosyncratic to my system?
>
> Many thanks!
>
> Lloyd
>
> -----Original Message-----
> From: "Lo?c Hoguin" <essen at ninenines.eu>
> Sent: Wednesday, March 12, 2014 6:57pm
> To: lloyd at writersglen.com
> Cc: extend at lists.ninenines.eu
> Subject: Re: [99s-extend] Getting started error: behaviour cowboy_http_handler undefined
>
> Can you try again after running "unset ERL_LIBS"?
>
> On 03/12/2014 11:51 PM, lloyd at writersglen.com wrote:
>> Hi Lo?c,
>>
>> Thanks for help.
>>
>> I'm running cowboy master from GitHub and Erlang R16B02.
>>
>> $ echo $ERL_LIBS
>>
>> ...gives me a directory that no longer exists; don't know how it got there, what it should be, or how to change it.
>>
>> E.g.: /home/lloyd/Programming/Erlang/zippity/apps
>>
>> I've looked in .erlang and tried $ export ERL_LIBS=<my path to hello_erlang/ebin>.
>>
>> Thanks again,
>>
>> LRP
>>
>> -----Original Message-----
>> From: "Lo?c Hoguin" <essen at ninenines.eu>
>> Sent: Monday, March 10, 2014 4:36pm
>> To: lloyd at writersglen.com, extend at lists.ninenines.eu
>> Subject: Re: [99s-extend] Getting started error: behaviour cowboy_http_handler undefined
>>
>> Try updating Erlang or Cowboy, this isn't the first time this happens
>> and I fixed something at some point.
>>
>> Also see if you have ERL_LIBS already defined, in which case there might
>> be a bug in Cowboy.
>>
>> On 03/10/2014 08:44 PM, lloyd at writersglen.com wrote:
>>> Hello,
>>>
>>> I've slavishly emulated the "Getting started" example in the guide:
>>>
>>> http://ninenines.eu/docs/en/cowboy/HEAD/guide/getting_started/
>>>
>>> But, when I compile I get this error:
>>>
>>> yada yada
>>>     ERLC   hello_erlang_app.erl hello_handler.erl hello_erlang_sup.erl
>>> compile: warnings being treated as errors
>>> src/hello_handler.erl:2: behaviour cowboy_http_handler undefined
>>> make: *** [ebin/hello_erlang.app] Error 1
>>>
>>> Cowboy seems to be correctly loaded and compiled as a dependency. I can see .../cowboy/ebin/cowboy_http_handler.beam
>>>
>>> However, when I remove the line -behavior(cowboy_http_handler) from hello_handler.erl, system compiles and creates release just fine.
>>>
>>> % -behavior(cowboy_http_handler).
>>>
>>> Could this be a bug in Getting started or some dunder-headed thing on my end?
>>>
>>> Thanks,
>>>
>>> LRP
>>>
>>>
>>> *********************************************
>>> My books:
>>>
>>> THE GOSPEL OF ASHES
>>> http://thegospelofashes.com
>>>
>>> Strength is not enough. Do they have the courage
>>> and the cunning? Can they survive long enough to
>>> save the lives of millions?
>>>
>>> FREEIN' PANCHO
>>> http://freeinpancho.com
>>>
>>> A community of misfits help a troubled boy find his way
>>>
>>> AYA TAKEO
>>> http://ayatakeo.com
>>>
>>> Star-crossed love, war and power in an alternative
>>> universe
>>>
>>> Available through Amazon or by request from your
>>> favorite bookstore
>>>
>>>
>>> **********************************************
>>>
>>> _______________________________________________
>>> Extend mailing list
>>> Extend at lists.ninenines.eu
>>> https://lists.ninenines.eu/listinfo/extend
>>>
>>
>

-- 
Lo?c Hoguin
http://ninenines.eu


From joshua.mcquistan at mcq.io  Thu Mar 13 02:41:12 2014
From: joshua.mcquistan at mcq.io (Joshua McQuistan)
Date: Thu, 13 Mar 2014 01:41:12 +0000
Subject: [99s-extend] Updating Cowboy applications
Message-ID: <[email protected]>

Hello all,

I have written a Cowboy application that works fine over localhost. I'm
now looking at ways of deploying and updating it i.e., moving from dev
to prod in a nice manner.

I have dug around the archives and have found that Cowboy does not
support hot code reloading meaning either a restart of the vm or playing
with code:reload_file is necessary.

The latter suggests a possible rewriting of OTP's code loading mechanism
and seems like it might be sensible to avoid.

The other approach then is a restart. In previous (non-Cowboy) set ups
I've used nginx on port 80 / 443 that talks to the web app via a unix
socket (e.g., "web/socket"). When updating I'll start a new instance on
a new socket (e.g., "web/socket.new") then rely on the file system's
"mv" to switch it to "web/socket"; this works because the underlying
file system guarantees mv to be atomic (or at least to never see a
missing file). I can then ask the old process to shut down nicely in the
background.

For this to work it would require Cowby / Ranch to be able to listen on
unix sockets. A glance at the documentation suggests that unix sockets
aren't available, is this the case? What's the feasibility of it getting
added?

It might just be simpler to load-balance across multiple servers and
safely take them out one at a time while updating.

My other question is, how do others approach this problem? Did I miss
something vitally obvious?

Regards,
Joshua


From essen at ninenines.eu  Thu Mar 13 14:22:03 2014
From: essen at ninenines.eu (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=)
Date: Thu, 13 Mar 2014 14:22:03 +0100
Subject: [99s-extend] Updating Cowboy applications
In-Reply-To: <[email protected]>
References: <[email protected]>
Message-ID: <[email protected]>

Deploying is easy: releases.

The "getting started" chapter of the guide, and all the examples use 
that and it should be pretty easy to do.

You can reload Cowboy modules directly using l(module). You can reload 
most Ranch modules too but some of them will require using sys. Ranch 
will get support for upgrades as soon as I finish the upgrade test 
suite, but it's still low priority.

And upgrade of Cowboy processes can only be added after we make them 
special processes, which is still a way to go.

There is no plans for supporting unix sockets for the simple reason that 
it is not portable. On the other hand, if you use a separate library to 
open a socket and give it to Ranch (socket option), possibly writing a 
specific transport module for it, then it's very possible that you can 
use unix sockets (and if it works, please do send feedback).

On 03/13/2014 02:41 AM, Joshua McQuistan wrote:
> Hello all,
>
> I have written a Cowboy application that works fine over localhost. I'm
> now looking at ways of deploying and updating it i.e., moving from dev
> to prod in a nice manner.
>
> I have dug around the archives and have found that Cowboy does not
> support hot code reloading meaning either a restart of the vm or playing
> with code:reload_file is necessary.
>
> The latter suggests a possible rewriting of OTP's code loading mechanism
> and seems like it might be sensible to avoid.
>
> The other approach then is a restart. In previous (non-Cowboy) set ups
> I've used nginx on port 80 / 443 that talks to the web app via a unix
> socket (e.g., "web/socket"). When updating I'll start a new instance on
> a new socket (e.g., "web/socket.new") then rely on the file system's
> "mv" to switch it to "web/socket"; this works because the underlying
> file system guarantees mv to be atomic (or at least to never see a
> missing file). I can then ask the old process to shut down nicely in the
> background.
>
> For this to work it would require Cowby / Ranch to be able to listen on
> unix sockets. A glance at the documentation suggests that unix sockets
> aren't available, is this the case? What's the feasibility of it getting
> added?
>
> It might just be simpler to load-balance across multiple servers and
> safely take them out one at a time while updating.
>
> My other question is, how do others approach this problem? Did I miss
> something vitally obvious?
>
> Regards,
> Joshua
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>

-- 
Lo?c Hoguin
http://ninenines.eu


From joshua.mcquistan at mcq.io  Thu Mar 13 15:23:09 2014
From: joshua.mcquistan at mcq.io (Joshua McQuistan)
Date: Thu, 13 Mar 2014 14:23:09 +0000
Subject: [99s-extend] Updating Cowboy applications
In-Reply-To: <[email protected]>
References: <[email protected]> <[email protected]>
Message-ID: <[email protected]>

> 
> I wish I knew enough to answer your question. But I do hope you publish a tutorial documenting your solution for those following you down the trail.

Will do.

On 13/03/14 13:22, Lo?c Hoguin wrote:
> 
> There is no plans for supporting unix sockets for the simple reason that
> it is not portable. On the other hand, if you use a separate library to
> open a socket and give it to Ranch (socket option), possibly writing a
> specific transport module for it, then it's very possible that you can
> use unix sockets (and if it works, please do send feedback).

I had missed this last night, I will try passing the socket down and see
if it works.

I can also see the gen_tcp:listen in ranch_tcp but I'd prefer to avoid that.


From Christopher.Phillips at turner.com  Fri Mar 14 19:52:07 2014
From: Christopher.Phillips at turner.com (Phillips, Christopher)
Date: Fri, 14 Mar 2014 18:52:07 +0000
Subject: [99s-extend] Cowboy unexpectedly timing out when reading the body
Message-ID: <CF48C816.16B3B%[email protected]>

On a dev server I had a Cowboy app suddenly start returning timeouts when calling cowboy_req:body_qs(Request), with surprising frequency, which in turn led to 500s back to the calling client. It only appeared to happen when hitting one particular resource, and was sporadic, and I was wondering if there might be some explanation related to Cowboy (as opposed to maybe really weird VM issues). For full disclosure, we would first check the body with cowboy_req:body(Request) as part of an access log, then ignore the returned cowboy_req:req() that call passed back, since we could not then stream the body off of it again. It was working fine, so I don't think it was related, but it seems more solid now after I removed it and I don't know if that's related or not.



Here is an example request that dumped when the process died -


{req,[{socket,#Port<0.7113>},{transport,ranch_tcp},{connection,keepalive},{pid,<0.1805.0>},{method,<<"POST">>},{version,'HTTP/1.1'},{peer,{{10,188,32,225},53188}},{host,<<"bps-feedschedulervip1.turner.com">>},{host_info,undefined},{port,8091},{path,<<"/encoders/Player1/record">>},{path_info,[<<"record">>]},{qs,<<"authToken=...">>},{qs_vals,[{<<"authToken">>,<<"...">>}]},{bindings,[{id,<<"Player1">>}]},{headers,[{<<"host">>,<<"bps-feedschedulervip1.turner.com:8091">>},{<<"content-type">>,<<"application/x-www-form-urlencoded; charset=UTF-8">>},{<<"origin">>,<<"http://bps-newstrondev1.turner.com">>},{<<"content-length">>,<<"48">>},{<<"connection">>,<<"keep-alive">>},{<<"accept">>,<<"application/json, text/javascript, */*; q=0.01">>},{<<"user-agent">>,<<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.74.9 (KHTML, like Gecko) Version/7.0.2 Safari/537.74.9">>},{<<"referer">>,<<"http://bps-newstrondev1.turner.com/newstron/record/record.html">>},{<<"accept-language">>,<<"en-us">>},{<<"accept-encoding">>,<<"gzip, deflate">>}]},{p_headers,[{<<"content-type">>,{<<"application">>,<<"x-www-form-urlencoded">>,[{<<"charset">>,<<"utf-8">>}]}},{<<"if-modified-since">>,undefined},{<<"if-none-match">>,undefined},{<<"if-unmodified-since">>,undefined},{<<"if-match">>,undefined},{<<"accept">>,[{{<<"application">>,<<"json">>,[]},1000,[]},{{<<"text">>,<<"javascript">>,[]},1000,[]},{{<<"*">>,<<"*">>,[]},10,[]}]},{<<"connection">>,[<<"keep-alive">>]}]},{cookies,undefined},{meta,[{charset,undefined},{media_type,{<<"application">>,<<"json">>,[]}}]},{body_state,waiting},{multipart,undefined},{buffer,<<>>},{resp_compress,false},{resp_state,waiting},{resp_headers,[{<<"content-type">>,[<<"application">>,<<"/">>,<<"json">>,<<>>]},{<<"Access-Control-Allow-Origin">>,<<"*">>}]},{resp_body,<<>>},{onresponse,#Fun<access_log_responder.onresponse.4>}]}




As I said, it may be just due to VM issues or something, but I figured I'd ask in case there was any obvious issue.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ninenines.eu/archives/extend/attachments/20140314/b2f802d3/attachment.html>

From essen at ninenines.eu  Fri Mar 14 19:56:38 2014
From: essen at ninenines.eu (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=)
Date: Fri, 14 Mar 2014 19:56:38 +0100
Subject: [99s-extend] Cowboy unexpectedly timing out when reading the
 body
In-Reply-To: <CF48C816.16B3B%[email protected]>
References: <CF48C816.16B3B%[email protected]>
Message-ID: <[email protected]>

Cowboy does have a timeout too small, that will be fixed soon (by making 
it configurable, per body-reading call). It will be in the next release.

On the other hand there's something weird in what you said.

On 03/14/2014 07:52 PM, Phillips, Christopher wrote:
> first check the body with cowboy_req:body(Request) as part of an access
> log, then ignore the returned cowboy_req:req() that call passed back,
> since we could not then stream the body off of it again. It was working
> fine, so I don't think it was related, but it seems more solid now after
> I removed it and I don't know if that's related or not.

If you ignore the Req being returned, especially after a body-reading 
call, then Cowboy will not be able to figure out that you actually read 
it, and will attempt to read it again to skip it, leading to issues.

-- 
Lo?c Hoguin
http://ninenines.eu


From Christopher.Phillips at turner.com  Fri Mar 14 20:07:40 2014
From: Christopher.Phillips at turner.com (Phillips, Christopher)
Date: Fri, 14 Mar 2014 19:07:40 +0000
Subject: [99s-extend] Cowboy unexpectedly timing out when reading the
 body
In-Reply-To: <[email protected]>
References: <CF48C816.16B3B%[email protected]>
 <[email protected]>
Message-ID: <CF48CAF9.16B5A%[email protected]>

  This body is -small-. 48 bytes was my test data (per the
content-length). That shouldn't take 5 seconds to read, and usually it
took a millisecond or two, and returned to the client (despite actually
controlling some hardware across a network and such) within a second. And
it was ND; I tested this thing a couple of times locally and it appeared
to work, and even deployed onto a VM it worked some of the time (as I
said, might have been hardware or some other weirdness).

  So can we only read the body once? Or what's the right approach if I
want to access the body in both a module registered to the
onrequest/onresponse callbacks, and in the REST handler?

On 3/14/14, 2:56 PM, "Lo?c Hoguin" <essen at ninenines.eu> wrote:

>Cowboy does have a timeout too small, that will be fixed soon (by making
>it configurable, per body-reading call). It will be in the next release.
>
>On the other hand there's something weird in what you said.
>
>On 03/14/2014 07:52 PM, Phillips, Christopher wrote:
>> first check the body with cowboy_req:body(Request) as part of an access
>> log, then ignore the returned cowboy_req:req() that call passed back,
>> since we could not then stream the body off of it again. It was working
>> fine, so I don't think it was related, but it seems more solid now after
>> I removed it and I don't know if that's related or not.
>
>If you ignore the Req being returned, especially after a body-reading
>call, then Cowboy will not be able to figure out that you actually read
>it, and will attempt to read it again to skip it, leading to issues.
>
>-- 
>Lo?c Hoguin
>http://ninenines.eu



From essen at ninenines.eu  Fri Mar 14 20:11:27 2014
From: essen at ninenines.eu (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=)
Date: Fri, 14 Mar 2014 20:11:27 +0100
Subject: [99s-extend] Cowboy unexpectedly timing out when reading the
 body
In-Reply-To: <CF48CAF9.16B5A%[email protected]>
References: <CF48C816.16B3B%[email protected]>
 <[email protected]>
 <CF48CAF9.16B5A%[email protected]>
Message-ID: <[email protected]>

Yep, only once. All functions that return {ok, ...} are like this. 
There's no right approach, that's left as an exercise to the developer. :-)

You can probably use cowboy_req:set_meta/meta if you really need to pass 
it around.

On 03/14/2014 08:07 PM, Phillips, Christopher wrote:
>    This body is -small-. 48 bytes was my test data (per the
> content-length). That shouldn't take 5 seconds to read, and usually it
> took a millisecond or two, and returned to the client (despite actually
> controlling some hardware across a network and such) within a second. And
> it was ND; I tested this thing a couple of times locally and it appeared
> to work, and even deployed onto a VM it worked some of the time (as I
> said, might have been hardware or some other weirdness).
>
>    So can we only read the body once? Or what's the right approach if I
> want to access the body in both a module registered to the
> onrequest/onresponse callbacks, and in the REST handler?
>
> On 3/14/14, 2:56 PM, "Lo?c Hoguin" <essen at ninenines.eu> wrote:
>
>> Cowboy does have a timeout too small, that will be fixed soon (by making
>> it configurable, per body-reading call). It will be in the next release.
>>
>> On the other hand there's something weird in what you said.
>>
>> On 03/14/2014 07:52 PM, Phillips, Christopher wrote:
>>> first check the body with cowboy_req:body(Request) as part of an access
>>> log, then ignore the returned cowboy_req:req() that call passed back,
>>> since we could not then stream the body off of it again. It was working
>>> fine, so I don't think it was related, but it seems more solid now after
>>> I removed it and I don't know if that's related or not.
>>
>> If you ignore the Req being returned, especially after a body-reading
>> call, then Cowboy will not be able to figure out that you actually read
>> it, and will attempt to read it again to skip it, leading to issues.
>>
>> --
>> Lo?c Hoguin
>> http://ninenines.eu
>

-- 
Lo?c Hoguin
http://ninenines.eu


From Christopher.Phillips at turner.com  Fri Mar 14 20:13:31 2014
From: Christopher.Phillips at turner.com (Phillips, Christopher)
Date: Fri, 14 Mar 2014 19:13:31 +0000
Subject: [99s-extend] Cowboy unexpectedly timing out when reading the
 body
In-Reply-To: <[email protected]>
References: <CF48C816.16B3B%[email protected]>
 <[email protected]>
 <CF48CAF9.16B5A%[email protected]>
 <[email protected]>
Message-ID: <CF48CD10.16B7C%[email protected]>

  Hmm, okay. Thanks Loic.

On 3/14/14, 3:11 PM, "Lo?c Hoguin" <essen at ninenines.eu> wrote:

>Yep, only once. All functions that return {ok, ...} are like this.
>There's no right approach, that's left as an exercise to the developer.
>:-)
>
>You can probably use cowboy_req:set_meta/meta if you really need to pass
>it around.
>
>On 03/14/2014 08:07 PM, Phillips, Christopher wrote:
>>    This body is -small-. 48 bytes was my test data (per the
>> content-length). That shouldn't take 5 seconds to read, and usually it
>> took a millisecond or two, and returned to the client (despite actually
>> controlling some hardware across a network and such) within a second.
>>And
>> it was ND; I tested this thing a couple of times locally and it appeared
>> to work, and even deployed onto a VM it worked some of the time (as I
>> said, might have been hardware or some other weirdness).
>>
>>    So can we only read the body once? Or what's the right approach if I
>> want to access the body in both a module registered to the
>> onrequest/onresponse callbacks, and in the REST handler?
>>
>> On 3/14/14, 2:56 PM, "Lo?c Hoguin" <essen at ninenines.eu> wrote:
>>
>>> Cowboy does have a timeout too small, that will be fixed soon (by
>>>making
>>> it configurable, per body-reading call). It will be in the next
>>>release.
>>>
>>> On the other hand there's something weird in what you said.
>>>
>>> On 03/14/2014 07:52 PM, Phillips, Christopher wrote:
>>>> first check the body with cowboy_req:body(Request) as part of an
>>>>access
>>>> log, then ignore the returned cowboy_req:req() that call passed back,
>>>> since we could not then stream the body off of it again. It was
>>>>working
>>>> fine, so I don't think it was related, but it seems more solid now
>>>>after
>>>> I removed it and I don't know if that's related or not.
>>>
>>> If you ignore the Req being returned, especially after a body-reading
>>> call, then Cowboy will not be able to figure out that you actually read
>>> it, and will attempt to read it again to skip it, leading to issues.
>>>
>>> --
>>> Lo?c Hoguin
>>> http://ninenines.eu
>>
>
>-- 
>Lo?c Hoguin
>http://ninenines.eu