Skip to content

Commit

Permalink
Version 0.9.0 - first Dockerised version, start of push towards 1.0 r…
Browse files Browse the repository at this point in the history
…elease.
  • Loading branch information
denny committed Feb 23, 2016
1 parent 320cf46 commit d64a264
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*~ # Text editor backup files
.dockerignore # This file
.git # Git data
.gitignore # Git ignore file
bin/dev-tools # Utility scripts for CMS development
Dockerfile # Docker build instructions
docs/ # More documentation
README # Documentation
t/ # Tests

98 changes: 98 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
FROM debian:jessie
MAINTAINER Denny de la Haye <[email protected]>


# Set some general config stuff

ENV APP_NAME=ShinyCMS \
APP_PORT=6174 \
APP_USER=shinycms \
APP_DIR=/opt/shinycms \
SHINYCMS_CONFIG=/opt/shinycms/config/shinycms.conf


# Install required Debian packages

RUN apt-get update \
\
&& apt-get install -y \
cpanminus \
gcc \
libexpat-dev `# Required by XML::Parser for XML::Feed` \
libmysqlclient-dev `# Required by DBD::mysql` \
libpq-dev `# Required by DBD::Pg` \
libxml2-dev `# Required by XML::LibXML for XML::Feed` \
make \
zlib1g-dev `# Required by XML::LibXML for XML::Feed` \
\
&& apt-get clean \
\
&& rm -rf /var/cache/apt/archives/*


# Install required CPAN modules

RUN cpanm --notest \
parent \
Captcha::reCAPTCHA \
Catalyst::Action::RenderView \
Catalyst::Authentication::Realm::SimpleDB \
Catalyst::Plugin::Authentication \
Catalyst::Plugin::ConfigLoader \
Catalyst::Plugin::Session \
Catalyst::Plugin::Session::State::Cookie \
Catalyst::Plugin::Session::Store::DBIC \
Catalyst::Plugin::Static::Simple \
Catalyst::Runtime \
Catalyst::TraitFor::Request::BrowserDetect \
Catalyst::View::TT \
Catalyst::View::Email \
CatalystX::RoleApplicator \
Config::General \
DBD::mysql \
DBD::Pg \
DBIx::Class::EncodedColumn \
DBIx::Class::Schema::Loader \
DBIx::Class::TimeStamp \
Email::Sender \
Email::Valid \
FCGI \
FCGI::ProcManager \
File::Pid \
HTML::Restrict \
HTML::TagCloud \
HTML::TreeBuilder \
Method::Signatures::Simple \
Module::Install::Catalyst \
MooseX::NonMoose \
MooseX::MarkAsMethods \
Net::Domain::TLD \
Text::CSV::Simple \
Template::Plugin::Markdown \
URI::Encode \
XML::Feed \
\
&& rm -rf /root/.cpan /root/.cpanm


# Copy the webapp files into place and make sure our webapp user owns them

RUN mkdir $APP_DIR

COPY . $APP_DIR

RUN groupadd -r $APP_USER && useradd -r -g $APP_USER $APP_USER

RUN chown -R $APP_USER.$APP_USER $APP_DIR


# Run the webapp!

EXPOSE $APP_PORT

WORKDIR $APP_DIR

USER $APP_USER

CMD script/shinycms_server.pl --port 6174

2 changes: 2 additions & 0 deletions bin/dev-tools/docker-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker build -t shinyideas/shinycms .

11 changes: 11 additions & 0 deletions bin/docker/mysql-client-docker-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
source 'script.config'

docker run -it \
--link ShinySQL_$DOMAIN:mysql \
--rm mysql sh -c 'exec mysql \
-h"$MYSQL_PORT_3306_TCP_ADDR" \
-P"$MYSQL_PORT_3306_TCP_PORT" \
-uroot \
-p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" \
shinycms'

12 changes: 12 additions & 0 deletions bin/docker/mysql-docker-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
source 'script.config'

docker run -d \
--name ShinySQL_$DOMAIN \
-e MYSQL_USER=$DB_USER \
-e MYSQL_PASSWORD=$DB_PASS \
-e MYSQL_DATABASE=shinycms \
-e MYSQL_ROOT_PASSWORD=$ROOT_PASS \
--volume $BASE_DIR/$DOMAIN/MySQL/data:/var/lib/mysql \
--volume $BASE_DIR/$DOMAIN/MySQL/conf:/etc/mysql/conf.d \
mysql:$MYSQL_VERSION

22 changes: 22 additions & 0 deletions bin/docker/script.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Domain name of the website
DOMAIN=shiny.cms

# Directory the site data directory will be stored in
BASE_DIR=/home/sites

# Port on the host machine that you want the site on
PORT=6174

# How many Starman worker processes to spawn initially
WORKERS=5

# Site database username and password
DB_USER=shinyuser
DB_PASS=shinypass

# Database root password
ROOT_PASS=changeme

# Which MySQL version to run (5.5 / 5.6 / 5.7 / latest)
MYSQL_VERSION=5.7

4 changes: 4 additions & 0 deletions bin/docker/shinycms-docker-connect
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'script.config'

docker exec -it ShinyCMS_$DOMAIN /bin/bash

15 changes: 15 additions & 0 deletions bin/docker/shinycms-docker-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
source 'script.config'

docker run -d \
--name ShinyCMS_$DOMAIN \
--publish $PORT:6174 \
--link ShinySQL_$DOMAIN:mysql \
--volume $BASE_DIR/$DOMAIN/ShinyCMS/config:/opt/shinycms/config:ro \
--volume $BASE_DIR/$DOMAIN/ShinyCMS/site/templates:/opt/shinycms/root:rw \
--volume $BASE_DIR/$DOMAIN/ShinyCMS/site/assets:/opt/shinycms/root/static:rw \
--volume $BASE_DIR/$DOMAIN/ShinyCMS/site/restricted-files:/opt/shinycms/root/restricted-files:ro \
--volume $BASE_DIR/$DOMAIN/ShinyCMS/admin/templates:/opt/shinycms/root/admin:ro \
--volume $BASE_DIR/$DOMAIN/ShinyCMS/admin/assets/images:/opt/shinycms/root/static/images/admin:ro \
shinyideas/shinycms \
starman script/shinycms_plack.psgi --listen :$PORT --workers $WORKERS

33 changes: 26 additions & 7 deletions docs/Getting-Started
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ Once your site is up and running, you can log into the admin interface by
visiting http://your-site/admin

The default admin user has username 'admin' and password 'changeme'. Please
do change the admin password - and consider changing the username too.
do change the admin password! Or, even better, use the default account to
create your own user account, given that full admin privileges, then log in
as you and delete the default 'admin' account.

If you build the site using the bin/database/build script then you will need
to add at least one CMS Template, one CMS Section and one CMS Page before you
will have a working front-end site. Look in the demo data for examples (see
the various bin/database/insert-*-demo-data scripts, or build the database
with the demo data loaded using bin/database/build-with-demo-data).
the various bin/database/util/insert-*-demo-data scripts, or build the
database with the demo data loaded using bin/database/build-with-demo-data).


TEMPLATES
Expand All @@ -112,15 +114,32 @@ for that page will not update automatically.
FILESERVER / RESTRICTED FILES

You can have files which will only be served to logged-in users who have a
certain role set. The way this works is that you put them into a folder
like so - root/restricted-files/{Role Name}/path/to/file.png - then create
the appropriate role (in the user admin area) and enable that role for any
user you want to be able to see that restricted content.
certain access group set. The way this works is that you put them into a
folder like so - root/restricted-files/{Access Group Name}/path/to/file.png -
then create the appropriate access group (in the user admin area) and users
to that new access group if you want them to be able to see that restricted
content.

To serve these files, construct a URL like the following:
http://example.com/fileserver/auth/{Role Name}/path/to/file.png


DOCKER

As of version 0.9.0, ShinyCMS is available as a Docker image:
docker pull shinyideas/shinycms

You will need to emplace various folders in /home/site (or wherever you decide
to put all your config, templates, and assets). Look at the volume mounts in
bin/docker/shinycms-docker-run for a suggested layout, but feel free to modify
it to suit your needs!

You can download a starter-pack of templates etc for use with Docker, here:
http://shinycms.org/static/shinycms-docker-assets-0.9.0.tar.gz

You can configure some of the Docker settings in: bin/docker/script.config


DEVELOPMENT

If you are considering extending and improving ShinyCMS, please read the file
Expand Down
2 changes: 1 addition & 1 deletion lib/ShinyCMS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use Method::Signatures::Simple;
extends 'Catalyst';


our $VERSION = '0.007';
our $VERSION = '0.9.0';
$VERSION = eval $VERSION;


Expand Down

0 comments on commit d64a264

Please sign in to comment.