Difference between revisions of "Installing Pier on Ubuntu"

From Organic Design wiki
(First run: code template doesn't like this code.)
m
 
(26 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The instructions on [http://www.piercms.com/doc/deploy the Pier site] are a bit terse, so I'm recording my actions to get Pier up and running.
+
{{legacy}}
 
+
== Set Up a Pier Image ==
== Where to copy the files ==
+
Pier is a content management system based on the Seaside web application framework. While some static aspects of the site can be farmed across to apache2, the section below refers to situations where the Pier image does file hosting as well as dynamic content:
* download Pier-2.0-OneClick.zip from http://www.piercms.com/download
+
* Download Pier-2.0-OneClick.zip from http://www.piercms.com/download
* mount or unzip archive image. Note that file contents, Pier.app has owner:group of ''you'':''you'' [where ''you'' is your username] by default
+
* Unzip into any directory, but probably /var/www/domains/Pier.app for an OD install
* open shell and
+
* As root, change ownership to www-data:
{{code|sudo su
+
{{code|
cd /srv
+
chown -R www-data:www-data Pier.app
 
+
}}
mkdir site
+
* Edit /etc/rc.local and add the following BASH script just before exit 0 (note you will need to change paths if you unzipped into a directory other than /var/www/domains)
 
+
<pre>
chown ''you'':www-data site
+
#!/bin/bash
 +
# settings
 +
USER="www-data"
 +
VM="/var/www/domains/Pier.app/Contents/Linux/squeakvm"
 +
VM_PARAMS="-mmap 256m -vm-sound-null -vm-display-null"
 +
IMAGE="/var/www/domains/Pier.app/Contents/Resources/Pier.image"
 +
# start the vm
 +
exec \
 +
setuidgid "$USER" \
 +
"$VM" $VM_PARAMS "$IMAGE"
 +
</pre>
 +
* Restart
 +
* Navigate to <nowiki>http://organicdesign.co.nz:8080</nowiki>
 +
* Alternatively or when testing, to start Pier manually, as root:
 +
{{code|
 +
cd /var/www/domains/Pier.app
 +
./Pier.sh
 
}}
 
}}
* I used www-data as the group because it already existed and appears to be intended for www sites, also I was already a member by default after installing Ubuntu. It is probably not a good idea to let any webserver be ''root''
 
  
Copy to the /srv/site folder the following files [from Pier.app/Contents/Resources]:
+
==Serve Pier Content Alongside Apache==
:pier.image,
 
:pier.changes,
 
:files/ folder,
 
* I didn't find the next file in /Resources:
 
:SqueakV39.sources
 
:but I did find ''PharoV10.sources'' there, so I assume the instructions are out of date and copied that instead.
 
  
 +
This section is based on an OD Apache2 server configuration is being used, but the principle applies to any Apache2 server.
  
* The permissions on Pier.app were unpacked with default permissions and probably should be changed to the www server group, www-data. This will (hopefully) make the contents of site and all subcontents have sane permissions and ownership:
+
In the simple image configuration, requests for the pier site need to be forwarded to the correct port and served with the image's own server, not Apache2. Natively, that port is 8080:
{{code|
 
  
chown ''you'':www-data -R site
+
* Add pier.organicdesign.co.nz to /etc/hosts
 +
* As root, enable proxy:  
 +
{{code |
 +
a2enmod proxy proxy_http
 
}}
 
}}
 +
* Then edit /etc/apache2/mods-enabled/proxy.conf, by adding Allow from organicdesign.co.nz as below:
 +
<pre>
 +
<IfModule mod_proxy.c>
  
== First run ==
+
# If you want to use apache2 as a forward proxy, uncomment the
The instructions say:
+
# 'ProxyRequests On' line and the <Proxy *> block below.
: you can run the image headless by using the following bash script:
+
# WARNING: Be careful to restrict access inside the <Proxy *> block.
*I'm not exactly sure what is meant by 'headless(-ly) but I think it has something to do with Apache, in the next section. I wasn't expecting to get into installing apache. I thought the image would be a complete webserver!
+
# Open proxy servers are dangerous both to your network and to the
 +
# Internet at large.
 +
#
 +
# If you only want to use apache2 as a reverse proxy/gateway in
 +
# front of some web application server, you DON'T need
 +
# 'ProxyRequests On'.
  
{{code | #!/bin/bash
+
<Proxy *>
 +
        AddDefaultCharset off
 +
        Order deny,allow
 +
#       Deny from all
 +
#        Allow from .example.com
 +
        Allow from organicdesign.co.nz
 +
</Proxy>
  
#settings
+
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
USER="www-data"
+
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
VM="/usr/bin/squeakvm"
+
# Set to one of: Off | On | Full | Block
VM_PARAMS="-mmap 200m -vm-sound-null -vm-display-null"
+
ProxyVia On
IMAGE="pier.image"
+
 
 +
</IfModule>
 +
</pre>
 +
* Finally add, at the top of the mod_rewrite in /etc/apache2/sites-available/default, directly under RewriteEngine On:
 +
<pre>
 +
ProxyPreserveHost On
 +
RewriteCond %{HTTP_HOST} ^pier\.organicdesign.co.nz
 +
RewriteRule (.*) http://organicdesign.co.nz:8080/$1 [P,L]
 +
</pre>
  
#start the vm
+
== References ==
"$VM" $VM_PARAMS "$IMAGE" &
+
*[http://book.seaside.st/book/table-of-contents?_s=mOCL9TAcnms7KUZC&_k=y5VsfJ-0&_n&11 Dynamic Web Development with Seaside]
}}
+
*[http://library.linode.com/frameworks/seaside/ Deploy Smalltalk Applications with Seaside]

Latest revision as of 13:53, 1 February 2020

Legacy.svg Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, this is only useful for a historic record of work done. You may find a link to the currently used concept or function in this article, if not you can contact the author to find out what has taken the place of this legacy item.

Set Up a Pier Image

Pier is a content management system based on the Seaside web application framework. While some static aspects of the site can be farmed across to apache2, the section below refers to situations where the Pier image does file hosting as well as dynamic content:

  • Download Pier-2.0-OneClick.zip from http://www.piercms.com/download
  • Unzip into any directory, but probably /var/www/domains/Pier.app for an OD install
  • As root, change ownership to www-data:
chown -R www-data:www-data Pier.app
  • Edit /etc/rc.local and add the following BASH script just before exit 0 (note you will need to change paths if you unzipped into a directory other than /var/www/domains)
#!/bin/bash
# settings
USER="www-data"
VM="/var/www/domains/Pier.app/Contents/Linux/squeakvm"
VM_PARAMS="-mmap 256m -vm-sound-null -vm-display-null"
IMAGE="/var/www/domains/Pier.app/Contents/Resources/Pier.image"
# start the vm
exec \
setuidgid "$USER" \
"$VM" $VM_PARAMS "$IMAGE"
  • Restart
  • Navigate to http://organicdesign.co.nz:8080
  • Alternatively or when testing, to start Pier manually, as root:
cd /var/www/domains/Pier.app

./Pier.sh

Serve Pier Content Alongside Apache

This section is based on an OD Apache2 server configuration is being used, but the principle applies to any Apache2 server.

In the simple image configuration, requests for the pier site need to be forwarded to the correct port and served with the image's own server, not Apache2. Natively, that port is 8080:

  • Add pier.organicdesign.co.nz to /etc/hosts
  • As root, enable proxy:
a2enmod proxy proxy_http
  • Then edit /etc/apache2/mods-enabled/proxy.conf, by adding Allow from organicdesign.co.nz as below:
<IfModule mod_proxy.c>

# If you want to use apache2 as a forward proxy, uncomment the
# 'ProxyRequests On' line and the <Proxy *> block below.
# WARNING: Be careful to restrict access inside the <Proxy *> block.
# Open proxy servers are dangerous both to your network and to the
# Internet at large.
#
# If you only want to use apache2 as a reverse proxy/gateway in
# front of some web application server, you DON'T need
# 'ProxyRequests On'.

<Proxy *>
        AddDefaultCharset off
        Order deny,allow
#        Deny from all
#        Allow from .example.com
        Allow from organicdesign.co.nz
</Proxy>

# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
ProxyVia On

</IfModule>
  • Finally add, at the top of the mod_rewrite in /etc/apache2/sites-available/default, directly under RewriteEngine On:
ProxyPreserveHost On
RewriteCond %{HTTP_HOST} ^pier\.organicdesign.co.nz
RewriteRule (.*) http://organicdesign.co.nz:8080/$1 [P,L]

References