ydim-html 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee09b798191d17c79bab0c40951673370c348de5
4
- data.tar.gz: 4a7975881b9814e1d91bc3c769346906b2dc777a
3
+ metadata.gz: d74b5692ac1c39d6a5e7982bb974ebcdcbbcfc41
4
+ data.tar.gz: 089fbc977d6989daba7f4bd04dbfd23d1be09579
5
5
  SHA512:
6
- metadata.gz: 1606eafd2dfc822e4f728ceca73ad7318a4462f585bda697a545d194f313a0b7705dc18c5fc3e807dc61c9cd58b68300683d288df44f714b5e533139e9dabd90
7
- data.tar.gz: 16df3caa011d98485306b329c8ce15f094e3b296c0a488b8c9f04c128359e93af70c095fbfd3455cac928ba55c6331dc5d6ec1b2e660c0969003f2d0eef65ccf
6
+ metadata.gz: bf2cf5a85a04e73b34bc995704e0305458a1dbe113320724483cacc0f64fdfb50940c44a3b65b8be2ad40faad8dfb566da4882785fa9e8ec9d4d245f9b9e5e27
7
+ data.tar.gz: 4aeeb8d4ca419dc16672d2933b053dfdb379c3e4a7dc011da62f7c57046382ea85366ae6e2ebe8c63d96858a3226d7e8ff3adc4ba0418a5eb96d42bba772311e
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 1.0.2 / 2016-05-12
2
+
3
+ * Added example_site and explanation in readme.md on how to setup ydim-html
4
+ * Trying to fix problem Uninitialized constant #<Module:0x000000028db358>::DRb (NameError) using ::Drb
5
+ * Set YDIM_VERSION to YDIM::Html::VERSION instead of (non existing commit-id)
6
+ * Added example_site/install_needed_sw.sh
7
+
1
8
  === 1.0.1 / 2016-05-10
2
9
 
3
10
  * Updated to use Ruby 2.3.0
data/bin/ydim-htmld CHANGED
@@ -10,11 +10,12 @@ require 'logger'
10
10
  require 'ydim/server'
11
11
  require 'ydim/html/util/server'
12
12
  require 'ydim/html/config'
13
+ require 'ydim/html/version'
13
14
 
14
15
  module YDIM
15
16
  module Html
16
17
  headpath = File.expand_path('../.git/HEAD', File.dirname(__FILE__))
17
- YDIM_VERSION = File.read(headpath).strip
18
+ YDIM_VERSION = YDIM::Html::VERSION
18
19
 
19
20
  DRb.start_service(@config.proxy_url)
20
21
 
data/doc/index.rbx CHANGED
@@ -4,7 +4,7 @@
4
4
  require 'sbsm/request'
5
5
  load 'etc/config.rb'
6
6
 
7
- DRb.start_service('druby://localhost:0')
7
+ ::DRb.start_service('druby://localhost:0')
8
8
 
9
9
  begin
10
10
  config = YDIM::Html::Util::CONFIG
data/etc/config.rb ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ # etc/config -- ydim -- 12.01.2006 -- hwyss@ywesee.com
3
+
4
+ require 'rclconf'
5
+ require 'digest/md5'
6
+
7
+ module YDIM
8
+ module Html
9
+ module Util
10
+ ydim_default_dir = '/var/ydim/'
11
+ if(home = ENV['HOME'])
12
+ ydim_default_dir = File.join(home, '.ydim')
13
+ end
14
+ default_config_files = [
15
+ File.join(ydim_default_dir, 'ydim-htmld.yml'),
16
+ '/etc/ydim/ydim-htmld.yml',
17
+ ]
18
+ defaults = {
19
+ 'config' => default_config_files,
20
+ 'client_url' => 'druby://localhost:0',
21
+ 'currency' => 'CHF',
22
+ 'email' => 'zdavatz@ywesee.com',
23
+ 'html_url' => 'druby://localhost:12376',
24
+ 'md5_pass' => nil,
25
+ 'proxy_url' => 'druby://localhost:0',
26
+ 'server_url' => 'druby://localhost:12375',
27
+ 'root_key' => '/etc/ydim/id_dsa',
28
+ 'user' => nil,
29
+ 'ydim_dir' => nil,
30
+ }
31
+ config = RCLConf::RCLConf.new(ARGV, defaults)
32
+ config.load(config.config)
33
+
34
+ CONFIG = config
35
+ end
36
+ end
37
+ end
38
+
@@ -0,0 +1,48 @@
1
+ ---
2
+ shortcut:
3
+ '/medikamente':
4
+ 'language': 'de'
5
+ 'event': 'home_drugs'
6
+ '/medicaments':
7
+ 'language': 'fr'
8
+ 'event': 'home_drugs'
9
+ '/drugs':
10
+ 'language': 'en'
11
+ 'event': 'home_drugs'
12
+ '/interaktionen':
13
+ 'language': 'de'
14
+ 'event': 'home_interactions'
15
+ '/interactions':
16
+ 'language': 'en'
17
+ 'event': 'home_interactions'
18
+ '/firmen':
19
+ 'language': 'de'
20
+ 'event': 'home_companies'
21
+ '/entreprises':
22
+ 'language': 'fr'
23
+ 'event': 'home_companies'
24
+ '/companies':
25
+ 'language': 'en'
26
+ 'event': 'home_companies'
27
+ '/aerzte_schweiz':
28
+ 'language': 'de'
29
+ 'event': 'home_doctors'
30
+ '/medecins_suisses':
31
+ 'language': 'fr'
32
+ 'event': 'home_doctors'
33
+ '/doctors_switzerland':
34
+ 'language': 'en'
35
+ 'event': 'home_doctors'
36
+ '/services':
37
+ 'event': 'home_user'
38
+ '/wirkstoffe':
39
+ 'language': 'de'
40
+ 'event': 'home_substances'
41
+ '/principes_actifs':
42
+ 'language': 'fr'
43
+ 'event': 'home_substances'
44
+ '/substances':
45
+ 'language': 'en'
46
+ 'event': 'home_substances'
47
+ '/admin':
48
+ 'event': 'home_admin'
@@ -0,0 +1,26 @@
1
+ <IfDefine RUBY>
2
+ LoadModule ruby_module /usr/lib64/apache2/modules/mod_ruby.so
3
+ # LoadModule ruby_module /usr/lib64/apache2/modules/mod_ruby193-p547.so
4
+ # LoadModule ruby_module /usr/lib64/apache2/modules/mod_ruby193.so
5
+ # LoadModule ruby_module /usr/lib64/apache2/modules/mod_ruby219.so
6
+
7
+ # RubyRequire apache/ruby-debug
8
+ RubyRequire apache/ruby-run
9
+
10
+ # exec files under /ruby as ruby scripts.
11
+ <Location /ruby>
12
+ SetHandler ruby-object
13
+ RubyHandler Apache::RubyRun.instance
14
+ Options ExecCGI
15
+ </Location>
16
+
17
+ # exec *.rbx as ruby scripts.
18
+ <Files *.rbx>
19
+ SetHandler ruby-object
20
+ RubyHandler Apache::RubyRun.instance
21
+ # RubyHandler Apache::RubyDebug.instance
22
+ </Files>
23
+
24
+ </IfDefine>
25
+
26
+ # vim: ts=4 filetype=apache
@@ -0,0 +1,40 @@
1
+ <Directory /var/www/ydim.ywesee.com/doc>
2
+ Options ExecCGI
3
+ AllowOverride None
4
+ Order allow,deny
5
+ Allow from all
6
+ SSLRequireSSL
7
+ ErrorDocument 403 https://ydim.oddb-ci2.dyndns.org
8
+ </Directory>
9
+
10
+ <VirtualHost 172.25.1.75:443>
11
+ DocumentRoot /var/www/ydim.ywesee.com/doc
12
+ ServerName ydim.oddb-ci2.dyndns.org
13
+ DirectoryIndex index.rbx
14
+ RubyAddPath /var/www/ydim.ywesee.com/
15
+ RubyAddPath /usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib
16
+ RubyAddPath /usr/local/lib64/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib
17
+ #RubyRequire 'apache/ruby-debug'
18
+ RubyRequire 'sbsm/trans_handler'
19
+ SetHandler ruby-object
20
+ RubyTransHandler SBSM::TransHandler.instance
21
+ ErrorLog "|/usr/sbin/cronolog -l /var/www/ydim.ywesee.com/log/error_log /var/www/ydim.ywesee.com/log/%Y/%m/%d/error_log"
22
+ CustomLog "|/usr/sbin/cronolog -l /var/www/ydim.ywesee.com/log/access_log /var/www/ydim.ywesee.com/log/%Y/%m/%d/access_log" combined
23
+ SSLEngine on
24
+ SSLCertificateFile /etc/ssl/apache2/server.crt
25
+ SSLCertificateKeyFile /etc/ssl/apache2/server.key
26
+ </VirtualHost>
27
+
28
+ ## webalizer
29
+ <Directory "/var/www/ydim.ywesee.com/webalizer">
30
+ Options None
31
+ AllowOverride None
32
+ Order allow,deny
33
+ Allow from all
34
+ </Directory>
35
+
36
+ <VirtualHost *:80>
37
+ DocumentRoot /var/www/ydim.ywesee.com/webalizer
38
+ ServerName webalizer.ydim.ywesee.com
39
+ DirectoryIndex index.html
40
+ </VirtualHost>
@@ -0,0 +1,5 @@
1
+ ---
2
+ email: ngiger@ywesee.com
3
+ md5_pass: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
4
+ root_key: '/etc/ydim/id_dsa'
5
+
@@ -0,0 +1,31 @@
1
+ ---
2
+ log_level: DEBUG
3
+
4
+ mail_from: 'Niklaus Giger (ydim) <user@example.com>'
5
+ mail_recipients:
6
+ - 'user@example.com'
7
+ server_url: druby://localhost:12375
8
+ smtp_from: 'user@example.com'
9
+ email: 'user@example.com'
10
+ root_key: '/etc/ydim/id_dsa'
11
+
12
+ root_email: 'user@example.com'
13
+ md5_pass: Digest::MD5.hexdigest('aaaaaaaaaaaaaaaaaaa')
14
+
15
+ smtp_server: smtp.gmail.com
16
+ smtp_domain: example.com
17
+ smtp_user: example@example.com
18
+ smtp_pass: topsecret
19
+ smtp_port: 587
20
+
21
+ mail_body: |
22
+ %s %s
23
+
24
+ Anbei die Rechnung für %s.
25
+
26
+ Besten Dank für Ihren Auftrag!
27
+
28
+ Mit freundlichen Grüssen
29
+ Some User
30
+ phone number:
31
+
@@ -0,0 +1,103 @@
1
+ #!/bin/bash -v
2
+ set -e
3
+ export SRC_ROOT=/usr/local/src
4
+ export RUBY_19_VERSION=1.9.3-p547
5
+ export SUFFIX_19=`echo ${RUBY_19_VERSION} | awk '{gsub(/\./,"")}; 1'`
6
+ export RUBY_2_VERSION=2.3.1
7
+ export RUBY_2_SUFFIX=`echo ${RUBY_2_VERSION} | awk '{gsub(/\./,"")}; 1'`
8
+ export PATH=/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.4
9
+ export RUBY=/usr/local/bin/ruby${SUFFIX_19}
10
+
11
+ # Install Ruby 1.9.3 for Apache mod_ruby
12
+ function show_vars {
13
+ if [ -f $RUBY ]; then
14
+ ls -l $RUBY
15
+ $RUBY --version
16
+ fi
17
+ for item in RUBY SRC_ROOT RUBY_19_VERSION SUFFIX_19 PATH RUBY_2_VERSION RUBY_2_SUFFIX
18
+ do
19
+ echo "${item}=${!item}"
20
+ done
21
+ }
22
+
23
+ function install_ruby_19 {
24
+ if [ ! -d ${SRC_ROOT}/ruby-${RUBY_19_VERSION} ]
25
+ then
26
+ cd ${SRC_ROOT}
27
+ pwd
28
+ # rm -rf ruby-${RUBY_19_VERSION}
29
+ if [ ! -f ruby-${RUBY_19_VERSION}.tar.gz ]
30
+ then
31
+ wget https://ftp.ruby-lang.org/pub/ruby/ruby-${RUBY_19_VERSION}.tar.gz
32
+ fi
33
+ tar -zxf ruby-${RUBY_19_VERSION}.tar.gz
34
+ fi
35
+ cd $SRC_ROOT/ruby-${RUBY_19_VERSION}
36
+ if [ -f Makefile ]; then
37
+ make distclean
38
+ fi
39
+ # Adding --enable-shared leads to
40
+ # apache2: Syntax error on line 155 of /etc/apache2/httpd.conf: Syntax error on line 3 of \
41
+ # /etc/apache2/modules.d/21_mod_ruby.conf: Cannot load /usr/lib64/apache2/modules/mod_ruby193-p547.so into server:
42
+ # /usr/lib64/apache2/modules/mod_ruby193-p547.so: undefined symbol: ruby_dln_librefs
43
+ ./configure --prefix=/usr/local --disable-install-doc --enable-shared --program-suffix=${SUFFIX_19} --libdir=/usr/local/lib 2>&1 | tee configure.log
44
+ make -j9 2>&1 | tee make.log
45
+ sudo make install 2>&1 | tee install.log
46
+ }
47
+
48
+ function install_ruby_2 {
49
+ if [ ! -d ${SRC_ROOT}/ruby-${RUBY_2_VERSION} ]
50
+ then
51
+ cd ${SRC_ROOT}
52
+ pwd
53
+ if [ ! -f ruby-${RUBY_2_VERSION}.tar.gz ]
54
+ then
55
+ wget https://ftp.ruby-lang.org/pub/ruby/ruby-${RUBY_2_VERSION}.tar.gz
56
+ fi
57
+ ls -lrt
58
+ tar -zxf ruby-${RUBY_2_VERSION}.tar.gz
59
+ fi
60
+
61
+ cd $SRC_ROOT/ruby-${RUBY_2_VERSION}
62
+ if [ -f Makefile ]; then
63
+ make distclean
64
+ fi
65
+ ./configure --prefix=/usr/local --disable-install-doc --enable-shared --program-suffix=${RUBY_2_SUFFIX} --libdir=/usr/local/lib 2>&1 | tee configure.log
66
+ make -j9 2>&1 | tee make.log
67
+ sudo make install 2>&1 | tee install.log
68
+ }
69
+
70
+ function install_mod_ruby {
71
+ # from http://dev.ywesee.com/Niklaus/20160413-ydim-html
72
+ # /usr/bin/ruby ./configure.rb --with-apr-includes=/usr/include/apr-1 --with-apxs=/usr/sbin/apxs I
73
+ if [ ! -d ${SRC_ROOT}/mod_ruby ]
74
+ then
75
+ cd ${SRC_ROOT}
76
+ git clone https://github.com/shugo/mod_ruby
77
+ fi
78
+ cd $SRC_ROOT/mod_ruby
79
+ git pull
80
+ if [ -f Makefile ]; then
81
+ make distclean
82
+ fi
83
+ # --with-apxs=/usr/sbin/apxs Build shared Apache module.
84
+ # --with-apache Build static Apache module
85
+ #
86
+ $RUBY ./configure.rb \
87
+ --with-apxs=/usr/sbin/apxs \
88
+ --with-apr-includes=/usr/include/apr-1 \
89
+ --prefix=/usr/local \
90
+ --libdir=/usr/local/lib64 2>&1 | tee configure.log
91
+ make 2>&1 | tee make.log
92
+ sudo make install 2>&1 | tee install.log
93
+ sudo cp -v mod_ruby.so /usr/lib64/apache2/modules/mod_ruby${SUFFIX_19}.so
94
+ }
95
+ function install_ydim_html_gems {
96
+ sudo /usr/local/bin/gem${RUBY_2_SUFFIX} install ydim ydim-html
97
+ }
98
+ show_vars
99
+ install_ruby_19
100
+ install_mod_ruby
101
+ install_ruby_2
102
+ install_ydim_html_gems
103
+ show_vars
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ exec multilog t ./main
3
+
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ exec 2>&1
3
+ ulimit -v 10240000
4
+ cd /home/niklaus/git/ydim
5
+ exec sudo -u apache /usr/local/bin/ydimd
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ exec multilog t ./main
3
+
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ exec 2>&1
3
+ ulimit -v 10240000
4
+ cd /var/www/ydim.ywesee.com/
5
+ exec sudo -u apache /usr/local/bin/ruby231 bin/ydim-htmld
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ exec multilog t ./main
3
+
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ exec 2>&1
3
+ ulimit -v 1536000
4
+ cd /usr/local/src/yus18
5
+ exec sudo -u apache RUBYOPT=-rauto_gem /usr/bin/ruby18 bin/yusd
@@ -2,6 +2,6 @@
2
2
  # encoding: utf-8
3
3
  module YDIM
4
4
  module Html
5
- VERSION = '1.0.1'
5
+ VERSION = '1.0.2'
6
6
  end
7
7
  end
data/readme.md CHANGED
@@ -16,6 +16,24 @@ This is an application. Therefore it is not distributed as a gem, instead it has
16
16
 
17
17
  Currently we have neither working unit tnor spec tests.
18
18
 
19
+ ## Howto deploy a working site
20
+
21
+ 1. Install apache2
22
+ 2. Compile and install ruby 1.9 and mod_ruby
23
+ 3. Compile and install ruby >= 2.1.0 and ydim-html gem
24
+ 4. Install yus (gem and initialize/load postgres database)
25
+ 5. Install ydim (gem and initialize/load postgres database)
26
+ 6. We use daemontools (run scripts under example_site/etc/services) to start, supervise and log yus, ydim and ydim-html
27
+ 7. Create an id_rsa for ydim using sudo ssh-keygen -t dsa -f /etc/ydim/id_dsa
28
+ We assume here that you entered 'xxx'.
29
+ The id_rsa files must belong to the apache user. Therefore sudo chown -R apache /etc/ydim
30
+ 8. Calling `ruby -e "require 'digest/md5'; p Digest::MD5::hexdigest(ARGV[0])" xxx` will return "f561aaf6ef0bf14d4208bb46a4ccb3ad"
31
+ 9. Change the md5_pass to this value in /etc/ydim/ydim-htmld.yml
32
+ 10. Adapt all values in /etc/ydim/*.yml to your needs
33
+ 11. Configure apache for use with mod_ruby and ydim-html. See example_site/etc/apache
34
+
35
+ A bash script for steps 3 and 3 is found under example_site/install_needed_sw.sh.
36
+
19
37
  ## DEVELOPERS:
20
38
 
21
39
  * Masaomi Hatakeyama
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ydim-html
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz, Niklaus Giger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-10 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sbsm
@@ -213,6 +213,19 @@ files:
213
213
  - doc/resources/javascript/iframe_history.html
214
214
  - doc/resources/javascript/ydim.js
215
215
  - doc/resources/ydim/ydim.css
216
+ - etc/config.rb
217
+ - etc/trans_handler.yml
218
+ - example_site/etc/apache/modules.d/21_mod_ruby.conf
219
+ - example_site/etc/apache/vhosts.d/ydim.ywesee.com.conf
220
+ - example_site/etc/ydim/ydim-htmld.yml
221
+ - example_site/etc/ydim/ydimd.yml
222
+ - example_site/install_needed_sw.sh
223
+ - example_site/service/ydim-html/log/run
224
+ - example_site/service/ydim-html/run
225
+ - example_site/service/ydim/log/run
226
+ - example_site/service/ydim/run
227
+ - example_site/service/yus/log/run
228
+ - example_site/service/yus/run
216
229
  - lib/ydim/html.rb
217
230
  - lib/ydim/html/config.rb
218
231
  - lib/ydim/html/state/ajax_values.rb