Skip to content

Commit

Permalink
Merge pull request #189 from cakephp/dokku-deploy
Browse files Browse the repository at this point in the history
Start roughing out how github action deploys could work
  • Loading branch information
markstory committed Oct 30, 2021
2 parents 10e5852 + 2c80530 commit 0f11ec4
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
php-version: '7.4'
extensions: mbstring, intl, apcu
tools: cs2pr
coverage: none
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: 'deploy_docs'

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Cloning repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Push to dokku
uses: dokku/github-action@master
with:
git_remote_url: 'ssh://dokku@apps.cakephp.org:authorization-docs-2'
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}
20 changes: 19 additions & 1 deletion docs.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,36 @@ FROM markstory/cakephp-docs-builder as builder

COPY docs /data/docs

ENV LANGS="en es fr"

# Build docs with sphinx
RUN cd /data/docs-builder && \
make website LANGS="en es fr" SOURCE=/data/docs DEST=/data/website
make website LANGS="$LANGS" SOURCE=/data/docs DEST=/data/website

# Build a small nginx container with just the static site in it.
FROM nginx:1.15-alpine

# Configure search index script
ENV LANGS="en es fr"
ENV SEARCH_SOURCE="/data/docs"
ENV SEARCH_URL_PREFIX="/authorization/2"

# Janky but we could extract this into an image we re-use.
RUN apk add --update php php-curl

COPY --from=builder /data/website /data/website
COPY --from=builder /data/docs-builder/nginx.conf /etc/nginx/conf.d/default.conf

# Copy the search index script, and source files over.
COPY --from=builder /data/docs-builder/scripts/populate_search_index.php /data/populate_search_index.php
COPY --from=builder /data/docs /data/docs

COPY run.sh /data/run.sh

# Move files into final location
RUN cp -R /data/website/html/* /usr/share/nginx/html \
&& rm -rf /data/website/

RUN ln -s /usr/share/nginx/html /usr/share/nginx/html/2.x

CMD ["/data/run.sh"]
15 changes: 15 additions & 0 deletions docs/es/contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Contents
########

.. toctree::
:maxdepth: 2
:caption: CakePHP Authorization

/index
/policies
.. /policy-resolvers
.. /middleware
.. /checking-authorization
.. /component
.. /request-authorization-middleware
.. /2-0-migration-guie
11 changes: 6 additions & 5 deletions docs/es/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ Otras lecturas
==============

* :doc:`/policies`
* :doc:`/policy-resolvers`
* :doc:`/middleware`
* :doc:`/component`
* :doc:`/checking-authorization`
* :doc:`/request-authorization-middleware`

.. * :doc:`/policy-resolvers`
.. * :doc:`/middleware`
.. * :doc:`/component`
.. * :doc:`/checking-authorization`
.. * :doc:`/request-authorization-middleware`
8 changes: 8 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.x-dev@">
<file src="src/Controller/Component/AuthorizationComponent.php">
<DeprecatedMethod occurrences="1">
<code>loadModel</code>
</DeprecatedMethod>
</file>
</files>
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
autoloader="tests/bootstrap.php"
>
<projectFiles>
<directory name="src" />
Expand Down
10 changes: 10 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# Update elasticsearch indexes.
for lang in ${LANGS}
do
php /data/populate_search_index.php --source="$SEARCH_SOURCE/$*" --lang="$lang" --host="dokku-elasticsearch-searchv2" --url-prefix="$SEARCH_URL_PREFIX"
done

# Run nginx like normal.
nginx -g daemon off;
2 changes: 1 addition & 1 deletion src/Controller/Component/AuthorizationComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ protected function getDefaultAction(ServerRequest $request): string
/**
* Returns model authorization handler if model authorization is enabled.
*
* @return array
* @return array<string, mixed>
*/
public function implementedEvents(): array
{
Expand Down

0 comments on commit 0f11ec4

Please sign in to comment.