aspendigital / docker-octobercms Goto Github PK
View Code? Open in Web Editor NEWDockerized October CMS: PHP, Composer, October core and dependencies
License: MIT License
Dockerized October CMS: PHP, Composer, October core and dependencies
License: MIT License
Can't add any PHP code into a static page. It shows an error "safe_mode is currently enabled". How to disable or fix this problem?
Can we have an additional variable like ENABLE_SUPERVISOR? And this is going to install the supervisor, config file and run. For the sake of database queues. For example, it might look like this.
Dockerfile
RUN apt-get update && apt-get install -y supervisor
COPY october-worker.conf /etc/supervisor/conf.d/october-worker.conf
ADD ./run.sh /run.sh
RUN chmod a+x /run.sh
run.sh
#!/bin/sh
set -e
php artisan october:up
exec /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
october-worker.conf
[program:october-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/bin/php /var/www/html/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=root
numprocs=4
redirect_stderr=true
stdout_logfile=/var/www/html/worker.log
Making sense?
Please give any example to add ssl for domains
The stable composer.json file for October CMS doesn't require a specific build for October dependencies. This can create a problem when dependencies move beyond the build specified for the Docker image.
Some related issues:
I have a problem that I wanted to mounted new file called .env, but in the host it created by root instead of www-data
Step to reproduce
docker-compose up -d
beforedocker-compose.yml
to mount new file- ./.env:/var/www/html.env
It's caused the application error.
How I can solved it ?
Suggest we move the permissions rewrite to the image build instead of doing it via the entrypoint
Thanks for making this Dockerfile/repo; it's saved me a lot of time so far!
I love how cleanly you can develop with pushing/pulling only a handful of folders, and keeping it separate from the core OctoberCMS business logic.
At the same time, it (or rather, development with Docker in general) gives me major headaches once I go beyond editing layout files.
Especially for OctoberCMS plugin development, but also in some other edge cases (such as overriding component templates), I need to see the whole sources, as my IDE will then be able to auto-import required classes and auto-complete methods, give me type hints and such. It also helps to quickly dig into the framework code to see how other plugin developers have dealt with what I am trying to achieve.
Sometimes, I also find myself wanting to install another plugin - and it wouldn't persist unless I also added it to my Dockerfile. Its settings will be gone as well unless I somehow get the database to sync over (which works mapping the SQLite database, but I'd rather like to switch to an external database such as MySQL at some point).
How do you handle/manage such situations?
Hi,
I'm looking for docker image working on Ubuntu last version (18.04) with :
Nginx
PHP last version (7.1 / 7.2) PHP-FPM
Mariadb
Octobercms (last release)
Thx
According to the README build 465 images are available. However, a docker pull
for them fails:
$ docker pull aspendigital/octobercms:build.465-php7.4-apache
Error response from daemon: manifest for aspendigital/octobercms:build.465-php7.4-apache not found
I'm attempting to get a fresh copy working but I'm getting this error:
Cannot create directory: /var/www/html/storage/cms/cache/91/8c
My docker-compose.yml file looks like this:
version: '2.2'
services:
composer:
image: composer:latest
volumes:
- ./:/app
working_dir: /app
october:
image: aspendigital/octobercms:latest
volumes:
- ./db/database.sqlite:/var/www/html/storage/database.sqlite
- ./plugins/rainlab/user:/var/www/html/plugins/rainlab/user
- ./:/var/www/html/plugins/jd/dingoapi
ports:
- 9090:80
environment:
- APACHE_RUN_USER=www-data
- CACHE_STORE=database
- APP_DEBUG=true
- API_PREFIX=api
- API_DEBUG=true
- JWT_TTL=31622400
- JWT_BLACKLIST_ENABLED=false
- API_DEFAULT_FORMAT=json
If I remove the CACHE_STORE
env variable I get this error:
file_put_contents(/var/www/html/storage/framework/cache/11/de/11de31e1eabb2682cf62ee9c9ccb0630f1019006): failed to open stream: No such file or directory
I have tried with and without mounted volumes. My last resort was to add the APACHE_RUN_USER
env variable, but again I get the same issue with or without it.
I'm running Docker for Mac and my version of Docker is 19.03.8, build afacb8b.
These are the permissions of the storage directories:
drwxrwsr-x 1 www-data www-data 4096 May 3 12:51 .
drwxrwxrwx 1 www-data www-data 4096 Feb 20 07:02 ..
-rw-r--r-- 1 www-data www-data 9 Feb 20 07:02 .gitignore
drwxrwsr-x 4 www-data www-data 4096 Feb 20 07:02 app
drwxrwsr-x 5 www-data www-data 4096 Feb 20 07:02 cms
-rwxrwxr-x 1 www-data www-data 806912 May 3 12:51 database.sqlite
drwxrwsr-x 1 www-data www-data 4096 Feb 20 07:02 framework
drwxrwsr-x 1 www-data www-data 4096 May 3 12:51 logs
drwxrwsr-x 3 www-data www-data 4096 Feb 20 07:02 temp
Any help would be much appreciated, thanks!
I am having an issue with a volume I created for a theme I am loading on the host machine. I.e
volumes:
- src/exampletheme:/var/www/html/themes/exampletheme
and this works by showing the theme in the backend but my stylesheets, scripts are not found.
I initially thought this was an issue with permissions but its not as I set the permissions to that exampletheme and subsequent folders as such:
chmod -R 2755 exampletheme
This changed permissions but still couldn't see the files in the browser.
Themes downloaded and installed from the admin work however.
Any thoughts?
Here is my docker-compose.yml:
version: '3.3'
services:
web:
image: aspendigital/octobercms
restart: always
container_name: octobermovies
ports:
- 8800:80
volumes:
- ./storage:/var/www/html/storage
- ./plugins:/var/www/html/plugins
- ./themes:/var/www/html/themes
The page will be blank.
Then I change my docker-compose.yml to this:
version: '3.3'
services:
web:
image: aspendigital/octobercms
restart: always
container_name: octobermovies
ports:
- 8800:80
volumes:
- ./storage/app:/var/www/html/storage/app
- ./storage/logs:/var/www/html/storage/logs
- ./storage/database.sqlite:/var/www/html/storage/database.sqlite
- ./plugins/myplugin:/var/www/html/plugins/myplugin
- ./themes/newtheme:/var/www/html/themes/newtheme
It works then.
I noticed it's because the folder will be removed when the folder in host is mapped to a folder in container. Is there a way to keep the data in container? Thanks.
can i can the default APP_KEY?
Am I need put APP_KEY in .env file?
if everybody using the default APP_KEY, is that will be a problem for security? Thanks
When enabling xdebug, it's looking for a file called "docker-xdebug-php.ini", and when it's not found, an error message called "Xdebug config not found. Try the develop image" appears. This file is not generated during setup and there are no instructions on how to create it.
It seems like newest version of this container hase some issues with installing plugins from web. Using Backend and Console also will give
Bad protocol version. Please update to a newer version of October CMS (Build >472 or >v1.1.5) and try again.
for installing RainLab.User Plugin. Since this is currently only reproducable for Docker Images it may be related with this image and not with October CMS itself (did not discover that on any production system, also that error message is not even existing in whole source code). Fun fact: there is no October CMS Version > 472 or >v1.1.5 ;-)
Workaround is to just git clone the Plugin directly into plugins directory inside the container and do a php artisan plugin:refresh RainLab.User
Any help appreciated - BR, Gladder
Getting the following when trying to run a simple php script that sends a mail - even just a php script that echo's "hello" does not seem to work:
But if I place say a text file in that exact same directory you see in the URL and try and access it via the web browser I am able to download/view the file.
What could be wrong here?
Forcing dependencies to use the same build 4a5e203 has proven to cause issues:
Instead of strictly adhering to the current October core build, should to something like '<=CURRENT_BUILD'.
This wouldn't resolve the issue encountered when a dependency version is bumped and Packagist isn't current at build time. However, that corner case seems to be mitigated by Automat's build interval.
when I was developing at local site. sometimes I need using ngrok to reflect the local environment to the outside world. but it seems it doesn't have some config that can let me to do this.
so How can I have 127.0.0.1:443 open?
ideally, if I can set ports at docker-compose file just like this:
ports:
- 80:80
- 443:443
it will be great.
I tried:
ports:
- 80:80
- 443:80
but the template still using http:// not https for the source files
When using GIT_CHECKOUT
or GIT_MERGE_PR
it's possible composer libraries have been updated. Warn the user if that's the case. Consider prompting user to run composer
The current method may cause conflicting dependencies.
I currently have a project with the Offline Mall plugin for OctoberCMS. When I try to access the checkout page I get an error. When I check the logs I the following error:
RuntimeException: Missing BC Math or GMP extension. in /var/www/html/plugins/offline/mall/vendor/hashids/hashids/src/Math.php:113
After some research it seems as the BC Math or GMP extension is not enabled. How can I go about enable these extensions in my docker image?
Hi,
Is there any way or plans to upgrade the docker container to october v1.1?
More info in the release notes.
docker-compose exec web php artisan october:up
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema =
octobercms and table_name = migrations)
Am I doing something wrong?
By default, cron does not care about the environment variables that are set in the Dockerfile. This means that all scheduled cronjobs will run with a completely different configuration ‒ in my case they run against the wrong database.
A workaround for this is to print all env variables to /etc/environment
where crontab will pick them up.
Adding this line to the entrypoint script will fix this problem:
printenv >> /etc/environment
I have used this docker package on a project with a custom plugin mapped as a volume. This plugin has a bunch of free marketplace plugins listed as dependencies in Plugin::$require
.
I was hoping octoberCMS would catch this on install, and add all the dependencies for my Plugin - but it's not that slick.
What is the recommended way to install a list of octoberCMS plugins on docker-compose up?
Try use you docker image for start working with octobercms.
Use docker-compose.yml from readme.md.
#docker-compose.yml
version: '3'
services:
web:
image: aspendigital/octobercms:build.431-php7.0-apache
ports:
- 127.0.0.1:4000:80
environment:
DB_TYPE: mysql
DB_HOST: mysql #DB_HOST should match the service name of the database container
DB_DATABASE: october
DB_USERNAME: october
DB_PASSWORD: Y5gExv_p
volumes:
- $PWD/october:/var/www/html/
mysql:
image: mysql:5.7
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: october
MYSQL_USER: october
MYSQL_PASSWORD: Y5gExv_p
I got success install containers and october not installed.
-rw-r--r-- 1 dimensi dimensi 631 feb 8 03:02 docker-compose.yml
drwxrwxrwx 2 dimensi dimensi 4096 feb 8 02:55 october
October dir is empty. What i do wrong?
I connect to container and cd to /var/www/html and this dir is empty too.
Hi Team,
Great work on the docker-octobercms I have 2 questions
Hello!
I see the difference in tags list in README and actual tags in Docker Hub. For example, https://registry.hub.docker.com/r/aspendigital/octobercms says build.473-php7.3-apache
tag exists, but it isn't. The last OctoberCMS version for the php7.3-apache
tag is 471: https://registry.hub.docker.com/r/aspendigital/octobercms/tags?page=1&ordering=last_updated&name=-php7.3-apache
Could you fix your image build scripts and publish tags with the 473 version of OctoberCMS?
Hello!
I am using traefik as my reverse-proxy and set its config as traefik.frontend.passHostHeader=true
. Although, I am always getting Invalid security token
error while logging into the backend.
Any suggestion to fix this?
Hi,
I'm trying to use the PHP 7.4-apache Dockerfile and I'm getting the following errors :
[RuntimeException] No composer.json present in the current directory, this may be the cause of the following exception.
[InvalidArgumentException]
Package hirak/prestissimo has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version
Basically it fails at this command :
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
I'm trying to build this with the whole PHP 7.4-apache folder.
Any ideas ?
Hi Aspendigital,
I like this docker image :)
Can we have a PHP 7.4 image?
Right now when I start the image it cannot load certain files.
PHP Fatal error: Class Illuminate\\Database\\Eloquent\\Collection contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Illuminate\\Contracts\\Queue\\QueueableCollection::getQueueableRelations) in /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php on line 11
this error is caused by the following read error:
PHP Fatal error: Uncaught Error: Class 'October\\Rain\\Database\\Collection' not found in /var/www/html/vendor/october/rain/src/Database/Model.php:608
Stack trace:
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(261): October\\Rain\\Database\\Model->newCollection(Array)
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1477): Illuminate\\Database\\Eloquent\\Builder->hydrate(Array)
#2 /var/www/html/vendor/october/rain/src/Extension/ExtendableTrait.php(411): Illuminate\\Database\\Eloquent\\Model->__call('hydrate', Array)
#3 /var/www/html/vendor/october/rain/src/Database/Model.php(635): October\\Rain\\Database\\Model->extendableCall('hydrate', Array)
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(481): October\\Rain\\Database\\Model->__call('hydrate', Array)
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(465): Illuminate\\Database\\Eloquent\\Builder->getModels(Array)
#6 /var/www/html/vendor/laravel in /var/www/html/vendor/october/rain/src/Database/Model.php on line 608
I can get it to work if I simply run composer install -o
once inside the container - which indicates to me that the composer autoloading seems to be broken in some way
No matter which tag I choose, this always installs the latest edge version of october.
For example, when running aspendigital/octobercms:build.455-php7.1-apache, the composer.json will contain the following dependencies:
"october/system": "~1.0"
This will result in the following resolved dependencies (composer.lock):
`
"name": "october/system",
"version": "v1.0.457",
"source": {
"type": "git",
"url": "https://github.com/octoberrain/system.git",
"reference": "55239f2d0113b5dac77fd9ff4d3f1a61525f348d"
}`
When testing queues, the October Drivers plugin is required. I addressed this by introducing a check to the entrypoint (3054d70), but still run into race conditions when multiple containers are used.
Instead of complicating the entrypoint further, I think I'll just take the hit on the image size required to bundle them in on build
When cron is enabled and scheduler is used in ocms, then the startup process blocks.
instead of
php artisan schedule:run # required to prime db connection
cron
echo 'Cron enabled.'
should be
echo 'Adding crontab job'
echo "* * * * * /usr/local/bin/php /var/www/html/artisan schedule:run > /proc/1/fd/1 2>/proc/1/fd/2" | tee -a /var/spool/cron/root
echo 'Starting cron service'
service cron start
echo 'Cron enabled.'
Permissions on files changed by running command line tasks has the potential to reset permissions as root:root (e.g. file based cache)
I'm proposing that this repo adds kubernetes charts for deploying october cms on kubernetes.
I'm happy to share my solution but i'm quite new to october cms and don't know all relevant files and configuration.
How to use Dockerfile for actual new version of October CMS?
How to rebuild this with version v.3.6.4?
Thanks! (Спасибо!)
Hey Guys,
Great job! Any chance you will create a dockerfile version for deployment to Google Cloud Run in the future?
Please update the README file and add a section where ssl is documented:
I've had a problem that my configuration in config/cms.php was overwritten by CMS_LINK_POLICY env of the docker image. Same goes for APP_URL etc.
when i try to : docker-compose exec web php artisan october:up
i got this message : Could not open input file: artisan
inside container var/www/html/ there is 3 folder only nothing else. no composer and artisan file
OC runs on Port 80 behind a reverse proxy (nginx container) with ssl termination which runs on port 8443.
I can get all content with https://:8443 but not the images stored in /var/www/html/storage/app/...
In all URLs, except for the storage urls, the port 8443 is present. See attached screenshot from the chrome web developer tools showing the urls.
my oc docker-compose.yml:
version: "3.8"
services:
web:
image: "aspendigital/octobercms:php7.4-apache"
container_name: "octobercms"
environment:
- DB_TYPE=mysql
- DB_HOST=mariadb
- DB_DATABASE=octobercms
- DB_USERNAME=octobercms
- DB_PASSWORD=octobercms
- CMS_LINK_POLICY=secure
- VIRTUAL_HOST=<external ip nginx proxy>
- VIRTUAL_PROTO=http
- VIRTUAL_PORT=8443
networks:
- "dmz"
volumes:
- /srv/octobercms/plugins:/var/www/html/plugins
- /srv/octobercms/storage/app:/var/www/html/storage/app
- /srv/octobercms/storage/logs:/var/www/html/storage/logs
- /srv/octobercms/themes:/var/www/html/themes
mariadb:
image: "mariadb:10.6.2"
container_name: "database"
restart: always
environment:
MYSQL_RANDOM_ROOT_PASSWORD: 1
MYSQL_DATABASE: octobercms
MYSQL_USER: octobercms
MYSQL_PASSWORD: octobercms
volumes:
- /srv/octobercms/mysql/data:/var/lib/mysql
networks:
- "dmz"
networks:
dmz:
external: true
my nginx docker-compose.yml:
version: "3.8"
services:
reverse-proxy:
build: .
container_name: "reverse-proxy"
restart: "always"
networks:
- "dmz"
ports:
- "8443:8443"
networks:
dmz:
external: true
nginx.conf server block:
server {
listen 8443 ssl;
server_name <external ip>;
ssl_certificate /etc/ssl/certificate.pem;
ssl_certificate_key /etc/ssl/certificate.key;
location / {
proxy_pass "http://octobercms:80";
proxy_set_header Host $host;
proxy_cache off;
}
}
Trips after trying to run php artisan tinker
after closing a previous tinker session:
[ErrorException] rmdir(/tmp/php-xdg-runtime-dir-fallback-): Directory not empty
It looks like the issue is limited to php7.1 and should be addressed with the next update from the psysh maintainer: bobthecow/psysh#430 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.