whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: rough in a Dockerfile for whimsy development
Date Tue, 19 Nov 2019 03:15:12 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 014c726  rough in a Dockerfile for whimsy development
014c726 is described below

commit 014c72694289d7e07012421979e7730751b54d49
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Mon Nov 18 22:14:49 2019 -0500

    rough in a Dockerfile for whimsy development
---
 DOCKER.md                  | 62 ++++++++++++++++++++++++++++++++++++++++++++++
 Rakefile                   | 44 ++++++++++++++++++++++++++++++++
 docker/Dockerfile          | 50 +++++++++++++++++++++++++++++++++++++
 docker/docker-compose.yaml | 14 +++++++++++
 4 files changed, 170 insertions(+)

diff --git a/DOCKER.md b/DOCKER.md
new file mode 100644
index 0000000..6063723
--- /dev/null
+++ b/DOCKER.md
@@ -0,0 +1,62 @@
+Docker execution instructions
+=============================
+
+This is experimental at this point.
+
+These steps will enable you to run a full Whimsy system inside a
+container on your development machine.  You can edit files inside
+your favorite IDE on your host machine.
+
+Prerequisites
+-------------
+
+You will need Docker, git, and subversion.  And approximately 30Gb of
+disk space (over 20Gb of which will be to have a copy of iclas, cclas,
+and grants for the secretary workbench; perhaps in the future these
+could be made optional).
+
+Direct link to [docker for
+macOS](https://download.docker.com/mac/stable/Docker.dmg) (this avoids the
+need to login to Docker Hub).
+
+A development class machine and a high speed internet connection would
+be in order.  Some things appear to perform well, other things perform
+noticeably slower than a native (non-container) installation of whimsy.
+
+Installation instructions
+-------------------------
+
+* Create an empty directory
+* `cd` into that directory
+* `git clone git@github.com:apache/whimsy.git` (or alternately
+  `git clone https://github.com/apache/whimsy.git`)
+* `cd whimsy`
+* `rake update`
+* `rake up`
+* visit `http://localhost:1999/` in your favorite browser
+
+Note: the `rake udpate` step will take a long time as it will need to
+download and install all of the Ubuntu packages, Ruby gems, build and
+install Passenger, checkout numerous svn repositories and two git
+repositories.  The good news is that this can be entirely unattended as
+there will be no prompts required during this process.
+
+This should be enough to get the board agenda tool to launch.  It is not
+known yet what functions work and what functions do not.
+
+Known not to work (ToDos)
+-------------------------
+
+* Board agenda web socket (used to communicate updates from the server to
+  browsers)
+* Automatic restarting of passenger based tools when source code changes are
+  made.
+
+Uninstallation procedures
+-------------------------
+
+* Remove the entire directory created as step 1 of the installation
+  instructions.
+* `docker image prune -f`
+* `docker container prune -f`
+
diff --git a/Rakefile b/Rakefile
index e2b492b..0ac387d 100644
--- a/Rakefile
+++ b/Rakefile
@@ -90,6 +90,7 @@ namespace :svn do
     svn = ASF::Config.get(:svn)
     svn = Array(svn).find {|path| String === path and path.end_with? '/*'}
     if svn.instance_of? String and svn.end_with? '/*'
+      mkdir_p File.dirname(svn) unless Dir.exists? File.dirname(svn)
       Dir.chdir File.dirname(svn) do
         require 'uri'
         base = URI.parse('https://svn.apache.org/repos/')
@@ -201,6 +202,7 @@ namespace :git do
     # clone/pull git repositories
     git = ASF::Config.get(:git)
     if git.instance_of? String and git.end_with? '/*'
+      mkdir_p File.dirname(git) unless Dir.exists? File.dirname(git)
       Dir.chdir File.dirname(git) do
         require 'uri'
         base = URI.parse('git://git.apache.org/')
@@ -252,3 +254,45 @@ task :default do
     end
   end
 end
+
+# Docker support
+namespace :docker do
+  task :build => 'docker/work/whimsy.conf' do
+    Dir.chdir File.join(__dir__, 'docker') do
+      sh 'docker-compose build web'
+    end
+  end
+
+  task :update => :build do
+    Dir.chdir File.join(__dir__, 'docker') do
+      sh 'docker-compose run  --entrypoint ' +
+        %('bash -c "git pull; rake update svn:update git:pull"') +
+        ' web'
+    end
+  end
+
+  task :up do
+    Dir.chdir File.join(__dir__, 'docker') do
+      sh 'docker-compose up'
+    end
+  end
+
+  task :exec do
+    Dir.chdir File.join(__dir__, 'docker') do
+      sh 'docker-compose exec web /bin/bash'
+    end
+  end
+
+  task :entrypoint do
+    sh 'ruby -I lib -r whimsy/asf -e "ASF::LDAP.configure"'
+    sh 'apache2ctl -DFOREGROUND'
+  end
+end
+
+file 'docker/work' do
+  mkdir_p 'docker/work'
+end
+
+file 'docker/work/whimsy.conf' => ['docker/work', 'config/whimsy.conf'] do
+  cp 'config/whimsy.conf', 'docker/work/whimsy.conf'
+end
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..75b1ef0
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,50 @@
+FROM ubuntu:18.04
+ENV GEM_HOME="/srv/gems" \
+    LANG=C.UTF-8 \
+    LC_ALL=C.UTF-8
+RUN apt-get update && \
+    apt-get install -y curl && \
+    curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
+    apt-get update && \
+    DEBIAN_FRONTEND='noninteractive' apt-get install -y \
+      apache2 \
+      subversion \
+      git \
+      build-essential \
+      libgmp3-dev \
+      libldap2-dev \
+      libsasl2-dev \
+      python3-pip \
+      ruby-dev \
+      zlib1g-dev \
+      imagemagick \
+      img2pdf \
+      nodejs \
+      procmail \
+      poppler-utils \
+      texlive-extra-utils \
+      gnupg2 \
+      libcurl4-openssl-dev \
+      libssl-dev \
+      apache2-dev \
+      libapr1-dev \
+      libaprutil1-dev && \
+    gem install bundler passenger --install_dir=/var/lib/gems/2.5.0 && \
+    passenger-install-apache2-module --auto && \
+    passenger-install-apache2-module --snippet > /etc/apache2/conf-enabled/passenger.conf
&& \
+    pip3 install img2pdf && \
+    a2enmod cgi && \
+    a2enmod headers && \
+    a2enmod rewrite && \
+    a2enmod authnz_ldap && \
+    a2enmod speling && \
+    a2enmod remoteip && \
+    a2enmod expires && \
+    a2enmod proxy_wstunnel &&\
+    echo "ServerName whimsy.local" > /etc/apache2/conf-enabled/servername.conf
+COPY work/whimsy.conf /etc/apache2/sites-enabled/000-default.conf
+RUN echo 'SetEnv GEM_HOME /srv/gems' > /etc/apache2/conf-enabled/gemhome.conf
+WORKDIR /srv/whimsy
+EXPOSE 80
+
+CMD ["/usr/local/bin/rake", "docker:entrypoint"]
diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml
new file mode 100644
index 0000000..d568bc6
--- /dev/null
+++ b/docker/docker-compose.yaml
@@ -0,0 +1,14 @@
+version: '3'
+services:
+  web:
+    image: whimsy-web
+    build: .
+    ports: 
+      - "1999:80"
+    networks:
+      - default
+    volumes:
+      - ../..:/srv
+      - $HOME/.subversion:/root/.subversion
+      - $HOME/.gitconfig:/root/.gitconfig
+      - $HOME/.ssh:/root/.ssh


Mime
View raw message