Compare commits
8 Commits
e56592152f
...
i335_docke
| Author | SHA1 | Date | |
|---|---|---|---|
|
e1be81a4ad
|
|||
|
fd577942e6
|
|||
|
3cc4a6b5d3
|
|||
|
47b2c588b8
|
|||
|
5bdda3c1ef
|
|||
|
7cea36879c
|
|||
| abd1937fb6 | |||
|
4750a08456
|
24
Dockerfile
Normal file
24
Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
FROM perl:stable
|
||||||
|
|
||||||
|
RUN cpanm Config::Std \
|
||||||
|
&& cpanm Template \
|
||||||
|
&& cpanm Template::Plugin::DBI \
|
||||||
|
&& cpanm Template::Plugin::HTML::Strip \
|
||||||
|
&& cpanm DBD::SQLite \
|
||||||
|
&& cpanm Tie::DBI \
|
||||||
|
&& cpanm Date::Calc \
|
||||||
|
&& cpanm Text::CSV_XS \
|
||||||
|
&& cpanm HTML::Entities \
|
||||||
|
&& mkdir -p /usr/src/app
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
ADD site-generator /usr/src/app/site-generator
|
||||||
|
ADD site.cfg /usr/src/app/site.cfg
|
||||||
|
ADD templates /usr/src/app/templates
|
||||||
|
ADD LICENSE /usr/src/app/LICENSE
|
||||||
|
|
||||||
|
# Tell Perl where to find the local modules
|
||||||
|
ENV PERL5LIB=/usr/local/lib/perl5/site_perl
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/src/app/site-generator"]
|
||||||
@@ -11,7 +11,9 @@ password are required), run:
|
|||||||
On success, an "hpr_generator" directory will be created in the folder from
|
On success, an "hpr_generator" directory will be created in the folder from
|
||||||
which the clone command was executed containing a local copy of the git repository.
|
which the clone command was executed containing a local copy of the git repository.
|
||||||
|
|
||||||
# Install required Perl modules
|
# Building on local system
|
||||||
|
|
||||||
|
## Install required Perl modules
|
||||||
|
|
||||||
Installing the Perl modules is the most finicky part of the installation process.
|
Installing the Perl modules is the most finicky part of the installation process.
|
||||||
The needed Perl modules can be found using the operating system's package
|
The needed Perl modules can be found using the operating system's package
|
||||||
@@ -34,7 +36,7 @@ apt install libconfig-std-perl \
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using CPAN to install the modules
|
### Using CPAN to install the modules
|
||||||
|
|
||||||
A cross platform method to install the needed modules is the Perl CPAN application.
|
A cross platform method to install the needed modules is the Perl CPAN application.
|
||||||
Make sure that the [gcc](https://www.gnu.org/software/gcc/),
|
Make sure that the [gcc](https://www.gnu.org/software/gcc/),
|
||||||
@@ -55,7 +57,7 @@ cpan Tie::DBI
|
|||||||
cpan Text:CSV_XS
|
cpan Text:CSV_XS
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing for Perl module dependencies
|
### Testing for Perl module dependencies
|
||||||
|
|
||||||
A bash script is included in the utils directory that will list the Perl modules used by the site-generator and report whether the modules are installed on the current OS.
|
A bash script is included in the utils directory that will list the Perl modules used by the site-generator and report whether the modules are installed on the current OS.
|
||||||
|
|
||||||
@@ -65,6 +67,39 @@ It can be run from any directory. To run from the utils directory:
|
|||||||
./check-dependencies.sh
|
./check-dependencies.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Building with Docker
|
||||||
|
|
||||||
|
The docker file will copy the local version of the site-generator program, the templates directory, the LICENSE file,
|
||||||
|
and the site.cfg file into the Docker image. For the docker image to run correctly it needs access to your local
|
||||||
|
hpr.db file and the output directory (defaults to "public_html"). The default site.cfg assumes the hpr.db is located
|
||||||
|
in the directory from which the site-generator is run. There are two ways to make the db available to the container:
|
||||||
|
|
||||||
|
* Put the hpr.db file in the public_html folder and modify the driver option under the [DBI] section of the site.cfg to:<br>
|
||||||
|
```driver: dbi:SQLite:public_html/hpr.db```
|
||||||
|
* mount the hpr.db file into the container when starting up the container with the -v option: <br>
|
||||||
|
```-v <path to db directory>/hpr.db:/usr/src/app/hpr.db```
|
||||||
|
|
||||||
|
Build the image by running the following command from the hpr_generator directory:
|
||||||
|
```docker build -t hpr/site-generator .```
|
||||||
|
|
||||||
|
The first build will take a while. It must pull down the base container, perl-latest, and then pull down and build the
|
||||||
|
various Perl modules from CPAN. After the initial build, if you have modified your site.cfg file, templates dir, or the
|
||||||
|
site-generator program itself, builds will be very quick.
|
||||||
|
|
||||||
|
If the build fails, it is often from a CPAN module failing to download and install. Try running the Docker build command again.
|
||||||
|
|
||||||
|
## Running the container
|
||||||
|
|
||||||
|
When runing the Docker image, your local output directory (typically public_html) must be mounted into the container using
|
||||||
|
the -v option. If you are using the default path for the hpr.db, then the local hpr.db file must also be mounted into the image.
|
||||||
|
The following is an example of running the site-generator with default locations from the hpr_generator directory:
|
||||||
|
```
|
||||||
|
docker run \
|
||||||
|
-v "$(pwd)/public_html":/usr/src/app/public_html \
|
||||||
|
-v "$(pwd)/hpr.db":/usr/src/app/hpr.db \
|
||||||
|
hpr/site-generator --help
|
||||||
|
```
|
||||||
|
|
||||||
# Create the HPR database
|
# Create the HPR database
|
||||||
|
|
||||||
The hpr_generator relies on information from a database to generate many of the
|
The hpr_generator relies on information from a database to generate many of the
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
Static web page generator for the Hacker Public Radio website.
|
Static web page generator for the Hacker Public Radio website.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
### On local system
|
||||||
|
|
||||||
* Clone or download this repository
|
* Clone or download this repository
|
||||||
* With SQLite
|
* With SQLite
|
||||||
* Create the sqlite3 database from the hpr.sql MySQL dump file available on
|
* Create the sqlite3 database from the hpr.sql MySQL dump file available on
|
||||||
@@ -31,6 +34,10 @@ Static web page generator for the Hacker Public Radio website.
|
|||||||
* Text::CSV_XS
|
* Text::CSV_XS
|
||||||
* HTML::Entities
|
* HTML::Entities
|
||||||
|
|
||||||
|
### Using Docker
|
||||||
|
|
||||||
|
* run: `docker build -t hpr/site-generator .`
|
||||||
|
|
||||||
* See the [Getting Started](GETTING_STARTED.md) tutorial for more details on
|
* See the [Getting Started](GETTING_STARTED.md) tutorial for more details on
|
||||||
installing the HPR generator.
|
installing the HPR generator.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
# {{{ POD documentation
|
# {{{ POD documentation
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
||||||
<!--% IF date.format(date.now, '%m') == 12 || date.format(date.now, '%j') == 1 %-->
|
<!--% IF date.format(date.now, '%m') == 11 || date.format(date.now, '%j') == 1 %-->
|
||||||
<!--% PROCESS 'content-new_year_show_announcement.tpl.html' %-->
|
<!--% PROCESS 'content-new_year_show_announcement.tpl.html' %-->
|
||||||
<!--% END %-->
|
<!--% END %-->
|
||||||
|
|||||||
@@ -14,12 +14,18 @@ So please stop in. Say "Hi" and maybe join in the conversation with other HPR li
|
|||||||
<h1>Listen to the live stream</h1>
|
<h1>Listen to the live stream</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<img src="images/livestream.png" /><br />
|
<!--% IF ((date.format(date.now, '%m') == 12 && date.format(date.now, '%d') > 28) || date.format(date.now, '%j') == 1) %-->
|
||||||
<audio controls autoplay>
|
<img src="images/livestream.png" /><br />
|
||||||
<source src="https://files.shownotes.ooguy.com/stream" type="audio/mpeg" >
|
<audio controls autoplay>
|
||||||
</audio> <br />
|
<source src="https://files.shownotes.ooguy.com/stream" type="audio/mpeg" >
|
||||||
<a href="https://files.shownotes.ooguy.com/stream">https://files.shownotes.ooguy.com/stream</a><br />
|
</audio> <br />
|
||||||
<a href="https://hackerpublicradio.org/live">https://hackerpublicradio.org/live</a><br />
|
<a href="https://files.shownotes.ooguy.com/stream">https://files.shownotes.ooguy.com/stream</a><br />
|
||||||
|
<a href="https://hackerpublicradio.org/live">https://hackerpublicradio.org/live</a><br />
|
||||||
|
<!--% ELSE %-->
|
||||||
|
<audio controls preload="none">
|
||||||
|
<source src="<!--% absolute_path(baseurl) %-->promos/hpr-nye-promo.ogg" type="audio/ogg">
|
||||||
|
</audio>
|
||||||
|
<!--% END %-->
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h1>Join the conversation on Mumble</h1>
|
<h1>Join the conversation on Mumble</h1>
|
||||||
|
|||||||
@@ -12,18 +12,19 @@
|
|||||||
We will leave the recording going until at least <!--% get_new_year_show_end() %-->, and keep recording until the conversation stops.</p>
|
We will leave the recording going until at least <!--% get_new_year_show_end() %-->, and keep recording until the conversation stops.</p>
|
||||||
<p>
|
<p>
|
||||||
So please stop in. Say "Hi" and maybe join in the conversation with other HPR listeners and contributors. It's always a good time!!<br>
|
So please stop in. Say "Hi" and maybe join in the conversation with other HPR listeners and contributors. It's always a good time!!<br>
|
||||||
|
<!--% IF date.format(date.now, '%m') == 11 || date.format(date.now, '%d') < 29 %-->
|
||||||
<h2>Listen to the live stream</h2>
|
<audio controls preload="none">
|
||||||
|
<source src="<!--% absolute_path(baseurl) %-->promos/hpr-nye-promo.ogg" type="audio/ogg">
|
||||||
<p>
|
</audio>
|
||||||
|
<!--% ELSE %-->
|
||||||
<img src="images/livestream.png" /><br />
|
<img src="images/livestream.png" /><br />
|
||||||
<audio controls autoplay>
|
<audio controls autoplay>
|
||||||
<source src="https://files.shownotes.ooguy.com/stream" type="audio/mpeg" >
|
<source src="https://files.shownotes.ooguy.com/stream" type="audio/mpeg" >
|
||||||
</audio> <br />
|
</audio> <br />
|
||||||
<a href="https://files.shownotes.ooguy.com/stream">https://files.shownotes.ooguy.com/stream</a><br />
|
<a href="https://files.shownotes.ooguy.com/stream">https://files.shownotes.ooguy.com/stream</a><br />
|
||||||
<a href="https://hackerpublicradio.org/live">https://hackerpublicradio.org/live</a><br />
|
<a href="https://hackerpublicradio.org/live">https://hackerpublicradio.org/live</a><br />
|
||||||
|
<!--% END %-->
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p><a href="<!--% absolute_path(baseurl) %-->new_year.html">More information…</a></p>
|
<p><a href="<!--% absolute_path(baseurl) %-->new_year.html">More information…</a></p>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user