Code Monkey home page Code Monkey logo

webfact-make's Introduction

Webfact-make: Automation for building a Webfactory UI

The Webfactory provides a UI to interface to the Docker API, allowing operations on containers/images. It aims to streamline dev and operations for Drupal websites. See also https://github.com/Boran/webfact

The Webfactory consists of several modules: webfact (main logic), webfact_content_types (features/views), webfact-make (build/install), webfact_theme (styling), webfactapi (optional remote control) and webfactory (deprecated: full site install)

You need: Docker server (e.g. Ubuntu 14.04) with docker 1.5 or later Container for the webfactory (e.g. the drupal lamp "boran/drupal" container) THe webfact modules listed above. Some Drupal contrib modules and the Bootstrap theme.

Installation: quickie using a drush makefile and the boran/drupal image

We assume you have docker installed (see docker.md) and know how to use it.

Setup a new container based on the boran/drupal image. The container called webfact points port 8020 on the docker host to it. It also makes the docker socket available in the container.

# grab the latest image
docker pull boran/drupal

# create a webfact container
name=webfact
domain=$name.example.ch
[email protected]
image="boran/drupal"
port=8020

docker stop $name;
docker rm $name;

docker run -td -p $port:80 -e "VIRTUAL_HOST=$domain" -v /var/run/docker.sock:/var/run/docker.sock -v /opt/sites/$name:/data -v /opt/sites:/opt/sites -e "DRUPAL_SITE_NAME=WebFactory" -e "DRUPAL_ADMIN_EMAIL=$email" -e "DRUPAL_SITE_EMAIL=$email" -e "DRUPAL_MAKE_REPO=https://github.com/Boran/webfact-make" -e "DRUPAL_MAKE_DIR=webfact-make" -e DRUPAL_INSTALL_PROFILE=webfactp -e DRUPAL_FINAL_CMD="chown www-data /var/run/docker.dock; cd /var/www/html; drush dl -y composer-8.x-1.x; drush -y composer-manager install;"  -e "VIRTUAL_HOST=$domain" --restart=always --hostname $domain --name $name $image

# follow progress
docker logs -f $name

Installation done: go to the website page and log on as admin, password=admin and see the configuration section below.

Installation: step by step

Lets install step by step to better understand (or if the quickie section above did not work for you). First install a boran/drupal docker container. This will setup vanilla drupal and point port 8020 on the docker host to it. It also makes the docker socket available in the container.

# grab the latest image
docker pull boran/drupal
 
# create a webfact container (adapt name/email)
name=webfact
domain=$name.example.ch
[email protected]
image="boran/drupal"
docker run -td -p 8020:80 -e "VIRTUAL_HOST=$domain" -v /var/run/docker.sock:/var/run/docker.sock -e "DRUPAL_SITE_NAME=WebFactory" -e "DRUPAL_ADMIN_EMAIL=$email" -e "DRUPAL_SITE_EMAIL=$email" --restart=always --hostname $domain --name $name $image

Now connect into the container (via "docker exec -it webfact bash"), remove any previous DB or code. You could also start from this step if not using the boran/drupal container.

\rm -rf /var/www/html
echo "drop database drupal" |mysql
echo "create database drupal; grant all on drupal.* to drupal" |mysql

Get and execute the make file: download all modules

drush make https://raw.githubusercontent.com/Boran/webfact-make/master/webfact-make.make /var/www/html

Create directories

mkdir -p /var/www/html/sites/default/files /var/www/html/sites/all/libraries/composer /var/lib/drupal-private
chown -R www-data /var/www/html/sites/default /var/www/html/sites/all /var/lib/drupal-private

Run the install profile

MYSQL_PASSWORD=`cat /drupal-db-pw.txt`
YOUREMAIL="[email protected]"
sitename="webfact"
(cd /var/www/html/sites/default &&  drush site-install webfactp -y --account-name=admin --account-pass=changeme --account-mail=$YOUREMAIL --site-name=$sitename --site-mail=$YOUREMAIL  --db-url="mysqli://drupal:${MYSQL_PASSWORD}@localhost:3306/drupal" )

Manual step: download composer components

(cd /var/www/html; drush dl -y composer-8.x-1.x; drush -y composer-manager install)
chown www-data /var/run/docker.dock;

Installation done: go to the website page and log as admin/admin and see the configuration section below.

Installation: /var/www/html from your custom repo

Lets say you have installed a fresh Drupal and checked /var/www/html into your own repo. Assuming all required modules are available, one can install the container ba a) checking out your repo, running the webfact profile and final script, e.g.

# grab the latest image
docker pull boran/drupal

# create a webfact container
name=webfact
domain=$name.example.ch
[email protected]
image="boran/drupal"
port=8020

docker stop $name;
docker rm $name;

docker run -td -p $port:80 -e "VIRTUAL_HOST=$domain" -v /var/run/docker.sock:/var/run/docker.sock -v /opt/sites/$name:/data -v /opt/sites:/opt/sites -e "DRUPAL_SITE_NAME=WebFactory" -e "DRUPAL_ADMIN_EMAIL=$email" -e "DRUPAL_SITE_EMAIL=$email" -e "DRUPAL_GIT_REPO=https://YOUR.GITREPO.COM/some/path" -e "DRUPAL_GIT_BRANCH=master" -e DRUPAL_INSTALL_PROFILE=webfactp -e DRUPAL_FINAL_SCRIPT=/var/www/html/profiles/webfactp/scripts/final.sh"  -e "VIRTUAL_HOST=$domain" --restart=always --hostname $domain --name $name $image

Notes: adapt DRUPAL_GIT_REPO and DRUPAL_GIT_BRANCH. Clone https://github.com/Boran/webfact-make.git/ into /var/www/html/profiles/webfactp. Adapt /var/www/html/profiles/webfactp/scripts/final.sh if you need to automated some settings when installing.

TO DO

See the issues on github and specifically the meta #3: Boran#3

Configuration (after installation)

After installation a basic webfactory should be running, with one sample website and one template. Next steps:

  • Login and change the admin password.
  • Webfactory settings: admin/config/development/webfact: set the URL for the docker host, domain prefix and other settings
  • menu order: put 'home' first (admin/structure/menu/manage/main-menu)
  • Permissions:
    • Assign the Site Owner role to users who need to create websites.
    • permissions: This role should be able to create new, edit own and delete own 'website' entities. You may wish to allow Site Owners to create and edit own Template entities.
    • Site Owners probably need teh 'Access websites" and otpionally 'Manage Containers'.
    • the Administrator role should have all rights on the Website/Template content types and Webfactory UI. More:
  • Theme admin/structure/block : disable the navigation + drupal blocks (should be done by the final.sh script)
  • Webfactory
    • admin/structure/block: enable the myWebsites into the content zone, only for the listed pages 'user', 'user/*'
    • node/add: add more templates
  • Modules:
    • Enable node export. Now you can export/import templates from another Webfactory instance (see node/add/node_export)
  • Backups . Enable the Backup/Migrate modules, and configure it - admin/config/system/backup_migrate . In the settings tab, override the the manual and schedules directories to /data/backup_migrate/manual and /data/backup_migrate/scheduled . Create a Schedule "daily" with default settings . Override Settings > Settings profiles > Default > Override > Advanced: enable 'Send an email if backup succeeds' . Do a 'Backup now' with destination of Manual Backups Directory
  • Contact: The contact form is already enabled as /contact. Set recipients under admin/structure/contact. Add it to the main menu after templates.

Using

Todo: add a walkthough on create templates and websites and operations on websites.

webfact-make's People

Contributors

boran avatar jbartsch avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.