Update Workspace slides for PHPNW

This commit is contained in:
Oliver Davies 2021-02-01 02:21:44 +00:00
parent 398fa3c547
commit fdd5b3138f
16 changed files with 331 additions and 26 deletions

View file

@ -0,0 +1,3 @@
command('say-hello <name>'): |
#!bash|=
echo ={ @('message') } from ={ input.argument('name') }

View file

@ -0,0 +1,5 @@
attribute('message'): Hello World!
command('say-hello'): |
#!bash|@
echo @('message')

View file

@ -0,0 +1,11 @@
attributes:
drupal:
docroot: web
command('apply config'): |
#!php
$ws->confd('workspace:/confd')->apply();
confd('workspace:/confd'):
- src: 'vhost.conf'
dst: 'workspace:/.my127ws/docker/nginx/default.conf'

View file

@ -0,0 +1,7 @@
command('say-hello <name>'):
env:
MESSAGE: = @('message')
NAME: = input.argument('name')
exec: |
#!bash|=
echo "$MESSAGE from $NAME"

View file

@ -0,0 +1,8 @@
# Download from GitHub.
wget https://github.com/my127/workspace/releases/download/0.1.3/ws
# Make it executable.
chmod +x ws
# Make it accessible.
mv ws /usr/local/bin

View file

@ -0,0 +1,8 @@
server {
server_name _;
root /app/{{ @('drupal.docroot' )}};
# output
server {
server_name _;
root /app/web;

View file

@ -0,0 +1,5 @@
command('say-hello'):
#!bash
run echo 'Hello World'
passthru echo 'Hello World'

View file

@ -0,0 +1,9 @@
# ws secret generate-random-key
key('default'): 'd38be3b7aa42fdbfb14c0d25f07bc1875edd5f13f640cd76'
# ws secret encrypt 'Hello World!'
attribute('message'): = decrypt('YTozOntpOjA7czo3OiJkZWZhdWx0Ijt')
command('say-hello'): |
#!bash|@
echo @('message')

View file

@ -0,0 +1,12 @@
# workspace.yml
workspace('oliverdavies-uk'):
description: My personal website codebase.
command('say-hello'):
#!bash
echo 'Hello world'
command('say-hello'):
#!php
echo 'Hello World';

View file

@ -0,0 +1,34 @@
attributes:
rst2pdf:
command: |
= 'rst2pdf ' ~ @('rst2pdf.filename.rst') ~ '
--break-level 1
--stylesheets main
--fit-background-mode scale
--extension-module preprocess
--output ' ~ @('rst2pdf.filename.pdf')
filename:
pdf: slides.pdf
rst: slides.rst
thumbnail:
filename: thumbnail.png
command('pdf generate <talk>'): |
#!bash|=
cd ={ input.argument('talk') }
passthru ={ @('rst2pdf.command') }
command('pdf watch <talk>'): |
#!bash|=
cd ={ input.argument('talk') }
passthru nodemon -e rst,style,txt -x "={ @('rst2pdf.command') }"
command('thumbnail <talk>'):
env:
PDF_FILENAME: = @('rst2pdf.filename.pdf')
THUMBNAIL_FILENAME: = @('thumbnail.filename')
exec: |
#!bash|=
cd ={ input.argument('talk') }
passthru gs -sDEVICE=png16m -r300 -dDownScaleFactor=4
-sOutputFile=$THUMBNAIL_FILENAME -dLastPage=1 $PDF_FILENAME

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View file

@ -13,6 +13,7 @@ pageSetup:
pageTemplates: pageTemplates:
coverPage: coverPage:
# background: images/title.png
frames: [] frames: []
[12%, 10%, 76%, 75%] [12%, 10%, 76%, 75%]
showFooter: false showFooter: false
@ -21,38 +22,47 @@ pageTemplates:
titlePage: titlePage:
alignment: TA_CENTER alignment: TA_CENTER
frames: [] frames: []
[8%, 8%, 90%, 60%] [8%, 8%, 85%, 65%]
showFooter: true showFooter: true
showHeader: false showHeader: false
standardPage: standardPage:
frames: [] frames: []
[3%, 3%, 94%, 92%] [3%, 3%, 92%, 92%]
showFooter: true showFooter: true
showHeader: false showHeader: false
imagePage:
alignment: TA_CENTER
frames: []
[12%, 10%, 76%, 80%]
showFooter: true
showHeader: false
outputPage:
frames: []
[8%, 10%, 82%, 65%]
showFooter: false
showHeader: false
linkColor: #24608a linkColor: #24608a
styles: styles:
normal: normal:
fontSize: 28 fontSize: 24
leading: 32
textColor: #383745 textColor: #383745
bodytext: bodytext:
alignment: TA_LEFT alignment: TA_LEFT
heading: heading:
alignment: TA_CENTER fontSize: 20
fontSize: 24
spaceAfter: 16 spaceAfter: 16
textColor: #24608a textColor: #24608a
heading1:
parent: heading
alignment: TA_LEFT
title: title:
fontSize: 250% fontSize: 300%
parent: heading parent: heading
bullet-list: bullet-list:
@ -69,13 +79,49 @@ styles:
titleslideinfo: titleslideinfo:
alignment: TA_CENTER alignment: TA_CENTER
fontSize: 120% fontSize: 140%
parent: normal parent: normal
footer: footer:
alignment: TA_RIGHT alignment: TA_RIGHT
fontName: stdMono fontName: stdMono
fontSize: 18 fontSize: 20
textColor: #24608a textColor: #24608a
rightIndent: 16 rightIndent: 16
spaceBefore: 0 spaceBefore: 0
literal:
backColor: #eeeeee
fontName: stdMono
code:
backColor: #eeeeee
borderWidth: 0
fontSize: 20
leading: 24
parent: literal
spaceBefore: 4
blockquote:
parent: normal
fontName: stdItalic
leading: 36
attribution:
parent: normal
textColor: #66666
centred:
alignment: TA_CENTER
parent: bodytext
centredtitle:
alignment: TA_CENTER
fontName: stdBold
fontSize: 48
leading: 64
parent: heading
text-lg:
parent: bodytext
fontSize: 150%

View file

@ -12,20 +12,25 @@ Oliver Davies, Inviqa
.. raw:: pdf .. raw:: pdf
TextAnnotation "Full stack Developer and Systems Administrator" TextAnnotation "Full stack Developer and Systems Administrator"
TextAnnotation "Organiser of PHP South Wales"
PageBreak standardPage .. page:: standardPage
What is Workspace? What is Workspace?
================== ==================
* A tool that we use and maintain at Inviqa * A tool that we use and maintain at Inviqa
* Primarily for building and managing Docker Compose environments
* Built on Symfony
* Create custom commands for your project environments * Create custom commands for your project environments
* Alternative to a bash script or a Makefile * Alternative to a bash script or a Makefile
* And more...
.. raw:: pdf .. raw:: pdf
TextAnnotation "Available on GitHub, MIT licensed." TextAnnotation "Available on GitHub, MIT licensed."
TextAnnotation "Uses Config, Console, Dependency Injection, Expression Language, Finder and YAML components, as well as Twig."
TextAnnotation "Replacement for commands like 'make build'"
TextAnnotation "Useful for simplifying long, complicated commands, e.g. Docker, Ansible." TextAnnotation "Useful for simplifying long, complicated commands, e.g. Docker, Ansible."
Features Features
@ -34,21 +39,172 @@ Features
* Commands * Commands
* Functions * Functions
* Attributes * Attributes
* Managing secrets * Encrypting/decrypting secrets
* Configuration files * Generating configuration files
* Global services: logging, mail, proxy
.. Change to a title page
.. raw:: pdf .. raw:: pdf
PageBreak titlePage TextAnnotation "Generating settings.php files, Dockerfiles and Docker Compose from a central set of attributes."
TextAnnotation "Logging with kibana, mailhog, Traefik proxy."
Demo Installation
==== ============
.. code-block:: bash
:include: code/installation.txt
.. page:: imagePage
.. image:: images/output-simple.png
:width: 15cm
.. page:: titlePage
.. class:: centredtitle
Replacing your Makefile
.. page:: standardPage
Running simple commands
=======================
.. code-block:: yaml
:include: code/simple-command.txt
:linenos:
.. page:: imagePage
.. image:: images/output-command.png
:width: 15cm
.. page:: standardPage
'run' vs. 'passthru'
====================
.. code-block:: yaml
:include: code/run-passthru.txt
.. image:: images/helper-run.png
:width: 20cm
.. image:: images/helper-passthru.png
:width: 20cm
Attributes
==========
.. code-block:: yaml
:include: code/attributes.txt
:linenos:
Arguments
=========
.. code-block:: yaml
:include: code/arguments.txt
:linenos:
Environment variables
=====================
.. code-block:: yaml
:include: code/environment-variables.txt
:linenos:
Managing secrets
================
.. code-block:: yaml
:include: code/secrets.txt
.. Change to a standard page
.. raw:: pdf .. raw:: pdf
PageBreak standardPage TextAnnotation "Shortened for slides"
TextAnnotation "Store default key in an overrides file that's ignored from Git, and somewhere secure like a password manager."
.. page:: titlePage
.. class:: centredtitle
Example: building slides from rst2pdf
.. page:: standardPage
Attributes
==========
.. code-block:: yaml
:include: code/workspace-talks.txt
:end-before: command('pdf generate <talk>'): |
Generating PDFs
===============
.. code-block:: yaml
:include: code/workspace-talks.txt
:start-at: command('pdf generate <talk>'): |
:end-before: command('thumbnail <talk>'):
Generating thumbnails
=====================
.. code-block:: yaml
:include: code/workspace-talks.txt
:start-at: command('thumbnail <talk>'):
.. page:: titlePage
.. class:: centredtitle
Configuration files
.. page:: standardPage
Using confd
===========
.. code-block:: yaml
:include: code/confd.txt
:linenos:
.. raw:: pdf
TextAnnotation ".twig file extension is assumed."
vhost.conf.twig
===============
The source file.
|
.. code-block:: twig
:include: code/nginx-vhost.txt
:end-before: # output
:linenos:
default.conf
============
The generated file.
|
.. code-block:: nginx
:include: code/nginx-vhost.txt
:start-after: # output
:linenos:
.. page:: titlePage
.. class:: centredtitle
Demo: "Workspacing" my site
.. page:: standardPage
Thanks! Thanks!
======= =======
@ -56,7 +212,8 @@ Thanks!
References: References:
* https://github.com/my127/workspace * https://github.com/my127/workspace
* https://github.com/opdavies/working-with-workspace-demo * https://oliverdavies.link/workspace-demo
* https://oliverdavies.link/workspacing-site
| |