Automated commit
Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
parent
e85167d5eb
commit
ba2bf10bea
79 changed files with 0 additions and 0 deletions
4
working-with-workspace/README.rst
Normal file
4
working-with-workspace/README.rst
Normal file
|
@ -0,0 +1,4 @@
|
|||
Working with Workspace
|
||||
######################
|
||||
|
||||
https://www.oliverdavies.uk/talks/working-with-workspace
|
3
working-with-workspace/code/arguments.txt
Normal file
3
working-with-workspace/code/arguments.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
command('say-hello <name>'): |
|
||||
#!bash|=
|
||||
echo ={ @('message') } from ={ input.argument('name') }
|
5
working-with-workspace/code/attributes.txt
Normal file
5
working-with-workspace/code/attributes.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
attribute('message'): Hello World!
|
||||
|
||||
command('say-hello'): |
|
||||
#!bash|@
|
||||
echo @('message')
|
11
working-with-workspace/code/confd.txt
Normal file
11
working-with-workspace/code/confd.txt
Normal 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'
|
7
working-with-workspace/code/environment-variables.txt
Normal file
7
working-with-workspace/code/environment-variables.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
command('say-hello <name>'):
|
||||
env:
|
||||
MESSAGE: = @('message')
|
||||
NAME: = input.argument('name')
|
||||
exec: |
|
||||
#!bash|=
|
||||
echo "$MESSAGE from $NAME"
|
8
working-with-workspace/code/installation.txt
Normal file
8
working-with-workspace/code/installation.txt
Normal 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
|
8
working-with-workspace/code/nginx-vhost.txt
Normal file
8
working-with-workspace/code/nginx-vhost.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
server {
|
||||
server_name _;
|
||||
root /app/{{ @('drupal.docroot' )}};
|
||||
|
||||
# output
|
||||
server {
|
||||
server_name _;
|
||||
root /app/web;
|
5
working-with-workspace/code/run-passthru.txt
Normal file
5
working-with-workspace/code/run-passthru.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
command('say-hello'):
|
||||
#!bash
|
||||
run echo 'Hello World'
|
||||
|
||||
passthru echo 'Hello World'
|
9
working-with-workspace/code/secrets.txt
Normal file
9
working-with-workspace/code/secrets.txt
Normal 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')
|
12
working-with-workspace/code/simple-command.txt
Normal file
12
working-with-workspace/code/simple-command.txt
Normal 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';
|
34
working-with-workspace/code/workspace-talks.txt
Normal file
34
working-with-workspace/code/workspace-talks.txt
Normal 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
|
BIN
working-with-workspace/images/helper-passthru.png
Normal file
BIN
working-with-workspace/images/helper-passthru.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
BIN
working-with-workspace/images/helper-run.png
Normal file
BIN
working-with-workspace/images/helper-run.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
BIN
working-with-workspace/images/output-command.png
Normal file
BIN
working-with-workspace/images/output-command.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
BIN
working-with-workspace/images/output-simple.png
Normal file
BIN
working-with-workspace/images/output-simple.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
222
working-with-workspace/slides.rst
Normal file
222
working-with-workspace/slides.rst
Normal file
|
@ -0,0 +1,222 @@
|
|||
.. footer:: @opdavies
|
||||
|
||||
Working with Workspace
|
||||
######################
|
||||
|
||||
|
|
||||
|
||||
.. class:: titleslideinfo
|
||||
|
||||
Oliver Davies, Inviqa
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Full stack Developer and Systems Administrator"
|
||||
TextAnnotation "Organiser of PHP South Wales"
|
||||
|
||||
.. page:: standardPage
|
||||
|
||||
What is Workspace?
|
||||
==================
|
||||
|
||||
* 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
|
||||
* Alternative to a bash script or a Makefile
|
||||
* And more...
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
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."
|
||||
|
||||
Features
|
||||
========
|
||||
|
||||
* Commands
|
||||
* Functions
|
||||
* Attributes
|
||||
* Encrypting/decrypting secrets
|
||||
* Generating configuration files
|
||||
* Global services: logging, mail, proxy
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "Generating settings.php files, Dockerfiles and Docker Compose from a central set of attributes."
|
||||
TextAnnotation "Logging with kibana, mailhog, Traefik proxy."
|
||||
|
||||
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
|
||||
|
||||
.. raw:: pdf
|
||||
|
||||
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!
|
||||
=======
|
||||
|
||||
References:
|
||||
|
||||
* https://github.com/my127/workspace
|
||||
* https://oliverdavies.link/workspace-demo
|
||||
* https://oliverdavies.link/workspacing-site
|
||||
|
||||
|
|
||||
|
||||
Me:
|
||||
|
||||
* https://www.oliverdavies.uk
|
Loading…
Add table
Add a link
Reference in a new issue