Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add readme #1

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Dockerfile*
docker-compose.yml
vendor
tests
tests
14 changes: 12 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

#
RUN apt-get update && apt-get install -y \
gnupg git libnss3-tools \
vim # for testing for now
gnupg git libnss3-tools gosu \
vim net-tools procps # for testing for now



Expand Down Expand Up @@ -49,9 +49,16 @@ RUN mkdir /.composer && \
chmod -R ugo+rw /.composer && \
chown -R "$USER" /.composer

COPY docker/Caddyfile /etc/caddy/Caddyfile
COPY --chown=$USER:$WWWGROUP docker/start-review-container /usr/local/bin/start-review-container


RUN chown -R "$USER":${WWWGROUP} /data/caddy && \
chown -R "$USER":${WWWGROUP} /config/caddy && \
chmod 770 /usr/local/bin/start-review-container && \
chmod 444 /etc/caddy/Caddyfile && \
mkdir -p /var/www/.npm && chown -R $USER:$WWWGROUP /var/www/.npm && \
mkdir -p /app/logs/laravel && \
chown -R $USER:$WWWGROUP /app


Expand All @@ -69,3 +76,6 @@ RUN mkdir -p /app/storage/logs && \
npm run build

RUN composer install --no-interaction --no-dev --prefer-dist --optimize-autoloader


CMD ["/usr/local/bin/start-review-container"]
41 changes: 2 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
<p align="center"><img src="https://statamic.com/assets/branding/Statamic-Logo+Wordmark-Rad.svg" width="400" alt="Statamic Logo" /></p>
# Statamic in docker on heroku

## About Statamic

Statamic is the flat-first, Laravel + Git powered CMS designed for building beautiful, easy to manage websites.

> **Note:** This repository contains the code for the Statamic application. To contribute to the core package, visit the [Statamic core package repository][cms-repo].


## Learning Statamic

Statamic has extensive [documentation][docs]. We dedicate a significant amount of time and energy every day to improving them, so if something is unclear, feel free to open issues for anything you find confusing or incomplete. We are happy to consider anything you feel will make the docs and CMS better.

## Support

We provide official developer support on [Statamic Pro](https://statamic.com/pricing) projects. Community-driven support is available on the [forum](https://statamic.com/forum) and in [Discord][discord].


## Contributing

Thank you for considering contributing to Statamic! We simply ask that you review the [contribution guide][contribution] before you open issues or send pull requests.


## Code of Conduct

In order to ensure that the Statamic community is welcoming to all and generally a rad place to belong, please review and abide by the [Code of Conduct](https://github.com/statamic/cms/wiki/Code-of-Conduct).


## Important Links

- [Statamic Main Site](https://statamic.com)
- [Statamic Documentation][docs]
- [Statamic Core Package Repo][cms-repo]
- [Statamic Migrator](https://github.com/statamic/migrator)
- [Statamic Discord][discord]

[docs]: https://statamic.dev/
[discord]: https://statamic.com/discord
[contribution]: https://github.com/statamic/cms/blob/master/CONTRIBUTING.md
[cms-repo]: https://github.com/statamic/cms
Tests how to deploy a php statamic (frankenphp) container on heroku.
9 changes: 9 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Heroku statamic review apps test",
"repository": "https://github.com/rburgstaller/frankenphp-statamic",
"env": {},
"addons": [],
"buildpacks": [],
"stack": "container"
}

7 changes: 4 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ services:
dockerfile: ./Dockerfile
ports:
# laravel
- '8002:443'
- '9999:9999'
- '2019:2019'
environment:
PORT: 81
#user: '33:33'
PORT: 9999
# user: '33:33'
networks:
- fp-network
networks:
Expand Down
59 changes: 59 additions & 0 deletions docker/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
{$CADDY_GLOBAL_OPTIONS}
{$CADDY_GLOBAL_OPTIONS2}

debug

frankenphp {
#worker /path/to/your/worker.php
{$FRANKENPHP_CONFIG}
}

# https://caddyserver.com/docs/caddyfile/directives#sorting-algorithm
order mercure after encode
order vulcain after reverse_proxy
order php_server before file_server
order php before file_server
}

{$CADDY_EXTRA_CONFIG}

:{$PORT:8080} {
bind 0.0.0.0

#log {
# # Redact the authorization query parameter that can be set by Mercure
# format filter {
# wrap console
# fields {
# uri query {
# replace authorization REDACTED
# }
# }
# }
#}

root * public/
encode zstd br gzip

# Uncomment the following lines to enable Mercure and Vulcain modules
#mercure {
# # Transport to use (default to Bolt)
# transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db}
# # Publisher JWT key
# publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG}
# # Subscriber JWT key
# subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG}
# # Allow anonymous subscribers (double-check that it's what you want)
# anonymous
# # Enable the subscription API (double-check that it's what you want)
# subscriptions
# # Extra directives
# {$MERCURE_EXTRA_DIRECTIVES}
#}
#vulcain

{$CADDY_SERVER_EXTRA_DIRECTIVES}

php_server
}
33 changes: 33 additions & 0 deletions docker/start-review-container
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# here we can add the code to perform the db migration, db setup etc
php artisan migrate
php artisan db:seed
php artisan cache:clear

echo "got port $PORT"

export CADDY_GLOBAL_OPTIONS="http_port $PORT"
export SERVER_NAME="http://0.0.0.0:$PORT"

# check what user and gid we have
echo "id follows $(id)"
echo "whoami follows $(whoami)"

# exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf

if [[ -n "${UID}" && "${UID}" -ne 33 ]]; then
echo "UID is set and is different from 33"
# usermod -u $UID www-data
else
echo "UID is not set or is equal to 33"
fi


if [ $# -gt 0 ]; then
echo "starting custom command $@"
exec gosu $WWWUSER "$@"
else
echo "starting entrypoint"
# exec gosu www-data /usr/local/bin/docker-php-entrypoint --config /etc/caddy/Caddyfile --adapter caddyfile
exec /usr/local/bin/docker-php-entrypoint --config /etc/caddy/Caddyfile --adapter caddyfile
fi