Skip to content
Snippets Groups Projects
Verified Commit b3ae8966 authored by David Beniamine's avatar David Beniamine
Browse files

Add docker stack in app repository

parent d60f760e
No related branches found
No related tags found
1 merge request!17Tuleap 77 legacy container
......@@ -50,13 +50,18 @@ APP_DEBUG=1
# If this fails, replace ${MYSQL_DATABASE:-rekallfrwsmember} by rekallfrwsmember
# and do the same for the other variables
MYSQL_DATABASE=${MYSQL_DATABASE:-rekallfrwsmember}
MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}
MYSQL_USER=${MYSQL_USER:-rekallfrwsmember}
MYSQL_PASSWORD=${MYSQL_PASSWORD:-sm4SyZVPu6wpjZfg}
MYSQL_DATABASE=rekallfrwsmember
MYSQL_ROOT_PASSWORD=root
MYSQL_USER=rekallfrwsmember
MYSQL_PASSWORD=sm4SyZVPu6wpjZfg
BY_PASS_CODE=ed156b9188ecddf0c556d5712f0a84cc
# Use smtp or mail in production
MAILER_DSN=null://null
SYMFONY_SECRET=0f817363a768f111a17d2522b8d7e2d72cf738b1
LEGACY_SRC_SHARED=./capsule-prototype
LEGACY_URL=http://legacy/
LEGACY_URL_EXTERNAL=http://localhost:8081/legacy/
# Should be the path part of the above url
LEGACY_EXTERNAL_PREFIX=/legacy
......@@ -32,3 +32,9 @@ yarn-error.log
###< squizlabs/php_codesniffer ###
.phpcd
.*.sw?
mysql
log
/legacy/*/
capsule-prototype/
.env
......@@ -8,11 +8,9 @@ Copy the file `.env_default` to `.env` and adapt it to your needs
Run the following commands
```bash
# Clone the docker stack
git clone https://gitlab.tetras-libre.fr/rekall/docker-stack-new
cd docker-stack-new
# Clone the symfony app
git clone https://gitlab.tetras-libre.fr/rekall/memorekall-member-new app
git clone https://gitlab.tetras-libre.fr/rekall/memorekall-member-new
cd memorekall-member-new
git clone https://gitlab.tetras-libre.fr/rekall/capsule-prototype
# Build and start the containers
docker-compose up --build
# In another terminal
......
version: '3'
services:
###> symfony/mailer ###
mailer:
image: schickling/mailcatcher
ports: [1025, 1080]
###< symfony/mailer ###
###> doctrine/doctrine-bundle ###
database:
ports:
- "5432"
###< doctrine/doctrine-bundle ###
version: '3'
version: "3.4"
services:
###> doctrine/doctrine-bundle ###
database:
image: postgres:${POSTGRES_VERSION:-13}-alpine
mysql:
image: mysql:5.6
environment:
POSTGRES_DB: ${POSTGRES_DB:-app}
# You should definitely change the password in production
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ChangeMe}
POSTGRES_USER: ${POSTGRES_USER:-symfony}
- MYSQL_DATABASE
- MYSQL_ROOT_PASSWORD
- MYSQL_USER
- MYSQL_PASSWORD
volumes:
- db-data:/var/lib/postgresql/data:rw
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###
- "./mysql:/var/lib/mysql:rw"
- "./docker/mysql/init_db_d:/docker-entrypoint-initdb.d"
memorekall-member:
build: ./docker/symfony
depends_on:
- mysql
- legacy
environment:
- MYSQL_DATABASE
- MYSQL_USER
- MYSQL_PASSWORD
volumes:
- $PWD:/sites/memorekall/www/web_dev:rw
networks:
- default
- legacy
ports:
- "${MEMOREKALL_MEMBER_PORT}:80"
legacy:
build: ./docker/legacy
depends_on:
- mysql
volumes:
###> doctrine/doctrine-bundle ###
db-data:
###< doctrine/doctrine-bundle ###
- $PWD/legacy:/sites/memorekall/www/web_legacy:rw
- $PWD/log:/sites/memorekall/www/log:rw
- ${LEGACY_SRC_SHARED}:/sites/memorekall/www/web_legacy/shared:ro
networks:
- legacy
networks:
legacy:
FROM php:7.4-apache
COPY front.conf /etc/apache2/sites-enabled/000-default.conf
RUN apt-get update && apt-get -y upgrade && apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libonig-dev \
libpng-dev \
libpng-dev \
libzip-dev \
zlib1g-dev
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN docker-php-ext-install -j$(nproc) \
gd \
mbstring \
curl \
zip
RUN mkdir -p /sites/memorekall/www
WORKDIR /sites/memorekall/www
VOLUME web_legacy
VOLUME log
RUN mkdir -p tmp
<VirtualHost *:80>
ServerName legacy.memorekall.com
ServerAlias www.legacy.memorekall.com
ServerAdmin webmaster@localhost
DocumentRoot /sites/memorekall/www/web_legacy
<Directory /sites/memorekall/www/web_legacy>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
DirectoryIndex index.php, index.html
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
# <Directory /var/www/project>
# Options FollowSymlinks
# </Directory>
# optionally disable the fallback resource for the asset directories
# which will allow Apache to return a 404 error when files are
# not found instead of passing the request to Symfony
ErrorLog /sites/memorekall/www/log/legacy_errors.log
CustomLog /sites/memorekall/www/log/legacy_access.log combined
</VirtualHost>
FROM php:7.4-apache
USER root
RUN apt-get update && apt-get -y upgrade
RUN apt-get update && apt-get install -y \
gnupg \
wget \
apt-transport-https \
git \
unzip \
nodejs \
npm \
python2
ENV PHP_MEMORY_LIMIT=512M
#!/bin/bash
# To add this repository please do:
COPY addPhpRepository.sh .
RUN bash addPhpRepository.sh
RUN a2enmod rewrite headers proxy proxy_http
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq \
libcurl4-openssl-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libonig-dev \
libpng-dev \
libpng-dev \
libzip-dev \
zlib1g-dev \
libxml2-dev \
libicu-dev
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN docker-php-ext-install -j$(nproc) \
mbstring \
gd \
pdo_mysql \
mysqli \
curl \
zip \
pdo \
ctype \
iconv \
json \
session \
simplexml \
tokenizer
# Install opcache extension for PHP accelerator
RUN docker-php-ext-install opcache \
&& docker-php-ext-enable opcache \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y
# Install internationalization extension
RUN BUILD_DEPS="g++ libicu-dev" && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq \
$BUILD_DEPS \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $BUILD_DEPS \
&& rm -rf /var/lib/apt/lists/*
RUN echo 'date.timezone = "UTC"' >> /usr/local/etc/php/php.ini
RUN echo 'opcache.max_accelerated_files = 20000' >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo short_open_tag=off >> /usr/local/etc/php/php.ini
# Install composer
COPY install_composer.sh /bin
RUN chmod u+x /bin/install_composer.sh
RUN /bin/install_composer.sh
# Install xdebug
RUN pecl install xdebug-2.9.0 \
&& docker-php-ext-enable xdebug
COPY xdebug.ini $PHP_INI_DIR/conf.d/
# Composer is global
RUN mv composer.phar /usr/local/bin/composer && curl -sS https://get.symfony.com/cli/installer | bash && cp /root/.symfony/bin/symfony /usr/local/bin/symfony
ENV COMPOSER_MEMORY_LIMIT=-1
RUN mkdir -p /sites/memorekall/www/web_dev
WORKDIR /sites/memorekall/www/web_dev
COPY symfony.conf /etc/apache2/sites-enabled/000-default.conf
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["bash","/entrypoint.sh"]
if [ "$(whoami)" != "root" ]; then
SUDO=sudo
fi
${SUDO} apt-get -y install apt-transport-https lsb-release ca-certificates curl
${SUDO} wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
${SUDO} sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
${SUDO} apt-get update
\ No newline at end of file
base_dir=/sites/memorekall/www
pushd $base_dir
pushd $base_dir/web_dev
# Install dependencies using local composer not global because of php 5.5
composer install
popd
# Create required dirs
DIRS="web_dev/var/log web_dev/var/cache"
for d in $DIRS; do
mkdir -p $d
done
popd
xdebug_conf="$PHP_INI_DIR/conf.d/xdebug.ini"
npm install
if [ "$ENV" == "prod" ]; then
rm $xdebug_conf
npm run build
else
if [[ "$(uname -r)" =~ "linuxkit" ]]; then
# Connect back does not work in non Linux, deactivate it and use host.docker.internal url
sed -i -e "s/xdebug.remote_connect_back=1/xdebug.remote_connect_back=0/" $xdebug_conf
echo "xdebug.remote_host = host.docker.internal" >> $xdebug_conf
fi
npm run watch &
fi
# Fix permissions
for d in var vendor assets public node_modules legacy log src; do
chown -R :www-data $base_dir/web_dev/$d
chmod -R g+w $base_dir/web_dev/$d
done
chown -R 999:999 $base_dir/web_dev/mysql
apache2ctl -DFOREGROUND
#!/bin/sh
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT
\ No newline at end of file
<VirtualHost *:80>
ServerName project.memorekall.com
ServerAlias www.project.memorekall.com
DocumentRoot /sites/memorekall/www/web_dev/public
DirectoryIndex /index.php
<Directory /sites/memorekall/www/web_dev/public>
Require all granted
AllowOverride None
Order Allow,Deny
Allow from All
FallbackResource /index.php
RewriteEngine on
</Directory>
ErrorLog /sites/memorekall/www/web_dev/log/memorekall_member_error.log
CustomLog /sites/memorekall/www/web_dev/log/memorekall_member.log combined
</VirtualHost>
xdebug.remote_port=9000
xdebug.remote_enable=1
xdebug.remote_connect_back=1
......@@ -5,10 +5,10 @@ GREENBOLD='\033[0;32;1m'
BOLD='\033[1m'
NORMAL='\033[0m'
if [ ! -z "$(which docker-compose)" ]; then
composer="docker-compose -f ../docker-compose.yml exec -T memorekall-member composer"
else
composer=composer
docker="docker-compose exec -T memorekall-member"
fi
composer="$docker composer"
npm="$docker npm"
echo -e "\n ${BOLD} Starting Unit and Functional Tests...\n ${NORMAL}"
$composer tests
......@@ -39,7 +39,7 @@ else
fi
echo -e "\n ${BOLD} Starting ESLint... \n ${NORMAL}"
npm run lint
$npm run lint
if [ $? != 0 ]; then
echo -e "\n ${REDBOLD} ESLint verification failed \n ${NORMAL}"
exit 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment