diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..c679b801e --- /dev/null +++ b/.dockerignore @@ -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 + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..049f67a4b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,98 @@ +FROM debian:jessie +MAINTAINER Denny de la Haye <2016@denny.me> + + +# 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 + diff --git a/bin/dev-tools/docker-build b/bin/dev-tools/docker-build new file mode 100755 index 000000000..847e93ad3 --- /dev/null +++ b/bin/dev-tools/docker-build @@ -0,0 +1,2 @@ +docker build -t shinyideas/shinycms . + diff --git a/bin/docker/mysql-client-docker-run b/bin/docker/mysql-client-docker-run new file mode 100755 index 000000000..8d42a4a64 --- /dev/null +++ b/bin/docker/mysql-client-docker-run @@ -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' + diff --git a/bin/docker/mysql-docker-run b/bin/docker/mysql-docker-run new file mode 100755 index 000000000..6bcdb3430 --- /dev/null +++ b/bin/docker/mysql-docker-run @@ -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 + diff --git a/bin/docker/script.config b/bin/docker/script.config new file mode 100644 index 000000000..9fd017f67 --- /dev/null +++ b/bin/docker/script.config @@ -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 + diff --git a/bin/docker/shinycms-docker-connect b/bin/docker/shinycms-docker-connect new file mode 100755 index 000000000..890148ef1 --- /dev/null +++ b/bin/docker/shinycms-docker-connect @@ -0,0 +1,4 @@ +source 'script.config' + +docker exec -it ShinyCMS_$DOMAIN /bin/bash + diff --git a/bin/docker/shinycms-docker-run b/bin/docker/shinycms-docker-run new file mode 100755 index 000000000..0aade9dae --- /dev/null +++ b/bin/docker/shinycms-docker-run @@ -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 + diff --git a/docs/Getting-Started b/docs/Getting-Started index b8511c684..4c3d59067 100644 --- a/docs/Getting-Started +++ b/docs/Getting-Started @@ -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 @@ -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 diff --git a/lib/ShinyCMS.pm b/lib/ShinyCMS.pm index 31633cbfb..0a2e80220 100644 --- a/lib/ShinyCMS.pm +++ b/lib/ShinyCMS.pm @@ -23,7 +23,7 @@ use Method::Signatures::Simple; extends 'Catalyst'; -our $VERSION = '0.007'; +our $VERSION = '0.9.0'; $VERSION = eval $VERSION;