systemsdk / docker-nginx-php-laravel Goto Github PK
View Code? Open in Web Editor NEWDocker environment required to run Laravel (based on official php and mysql docker hub repositories)
License: MIT License
Docker environment required to run Laravel (based on official php and mysql docker hub repositories)
License: MIT License
I see in the nginx Dockerfile that it attempts to run openssl an generates a key.pem and cert.key with some default settings including the domain "example.cn".
I tried to modify this to my own domain.
After doing make start
I checked and there's no directory /etc/nginx/certificates
that the Dockerfile specifies. I can't find any certificate files.
How do we get it to generate the certificate?
Firstly, I'd like to say that I am using "docker compose" instead of "docker-compose" (I ammended the Makefile), I am not sure that is the problem though.
After I run make build && make start, all the containers start ok, however the only files that are copied over are docker/dev/init-db.sql and the storage/mysql-data folder, resulting in a 404 from nginx (i am guessing because of the missing files).
I am running Linux Ubuntu 22.04, Docker 4.17.0, docker compose v2.16.0.
Any ideas on how to solve this would be greatly appreciated, thanks!
i can connect through terminal by using
mysql -h mysql -u root -psecret laravel
but when i try to connect to dbbeaver i get connection refused.
what is the issue?
I just set this up and am following the directions. I'm getting an error when attempting to run make migrate
. It's giving me this error:
SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')
I checked the information_schema
database tables
table and the row is in fact there. The migrations table is in fact in the database.
I can't seem to get past this. Any ideas?
I can connect to the database using my SequelAce app from my local system.
I have done all levels and I haven't reveiced any errors but I dont know how it will be going to exec?
I enter on my browser -> 127.0.0.1 or localhost but it doesnt execute
How I can have domain and subdomain for examle my blog in a WordPress website and I wanna have blog.site.com
where I should config it?
Hello,
I am curious as to why we need to run composer install
inside the Docker file if it will be overwritten with volumes.
when we build the docker this will run first
# copy source files and config file
COPY --chown=${USERNAME}:${USERNAME} . $APP_HOME/
COPY --chown=${USERNAME}:${USERNAME} .env.$ENV $APP_HOME/.env
# install all PHP dependencies
RUN if [ "$BUILD_ARGUMENT_ENV" = "dev" ] || [ "$BUILD_ARGUMENT_ENV" = "test" ]; then COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress; \
else COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress --no-dev; \
fi
and this will copy the local files and overwrite what we did in the previous step in the docker file
docker-compose-yaml
NGINX: volumes:
- .:/var/www/html:ro,cached
LARAVEL: volumes:
- .:/var/www/html:cached
How can I composer require a private repo?
I have been using version 1.0, when I upgraded to the latest version, I got this error.
[emerg] 1#1: host not found in upstream "laravel" in /etc/nginx/conf.d/default.conf:59
I have a problem in the server when I wanna connect database it says for example
SQLSTATE[HY000] [1045] Access denied for user 'database'@'111.111.112.4'
but my IP has changed and now is 111.111.112.1
How can I fix this problem?
Service 'nginx' failed to build: The command '/bin/sh -c apk add --update openssl && rm -rf /var/cache/apk/*' returned a non-zero code: 1
How do I run "npm run build" or vite build from the containter?
They appear to be missing.
I'm trying to install php-dev package.
But when I try, I get an error "php-dev has no installation candidate".
Maybe you can tell me what can be done to solve this problem
I see that there is configuration for Redis in the .env files but Redis doesn't appear to be part of the package. Is there a simple way to add this? I've added the predis/predis composer package but I don't think that it's installed.
Your docker is very good, but why not create a empty Docker minimal for install manually a Laravel for example 5.8, 6.0, etc. without package extra?
Good job.
I got this error
ERROR: Service 'supervisord' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder107125242/docker/dev/www.conf: no such file or directory
Greetings gentlemen!
First of all, I would like to express my gratitude for the excellent repository.
I encountered the following issue:
If the Dockerfile configuration specifies
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
the "make build" command fails with an
ERROR [stage-0 19/19] RUN if [ "dev" = "dev 0.5s
------
> [stage-0 19/19] RUN if [ "dev" = "dev" ] || [ "dev" = "test" ]; then COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress; else COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress --no-dev; fi:
0.372 PHP Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, bool given in phar:///usr/bin/composer/src/Composer/Config.php:191
0.372 Stack trace:
0.372 #0 phar:///usr/bin/composer/src/Composer/Config.php(191): array_merge(true, Array, true)
0.372 #1 phar:///usr/bin/composer/src/Composer/Factory.php(350): Composer\Config->merge(Array, './composer.json')
0.372 #2 phar:///usr/bin/composer/src/Composer/Factory.php(643): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false, '/var/www/html', true, false)
0.372 #3 phar:///usr/bin/composer/src/Composer/Console/Application.php(445): Composer\Factory::create(Object(Composer\IO\ConsoleIO), NULL, false, false)
0.372 #4 phar:///usr/bin/composer/src/Composer/Command/BaseCommand.php(65): Composer\Console\Application->getComposer(false, false, false)
0.372 #5 phar:///usr/bin/composer/src/Composer/Command/BaseCommand.php(150): Composer\Command\BaseCommand->getComposer(false, false, false)
0.372 #6 phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php(211): Composer\Command\BaseCommand->initialize(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #7 phar:///usr/bin/composer/vendor/symfony/console/Application.php(835): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #8 phar:///usr/bin/composer/vendor/symfony/console/Application.php(185): Symfony\Component\Console\Application->doRunCommand(Object(Composer\Command\InstallCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #9 phar:///usr/bin/composer/src/Composer/Console/Application.php(336): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #10 phar:///usr/bin/composer/vendor/symfony/console/Application.php(117): Composer\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #11 phar:///usr/bin/composer/src/Composer/Console/Application.php(131): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #12 phar:///usr/bin/composer/bin/composer(73): Composer\Console\Application->run()
0.372 #13 /usr/bin/composer(29): require('phar:///usr/bin...')
0.372 #14 {main}
0.372 thrown in phar:///usr/bin/composer/src/Composer/Config.php on line 191
0.372
0.372 Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, bool given in phar:///usr/bin/composer/src/Composer/Config.php:191
0.372 Stack trace:
0.372 #0 phar:///usr/bin/composer/src/Composer/Config.php(191): array_merge(true, Array, true)
0.372 #1 phar:///usr/bin/composer/src/Composer/Factory.php(350): Composer\Config->merge(Array, './composer.json')
0.372 #2 phar:///usr/bin/composer/src/Composer/Factory.php(643): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false, '/var/www/html', true, false)
0.372 #3 phar:///usr/bin/composer/src/Composer/Console/Application.php(445): Composer\Factory::create(Object(Composer\IO\ConsoleIO), NULL, false, false)
0.372 #4 phar:///usr/bin/composer/src/Composer/Command/BaseCommand.php(65): Composer\Console\Application->getComposer(false, false, false)
0.372 #5 phar:///usr/bin/composer/src/Composer/Command/BaseCommand.php(150): Composer\Command\BaseCommand->getComposer(false, false, false)
0.372 #6 phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php(211): Composer\Command\BaseCommand->initialize(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #7 phar:///usr/bin/composer/vendor/symfony/console/Application.php(835): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #8 phar:///usr/bin/composer/vendor/symfony/console/Application.php(185): Symfony\Component\Console\Application->doRunCommand(Object(Composer\Command\InstallCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #9 phar:///usr/bin/composer/src/Composer/Console/Application.php(336): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #10 phar:///usr/bin/composer/vendor/symfony/console/Application.php(117): Composer\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #11 phar:///usr/bin/composer/src/Composer/Console/Application.php(131): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.372 #12 phar:///usr/bin/composer/bin/composer(73): Composer\Console\Application->run()
0.372 #13 /usr/bin/composer(29): require('phar:///usr/bin...')
0.372 #14 {main}
0.372 thrown in phar:///usr/bin/composer/src/Composer/Config.php on line 191
------
Dockerfile:89
--------------------
88 | # install all PHP dependencies
89 | >>> RUN if [ "$BUILD_ARGUMENT_ENV" = "dev" ] || [ "$BUILD_ARGUMENT_ENV" = "test" ]; then COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress; \
90 | >>> else COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress --no-dev; \
91 | >>> fi
92 |
However, if a specific version of Composer is specified, everything works as expected:
COPY --from=composer:2.6 /usr/bin/composer /usr/bin/composer
How can I add a domain name? Which will not conflict with local machine 127.0.0.1. Thanks
Thank you dear friend for making this excellent project. I have used it and its so nice
I have a question . how we can use and write cron jobs when we have this structure. is it different with normal project?
Greetings gentlemen!
I followed the step to step guide to set up the dev environment on my local, which is:
Everything was okay, free of errors until I ran make start
.
All the containers are running, then in 3 seconds, the MySQL container stopped.
The error message basically says the table is not there and I should upgrade MySQL. I searched online there are some answers said to bash into MySQL then upgrade, but I can' t bash into it if it is not running.
[ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
What should I do? Thanks for your time! Full output below:
2023-03-20 09:07:46 2023-03-19T22:07:46.008652Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22) starting as process 1
2023-03-20 09:07:46 2023-03-19T22:07:46.012906Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2023-03-20 09:07:46 2023-03-19T22:07:46.024971Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-03-20 09:07:46 2023-03-19T22:07:46.508481Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-03-20 09:07:46 mysqld: Table 'mysql.plugin' doesn't exist
2023-03-20 09:07:46 2023-03-19T22:07:46.589252Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2023-03-20 09:07:46 2023-03-19T22:07:46.593150Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2023-03-20 09:07:46 2023-03-19T22:07:46.617007Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2023-03-20 09:07:46 2023-03-19T22:07:46.669005Z 0 [Warning] [MY-000054] [Server] World-writable config file './auto.cnf' is ignored.
2023-03-20 09:07:46 2023-03-19T22:07:46.670086Z 0 [Warning] [MY-010107] [Server] World-writable config file './auto.cnf' has been removed.
2023-03-20 09:07:46 2023-03-19T22:07:46.670584Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 7addb6cb-c6a2-11ed-8124-0242ac1f0002.
2023-03-20 09:07:46 2023-03-19T22:07:46.691036Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2023-03-20 09:07:46 2023-03-19T22:07:46.696229Z 0 [Warning] [MY-013595] [Server] Failed to initialize TLS for channel: mysql_main. See below for the description of exact issue.
2023-03-20 09:07:46 2023-03-19T22:07:46.696372Z 0 [Warning] [MY-010069] [Server] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2023-03-20 09:07:46 2023-03-19T22:07:46.698509Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2023-03-20 09:07:46 2023-03-19T22:07:46.699673Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2023-03-20 09:07:46 2023-03-19T22:07:46.702769Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2023-03-20 09:07:46 2023-03-19T22:07:46.703131Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2023-03-20 09:07:46 2023-03-19T22:07:46.703383Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
2023-03-20 09:07:46 2023-03-19T22:07:46.703527Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
2023-03-20 09:07:46 2023-03-19T22:07:46.703957Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2023-03-20 09:07:46 2023-03-19T22:07:46.704122Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
2023-03-20 09:07:46 2023-03-19T22:07:46.704443Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-03-20 09:07:48 2023-03-19T22:07:48.165181Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22) MySQL Community Server - GPL.
2023-03-20 09:07:45 2023-03-19 22:07:45+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2023-03-20 09:07:45 2023-03-19 22:07:45+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-03-20 09:07:45 2023-03-19 22:07:45+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
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.