Compare commits
No commits in common. "3777c45c1601fc7e58ec14dc0a6f031b74ffffaf" and "3fc98af139e3f776f971c5047ec73d57c9152077" have entirely different histories.
3777c45c16
...
3fc98af139
@ -1,31 +0,0 @@
|
|||||||
server {
|
|
||||||
root /var/www/front/public/;
|
|
||||||
|
|
||||||
server_name cojedzie.localhost;
|
|
||||||
|
|
||||||
location /_profiler/ {
|
|
||||||
try_files $uri $uri/ @api;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /bundles/ {
|
|
||||||
try_files $uri $uri/ @api;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /api/ {
|
|
||||||
try_files $uri $uri/ @api;
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ @frontend;
|
|
||||||
}
|
|
||||||
|
|
||||||
location @frontend {
|
|
||||||
proxy_pass http://frontend:3000;
|
|
||||||
proxy_intercept_errors on;
|
|
||||||
}
|
|
||||||
|
|
||||||
location @api {
|
|
||||||
proxy_pass http://api:8080;
|
|
||||||
proxy_intercept_errors on;
|
|
||||||
}
|
|
||||||
}
|
|
71
CLA.md
71
CLA.md
@ -1,71 +0,0 @@
|
|||||||
# Co Jedzie Individual Contributor License Agreement
|
|
||||||
|
|
||||||
Adapted from http://www.apache.org/licenses/icla.txt © The Apache Software Foundation
|
|
||||||
|
|
||||||
Thank you for your interest in Co Jedzie (the **"Project"**) by Kacper Donat (the **"Author"**). In order to clarify the
|
|
||||||
intellectual property license granted with Contributions from any person or entity, the Author must have a Contributor
|
|
||||||
License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms
|
|
||||||
below. This license is for your protection as a Contributor as well as the protection of the Author and its users; it
|
|
||||||
does not change your rights to use your own Contributions for any other purpose.
|
|
||||||
|
|
||||||
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the
|
|
||||||
Author. In return, the Author shall not use Your Contributions in a way that is contrary to the public benefit or
|
|
||||||
inconsistent with its bylaws in effect at the time of the Contribution. Except for the license granted herein to the
|
|
||||||
Author and recipients of software distributed by the Author, You reserve all right, title, and interest in and to Your
|
|
||||||
Contributions.
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
- **"You"** (or **"Your"**) shall mean the copyright owner or legal entity authorized by the copyright owner that is
|
|
||||||
making this Agreement with the Author. For legal entities, the entity making a Contribution and all other entities
|
|
||||||
that control, are controlled by, or are under common control with that entity are considered to be a single
|
|
||||||
Contributor. For the purposes of this definition, **"control"** means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or
|
|
||||||
more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
- **"Contribution"** shall mean any original work of authorship, including any modifications or additions to an existing
|
|
||||||
work, that is intentionally submitted by You to the Author for inclusion in, or documentation of, any of the products
|
|
||||||
owned or managed by the Author (the **"Work"**). For the purposes of this definition, **"submitted"** means any form
|
|
||||||
of electronic, verbal, or written communication sent to the Author or its representatives, including but not limited
|
|
||||||
to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed
|
|
||||||
by, or on behalf of, the Author for the purpose of discussing and improving the Work, but excluding communication that
|
|
||||||
is conspicuously marked or otherwise designated in writing by You as **"Not a Contribution."**
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to the Author and
|
|
||||||
to recipients of software distributed by the Author a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
||||||
irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform,
|
|
||||||
sublicense, re-license, and distribute Your Contributions and such derivative works.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to the Author and to
|
|
||||||
recipients of software distributed by the Author a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
||||||
irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import,
|
|
||||||
and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are
|
|
||||||
necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which
|
|
||||||
such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (
|
|
||||||
including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have
|
|
||||||
contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity
|
|
||||||
under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to
|
|
||||||
intellectual property that you create that includes your Contributions, you represent that you have received
|
|
||||||
permission to make Contributions on behalf of that employer, that your employer has waived such rights for your
|
|
||||||
Contributions to the Author, or that your employer has executed a separate Corporate CLA with the Author.
|
|
||||||
|
|
||||||
5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of
|
|
||||||
others). You represent that Your Contribution submissions include complete details of any third-party license or
|
|
||||||
other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware
|
|
||||||
and which are associated with any part of Your Contributions.
|
|
||||||
|
|
||||||
6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support.
|
|
||||||
You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in
|
|
||||||
writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
||||||
express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT,
|
|
||||||
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
7. Should You wish to submit work that is not Your original creation, You may submit it to the Author separately from
|
|
||||||
any Contribution, identifying the complete details of its source and of any license or other restriction (including,
|
|
||||||
but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and
|
|
||||||
conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
|
|
||||||
|
|
||||||
8. You agree to notify the Author of any facts or circumstances of which you become aware that would make these
|
|
||||||
representations inaccurate in any respect.
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
# How to contribute?
|
|
||||||
|
|
||||||
Thanks for your interest in the project!
|
|
||||||
|
|
||||||
## I'd like to propose some feature / change...
|
|
||||||
|
|
||||||
Cool! Go ahead, [create an issue] and describe your proposal so anyone can see it. You can also vote on features that
|
|
||||||
you want the most.
|
|
||||||
|
|
||||||
## I've found a bug!
|
|
||||||
|
|
||||||
Well, less cool! Before creating an issue, please check if the bug remains after hard refreshing (usually `ctrl+F5`) the
|
|
||||||
application. If the answer is yes, or this is not the first encounter of it please [create an issue] and describe the
|
|
||||||
problem. If you can, please attach screenshots (especially if this is visual bug), and console logs (especially for
|
|
||||||
connection problems) - this will help to reproduce the problem.
|
|
||||||
|
|
||||||
## I've got some spare resources on my server...
|
|
||||||
Soon you will be able to help the project by hosting your own API node that will be available for clients to use.
|
|
||||||
More details to come soon.
|
|
||||||
|
|
||||||
## I want to contribute some code...
|
|
||||||
|
|
||||||
That's great! If you want to make changes to API (which is responsible for collecting and supplying applicaiton with
|
|
||||||
data) please check the [API contribution guidelines], if you are interested in UI side of the app please read the
|
|
||||||
[frontend contribution guidelines].
|
|
||||||
|
|
||||||
### Contributor License Agreement
|
|
||||||
|
|
||||||
Unfortunately due to this project nature and license I need you to sign [Contributor License Agreement] - the nice thing
|
|
||||||
is that it can be done with simple push of a button! **You still will have full copyright to your contribution** but
|
|
||||||
basically you consent that you are entitled to code you are submitting and also to allow me to license this project on
|
|
||||||
other terms if needed to, for example, local governments. If you don't want to sign - I understand - but I won't be able
|
|
||||||
to accept your contribution :(
|
|
||||||
|
|
||||||
[Contributor License Agreement]: ./CLA.md
|
|
||||||
[create an issue]: https://github.com/cojedzie/cojedzie/issues/new
|
|
||||||
[API contribution guidelines]: ./api/CONTRIBUTING.md
|
|
||||||
[frontend contribution guidelines]: ./front/CONTRIBUTING.md
|
|
17
README.md
17
README.md
@ -7,26 +7,19 @@ aims to be the central hub for all public transport information you will need.
|
|||||||
|
|
||||||
You can use the app at [cojedzie.pl](https://cojedzie.pl).
|
You can use the app at [cojedzie.pl](https://cojedzie.pl).
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
Want to contribute?
|
||||||
|
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
Co Jedzie is in active development, roadmap of the project can be found on [trello]. This roadmap is regularly updated
|
Co Jedzie is in active development, roadmap of the project can be found on [trello]. This roadmap is regularly updated
|
||||||
and represents current state of the project. Feel free to take a look.
|
and represents current state of the project. Feel free to take a look.
|
||||||
|
|
||||||
### Contributing to roadmap
|
|
||||||
If you have found a bug or want to propose some changes feel free to create an [issue] explaining your proposal or
|
|
||||||
problem. Issue management and discussion would be done on the github, but planning will be carried away to the [trello]
|
|
||||||
trello with linked issue.
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
Wan't to contribute? Nice! Please see [CONTRIBUTING.md]
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
This project is [fair-code](https://faircode.io/) licensed under [MIT with Commons Clause](./LICENSE.md). Basically, Co
|
This project is [fair-code](https://faircode.io/) licensed under [MIT with Commons Clause](./LICENSE.md). Basically, Co
|
||||||
Jedzie is free and code is available to everyone, but it's not allowed to make money directly with it without
|
Jedzie is free and code is available to everyone, but it's not allowed to make money directly with it.
|
||||||
authors permission.
|
|
||||||
|
|
||||||
Note that data collected from available data sources is licensed by their respective owners, thus it may be
|
Note that data collected from available data sources is licensed by their respective owners, thus it may be
|
||||||
available under different terms than the project itself and may require additional permissions to use.
|
available under different terms than the project itself and may require additional permissions to use.
|
||||||
|
|
||||||
[trello]: https://trello.com/b/QXqDvmoG/co-jedzie
|
[trello]: https://trello.com/b/QXqDvmoG/co-jedzie
|
||||||
[issue]: https://github.com/cojedzie/cojedzie/issues/new
|
|
||||||
[CONTRIBUTING.md]: ./CONTRIBUTING.md
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
# Contributing guidelines
|
|
||||||
|
|
||||||
TBD
|
|
@ -1,5 +1,7 @@
|
|||||||
FROM php:7.4-fpm-alpine
|
FROM php:7.4-fpm-alpine
|
||||||
|
|
||||||
|
ENV DATABASE_URL="sqlite:///var/db/app.db"
|
||||||
|
|
||||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
FROM cojedzie/api:latest-rr
|
|
||||||
|
|
||||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
|
||||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
||||||
|
|
||||||
RUN install-php-extensions xdebug-^3.0;
|
|
||||||
RUN apk add git;
|
|
||||||
|
|
||||||
# XDebug
|
|
||||||
RUN echo "xdebug.mode=debug" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini && \
|
|
||||||
echo "xdebug.client_host=172.17.0.1" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini && \
|
|
||||||
echo "xdebug.start_with_request=On" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini;
|
|
||||||
|
|
||||||
# Blackfire
|
|
||||||
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
|
|
||||||
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
|
|
||||||
&& mkdir -p /tmp/blackfire \
|
|
||||||
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
|
|
||||||
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
|
|
||||||
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
|
|
||||||
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
|
|
||||||
|
|
||||||
# Timezone
|
|
||||||
RUN ln -snf /usr/share/zoneinfo/Europe/Warsaw /etc/localtime && \
|
|
||||||
echo "date.timezone = Europe/Warsaw" >> /usr/local/etc/php/conf.d/datetime.ini;
|
|
||||||
|
|
||||||
WORKDIR /var/www
|
|
||||||
|
|
||||||
EXPOSE 9001
|
|
@ -29,7 +29,7 @@ class WithDestinationsDatabaseHandler implements PostProcessingHandler
|
|||||||
|
|
||||||
if ($this->converter instanceof CacheableConverter) {
|
if ($this->converter instanceof CacheableConverter) {
|
||||||
$this->converter = clone $this->converter;
|
$this->converter = clone $this->converter;
|
||||||
$this->converter->reset();
|
$this->converter->flushCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@ class ZtmGdanskProvider implements Provider
|
|||||||
private $stops;
|
private $stops;
|
||||||
private $tracks;
|
private $tracks;
|
||||||
private $messages;
|
private $messages;
|
||||||
private $trips;
|
|
||||||
|
|
||||||
private ProviderEntity $entity;
|
/** @var ProviderEntity */
|
||||||
private EntityManagerInterface $em;
|
private $entity;
|
||||||
|
private $trips;
|
||||||
|
|
||||||
public function getName(): string
|
public function getName(): string
|
||||||
{
|
{
|
||||||
@ -68,9 +68,7 @@ class ZtmGdanskProvider implements Provider
|
|||||||
ZtmGdanskMessageRepository $messages,
|
ZtmGdanskMessageRepository $messages,
|
||||||
ReferenceFactory $referenceFactory
|
ReferenceFactory $referenceFactory
|
||||||
) {
|
) {
|
||||||
$this->em = $em;
|
$provider = $em->getReference(ProviderEntity::class, $this->getIdentifier());
|
||||||
|
|
||||||
$provider = $this->refreshProviderEntity();
|
|
||||||
|
|
||||||
$lines = $lines->withProvider($provider);
|
$lines = $lines->withProvider($provider);
|
||||||
$stops = $stops->withProvider($provider);
|
$stops = $stops->withProvider($provider);
|
||||||
@ -119,13 +117,6 @@ class ZtmGdanskProvider implements Provider
|
|||||||
|
|
||||||
public function getLastUpdate(): ?Carbon
|
public function getLastUpdate(): ?Carbon
|
||||||
{
|
{
|
||||||
$this->refreshProviderEntity();
|
|
||||||
|
|
||||||
return $this->entity->getUpdateDate();
|
return $this->entity->getUpdateDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function refreshProviderEntity(): ProviderEntity
|
|
||||||
{
|
|
||||||
return $this->entity = $this->em->getReference(ProviderEntity::class, $this->getIdentifier());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class AggregateConverter implements Converter, CacheableConverter
|
|||||||
return clone $this->cachedConverters;
|
return clone $this->cachedConverters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reset()
|
public function flushCache()
|
||||||
{
|
{
|
||||||
$this->ensureCachedConverters();
|
$this->ensureCachedConverters();
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class AggregateConverter implements Converter, CacheableConverter
|
|||||||
->cachedConverters
|
->cachedConverters
|
||||||
->filter(instance(CacheableConverter::class))
|
->filter(instance(CacheableConverter::class))
|
||||||
->each(function (CacheableConverter $converter) {
|
->each(function (CacheableConverter $converter) {
|
||||||
$converter->reset();
|
$converter->flushCache();
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use Symfony\Contracts\Service\ResetInterface;
|
interface CacheableConverter extends Converter
|
||||||
|
|
||||||
interface CacheableConverter extends Converter, ResetInterface
|
|
||||||
{
|
{
|
||||||
|
public function flushCache();
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use App\Entity\{Entity, LineEntity, OperatorEntity, StopEntity, TrackEntity, TripEntity};
|
use App\Entity\{Entity, LineEntity, OperatorEntity, StopEntity, TrackEntity, TripEntity, TripStopEntity};
|
||||||
use App\Model\{Line, Location, Operator, ScheduledStop, Stop, Track, Trip};
|
use App\Model\{Line, Location, Operator, ScheduledStop, Stop, Track, Trip};
|
||||||
use App\Service\Proxy\ReferenceFactory;
|
use App\Service\Proxy\ReferenceFactory;
|
||||||
use Doctrine\ORM\PersistentCollection;
|
use Doctrine\ORM\PersistentCollection;
|
||||||
use Doctrine\ORM\Proxy\Proxy;
|
use Doctrine\ORM\Proxy\Proxy;
|
||||||
|
use Kadet\Functional as f;
|
||||||
use Kadet\Functional\Transforms as t;
|
use Kadet\Functional\Transforms as t;
|
||||||
|
use const Kadet\Functional\_;
|
||||||
|
|
||||||
final class EntityConverter implements Converter, RecursiveConverter, CacheableConverter
|
final class EntityConverter implements Converter, RecursiveConverter, CacheableConverter
|
||||||
{
|
{
|
||||||
@ -175,7 +177,7 @@ final class EntityConverter implements Converter, RecursiveConverter, CacheableC
|
|||||||
return $entity instanceof Entity;
|
return $entity instanceof Entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reset()
|
public function flushCache()
|
||||||
{
|
{
|
||||||
$this->cache = [];
|
$this->cache = [];
|
||||||
}
|
}
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Subscriber;
|
|
||||||
|
|
||||||
use App\Service\Converter;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
||||||
use Symfony\Component\HttpKernel\Event\TerminateEvent;
|
|
||||||
use Symfony\Component\HttpKernel\KernelEvents;
|
|
||||||
use Symfony\Contracts\Service\ResetInterface;
|
|
||||||
|
|
||||||
class RequestCleanupSubscriber implements EventSubscriberInterface
|
|
||||||
{
|
|
||||||
/** @var ContainerInterface */
|
|
||||||
private ContainerInterface $container;
|
|
||||||
private Converter $converter;
|
|
||||||
|
|
||||||
public function __construct(ContainerInterface $container, Converter $converter)
|
|
||||||
{
|
|
||||||
$this->container = $container;
|
|
||||||
$this->converter = $converter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getSubscribedEvents()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
KernelEvents::TERMINATE => ['onTerminate']
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function onTerminate(TerminateEvent $event)
|
|
||||||
{
|
|
||||||
$this->container->get('doctrine')->reset();
|
|
||||||
|
|
||||||
if ($this->converter instanceof ResetInterface) {
|
|
||||||
$this->converter->reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,24 @@
|
|||||||
ARG BASE_VERSION=latest
|
ARG BASE_VERSION=latest
|
||||||
ARG REGISTRY=docker.io
|
ARG REGISTRY=docker.io
|
||||||
|
|
||||||
FROM $REGISTRY/cojedzie/base:${BASE_VERSION}-fpm as base
|
FROM $REGISTRY/cojedzie/base:$BASE_VERSION as base
|
||||||
|
|
||||||
|
FROM php:7.4-fpm-alpine
|
||||||
|
|
||||||
|
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
||||||
|
|
||||||
|
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||||
|
|
||||||
|
WORKDIR /var/www
|
||||||
|
|
||||||
|
RUN install-php-extensions bcmath intl opcache zip sockets;
|
||||||
|
|
||||||
|
COPY --from=base /var/www /var/www
|
||||||
|
|
||||||
|
ENV APP_ENV=prod
|
||||||
|
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
||||||
|
ENV PATH=$PATH:/var/www/bin
|
||||||
|
|
||||||
|
VOLUME /var/db
|
||||||
|
|
||||||
CMD ["./bin/docker-init.sh", "php-fpm"]
|
CMD ["./bin/docker-init.sh", "php-fpm"]
|
||||||
|
@ -1,10 +1,26 @@
|
|||||||
ARG BASE_VERSION=latest
|
ARG BASE_VERSION=latest
|
||||||
ARG REGISTRY=docker.io
|
ARG REGISTRY=docker.io
|
||||||
|
|
||||||
FROM $REGISTRY/cojedzie/base:${BASE_VERSION} as base
|
FROM $REGISTRY/cojedzie/base:$BASE_VERSION as base
|
||||||
|
|
||||||
COPY --from=spiralscout/roadrunner:1.9.2 /usr/bin/rr /usr/bin/rr
|
FROM php:7.4-alpine
|
||||||
|
|
||||||
|
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
||||||
|
|
||||||
|
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||||
|
|
||||||
|
WORKDIR /var/www
|
||||||
|
|
||||||
|
RUN install-php-extensions bcmath intl opcache zip sockets;
|
||||||
|
|
||||||
|
COPY --from=base /var/www /var/www
|
||||||
|
|
||||||
|
ENV APP_ENV=prod
|
||||||
|
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
||||||
|
ENV PATH=$PATH:/var/www/bin
|
||||||
|
|
||||||
|
VOLUME /var/db
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD ["./bin/docker-init.sh", "rr", "serve", "-v"]
|
CMD ["./bin/docker-init.sh", "rr", "serve"]
|
||||||
|
@ -21,12 +21,8 @@ RUN apk add git && \
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
ENV APP_ENV=prod
|
ENV APP_ENV=prod
|
||||||
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
|
||||||
ENV PATH=$PATH:/var/www/bin
|
|
||||||
|
|
||||||
RUN composer run-script post-install-cmd
|
RUN composer run-script post-install-cmd
|
||||||
|
|
||||||
VOLUME /var/db
|
|
||||||
|
|
||||||
# This image is not meant to be run, just to prepare all required files
|
# This image is not meant to be run, just to prepare all required files
|
||||||
CMD ["/bin/false"]
|
CMD ["/bin/false"]
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
ARG BASE_VERSION=latest
|
|
||||||
ARG REGISTRY=docker.io
|
|
||||||
|
|
||||||
FROM $REGISTRY/cojedzie/base:$BASE_VERSION as base
|
|
||||||
|
|
||||||
FROM php:7.4-cli-alpine
|
|
||||||
|
|
||||||
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
|
||||||
|
|
||||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
|
||||||
|
|
||||||
WORKDIR /var/www
|
|
||||||
|
|
||||||
RUN install-php-extensions bcmath intl opcache zip sockets;
|
|
||||||
|
|
||||||
COPY composer.json composer.lock ./
|
|
||||||
|
|
||||||
COPY --from=base /var/www /var/www
|
|
||||||
|
|
||||||
ENV APP_ENV=prod
|
|
||||||
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
|
||||||
ENV PATH=$PATH:/var/www/bin
|
|
||||||
|
|
||||||
VOLUME /var/db
|
|
||||||
|
|
||||||
# This image is not meant to be run, just to prepare all required files
|
|
||||||
CMD ["/bin/false"]
|
|
@ -1,27 +0,0 @@
|
|||||||
ARG BASE_VERSION=latest
|
|
||||||
ARG REGISTRY=docker.io
|
|
||||||
|
|
||||||
FROM $REGISTRY/cojedzie/base:$BASE_VERSION as base
|
|
||||||
|
|
||||||
FROM php:7.4-fpm-alpine
|
|
||||||
|
|
||||||
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
|
||||||
|
|
||||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
|
||||||
|
|
||||||
WORKDIR /var/www
|
|
||||||
|
|
||||||
RUN install-php-extensions bcmath intl opcache zip sockets;
|
|
||||||
|
|
||||||
COPY composer.json composer.lock ./
|
|
||||||
|
|
||||||
COPY --from=base /var/www /var/www
|
|
||||||
|
|
||||||
ENV APP_ENV=prod
|
|
||||||
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
|
||||||
ENV PATH=$PATH:/var/www/bin
|
|
||||||
|
|
||||||
VOLUME /var/db
|
|
||||||
|
|
||||||
# This image is not meant to be run, just to prepare all required files
|
|
||||||
CMD ["/bin/false"]
|
|
@ -135,22 +135,20 @@ fi
|
|||||||
|
|
||||||
if [ $BUILD_BASE -eq 1 ]; then
|
if [ $BUILD_BASE -eq 1 ]; then
|
||||||
build --no-register base $ROOT/api/ || exit 1
|
build --no-register base $ROOT/api/ || exit 1
|
||||||
build --no-register --variant fpm base $ROOT/api/ || exit 1
|
|
||||||
build --no-register --variant cli base $ROOT/api/ || exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
api)
|
api)
|
||||||
build api $BUILD/api/ --variant rr --default || exit 1
|
build api $ROOT/api/ --variant rr --default || exit 1
|
||||||
build api $BUILD/api/ --variant fpm || exit 1
|
build api $ROOT/api/ --variant fpm || exit 1
|
||||||
;;
|
;;
|
||||||
standalone)
|
standalone)
|
||||||
build standalone $BUILD/standalone/ --variant rr --default || exit 1
|
build standalone $ROOT/api/ --variant rr --default || exit 1
|
||||||
;;
|
;;
|
||||||
worker)
|
worker)
|
||||||
build worker $BUILD/worker/ || exit 1
|
build worker $ROOT/api/ || exit 1
|
||||||
;;
|
;;
|
||||||
front)
|
front)
|
||||||
build front $ROOT/front/ || exit 1
|
build front $ROOT/front/ || exit 1
|
||||||
|
@ -3,14 +3,13 @@ ARG REGISTRY=docker.io
|
|||||||
|
|
||||||
FROM ${REGISTRY}/cojedzie/api:${BASE_VERSION}-rr
|
FROM ${REGISTRY}/cojedzie/api:${BASE_VERSION}-rr
|
||||||
|
|
||||||
# escape=`
|
RUN apk add supervisor && \
|
||||||
RUN apk add supervisor gettext && \
|
|
||||||
{ \
|
{ \
|
||||||
echo '[supervisord]'; \
|
echo '[supervisord]'; \
|
||||||
echo 'nodaemon=true'; \
|
echo 'nodaemon=true'; \
|
||||||
echo ; \
|
echo ; \
|
||||||
echo '[program:roadrunner]'; \
|
echo '[program:roadrunner]'; \
|
||||||
echo 'command=rr serve -v'; \
|
echo 'command=rr serve'; \
|
||||||
echo 'startsecs=0'; \
|
echo 'startsecs=0'; \
|
||||||
echo 'start=true'; \
|
echo 'start=true'; \
|
||||||
echo 'autorestart=true'; \
|
echo 'autorestart=true'; \
|
||||||
@ -20,7 +19,7 @@ RUN apk add supervisor gettext && \
|
|||||||
echo 'stderr_logfile_maxbytes=0'; \
|
echo 'stderr_logfile_maxbytes=0'; \
|
||||||
echo ; \
|
echo ; \
|
||||||
echo '[program:messenger-consumer]'; \
|
echo '[program:messenger-consumer]'; \
|
||||||
echo 'command=php /var/www/bin/console messenger:consume $COJEDZIE_WORKER_OPTS $COJEDZIE_WORKER_QUEUES'; \
|
echo 'command=php /var/www/bin/console messenger:consume main -vv --time-limit=86400 --limit=10'; \
|
||||||
echo 'startsecs=0'; \
|
echo 'startsecs=0'; \
|
||||||
echo 'start=true'; \
|
echo 'start=true'; \
|
||||||
echo 'autorestart=true'; \
|
echo 'autorestart=true'; \
|
||||||
@ -28,11 +27,6 @@ RUN apk add supervisor gettext && \
|
|||||||
echo 'stderr_logfile=/dev/stderr'; \
|
echo 'stderr_logfile=/dev/stderr'; \
|
||||||
echo 'stdout_logfile_maxbytes=0'; \
|
echo 'stdout_logfile_maxbytes=0'; \
|
||||||
echo 'stderr_logfile_maxbytes=0'; \
|
echo 'stderr_logfile_maxbytes=0'; \
|
||||||
} | tee /etc/supervisord.conf.tpl;
|
} | tee /etc/supervisord.conf;
|
||||||
|
|
||||||
COPY ./supervisord-init.sh ./bin/
|
CMD ["./bin/docker-init.sh", "supervisord", "-c", "/etc/supervisord.conf"]
|
||||||
|
|
||||||
ENV COJEDZIE_WORKER_QUEUES=main
|
|
||||||
ENV COJEDZIE_WORKER_OPTS="-vv --time-limit=86400 --limit=10 --memory-limit=128M"
|
|
||||||
|
|
||||||
CMD ["./bin/supervisord-init.sh", "supervisord", "-c", "/etc/supervisord.conf"]
|
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ -f /etc/supervisord.conf.tpl ]; then
|
|
||||||
envsubst < /etc/supervisord.conf.tpl > /etc/supervisord.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
|
@ -1,15 +1,31 @@
|
|||||||
ARG BASE_VERSION=latest
|
ARG BASE_VERSION=latest
|
||||||
ARG REGISTRY=docker.io
|
ARG REGISTRY=docker.io
|
||||||
|
|
||||||
FROM $REGISTRY/cojedzie/base:${BASE_VERSION}-cli
|
FROM $REGISTRY/cojedzie/base:$BASE_VERSION as base
|
||||||
|
|
||||||
RUN apk add supervisor gettext && \
|
FROM php:7.4-cli-alpine
|
||||||
|
|
||||||
|
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
||||||
|
|
||||||
|
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||||
|
|
||||||
|
WORKDIR /var/www
|
||||||
|
|
||||||
|
RUN install-php-extensions bcmath intl opcache zip sockets;
|
||||||
|
|
||||||
|
COPY --from=base /var/www /var/www
|
||||||
|
|
||||||
|
ENV APP_ENV=prod
|
||||||
|
ENV DATABASE_URL="sqlite:////var/db/app.db"
|
||||||
|
ENV PATH=$PATH:/var/www/bin
|
||||||
|
|
||||||
|
RUN apk add supervisor && \
|
||||||
{ \
|
{ \
|
||||||
echo '[supervisord]'; \
|
echo '[supervisord]'; \
|
||||||
echo 'nodaemon=true'; \
|
echo 'nodaemon=true'; \
|
||||||
echo ; \
|
echo ; \
|
||||||
echo '[program:messenger-consumer]'; \
|
echo '[program:messenger-consumer]'; \
|
||||||
echo 'command=php /var/www/bin/console messenger:consume $COJEDZIE_WORKER_OPTS $COJEDZIE_WORKER_QUEUES'; \
|
echo 'command=php /var/www/bin/console messenger:consume main -vv --time-limit=86400 --limit=10'; \
|
||||||
echo 'startsecs=0'; \
|
echo 'startsecs=0'; \
|
||||||
echo 'start=true'; \
|
echo 'start=true'; \
|
||||||
echo 'autorestart=true'; \
|
echo 'autorestart=true'; \
|
||||||
@ -17,11 +33,8 @@ RUN apk add supervisor gettext && \
|
|||||||
echo 'stderr_logfile=/dev/stderr'; \
|
echo 'stderr_logfile=/dev/stderr'; \
|
||||||
echo 'stdout_logfile_maxbytes=0'; \
|
echo 'stdout_logfile_maxbytes=0'; \
|
||||||
echo 'stderr_logfile_maxbytes=0'; \
|
echo 'stderr_logfile_maxbytes=0'; \
|
||||||
} | tee /etc/supervisord.conf.tpl;
|
} | tee /etc/supervisord.conf;
|
||||||
|
|
||||||
COPY ./supervisord-init.sh ./bin/
|
VOLUME /var/db
|
||||||
|
|
||||||
ENV COJEDZIE_WORKER_QUEUES=main
|
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
|
||||||
ENV COJEDZIE_WORKER_OPTS="-vv --time-limit=86400 --limit=10 --memory-limit=128M"
|
|
||||||
|
|
||||||
CMD ["./bin/supervisord-init.sh", "supervisord", "-c", "/etc/supervisord.conf"]
|
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ -f /etc/supervisord.conf.tpl ]; then
|
|
||||||
envsubst < /etc/supervisord.conf.tpl > /etc/supervisord.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
|
@ -1,43 +0,0 @@
|
|||||||
version: '3.4'
|
|
||||||
|
|
||||||
services:
|
|
||||||
nginx:
|
|
||||||
image: nginx:latest
|
|
||||||
ports:
|
|
||||||
- "8080:80"
|
|
||||||
volumes:
|
|
||||||
- ./front:/var/www/front:cached
|
|
||||||
- ./api:/var/www/api:cached
|
|
||||||
- .docker-compose/nginx/cojedzie-rr.conf:/etc/nginx/conf.d/cojedzie-rr.conf
|
|
||||||
|
|
||||||
api:
|
|
||||||
build:
|
|
||||||
context: ./api
|
|
||||||
dockerfile: rr.Dockerfile
|
|
||||||
env_file:
|
|
||||||
- .docker-compose/api/.env
|
|
||||||
- api/.env.local
|
|
||||||
environment:
|
|
||||||
- TRUSTED_PROXIES=172.0.0.0/8
|
|
||||||
ports:
|
|
||||||
- 8888:8080
|
|
||||||
volumes:
|
|
||||||
- ./api:/var/www:cached
|
|
||||||
- .docker-compose/api/log.conf:/usr/local/etc/php-fpm.d/zz-log.conf
|
|
||||||
command: ["rr", "serve", "-c", ".rr.yaml"]
|
|
||||||
|
|
||||||
frontend:
|
|
||||||
image: node:15.2.1
|
|
||||||
working_dir: /app
|
|
||||||
environment:
|
|
||||||
- APP_API=http://nginx/api
|
|
||||||
volumes:
|
|
||||||
- ./front:/app
|
|
||||||
command: ["node", "build/server.js"]
|
|
||||||
|
|
||||||
blackfire:
|
|
||||||
image: blackfire/blackfire
|
|
||||||
ports: ["8707"]
|
|
||||||
environment:
|
|
||||||
- BLACKFIRE_SERVER_ID
|
|
||||||
- BLACKFIRE_SERVER_TOKEN
|
|
@ -1,3 +0,0 @@
|
|||||||
# Contributing guidelines
|
|
||||||
|
|
||||||
TBD
|
|
Loading…
Reference in New Issue
Block a user