diff --git a/.idea/deployment.xml b/.idea/deployment.xml new file mode 100644 index 0000000..881e878 --- /dev/null +++ b/.idea/deployment.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e0936e6..ef3966d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,52 +1,87 @@ FROM ubuntu:xenial MAINTAINER Thomas Ruta +#prepair Server +#RUN sudo -s +#RUN sudo passwd root +RUN apt-get update && \ + apt-get -yq install ssh openssh-server nano vim-nox + # Install packages RUN apt-get update && \ - apt-get -yq --force-yes install mysql-client git curl imagemagick apache2 apache2-doc apache2-utils libapache2-mod-php php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-imap php7.0-cli php7.0-cgi libapache2-mod-fcgid apache2-suexec-pristine php-pear php-auth php7.0-mcrypt mcrypt imagemagick libruby libapache2-mod-python php7.0-curl php7.0-intl php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl memcached php-memcache php-imagick php-gettext php7.0-zip php7.0-mbstring php7.0-soap php7.0-json php7.0-opcache php-apcu libapache2-mod-fastcgi php7.0-fpm + apt-get -yq --force-yes install mysql-client git curl imagemagick apache2 apache2-doc apache2-utils \ + libapache2-mod-php php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-imap php7.0-cli php7.0-cgi libapache2-mod-fcgid apache2-suexec-pristine \ + php-pear php-auth php7.0-mcrypt mcrypt imagemagick libruby libapache2-mod-python php7.0-curl php7.0-intl php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy \ + php7.0-xmlrpc php7.0-xsl memcached php-memcache php-imagick php-gettext php7.0-zip php7.0-mbstring php7.0-soap php7.0-json php7.0-opcache php-apcu libapache2-mod-fastcgi php7.0-fpm php-xdebug + RUN a2enmod suexec rewrite ssl actions include cgi RUN a2enmod dav_fs dav auth_digest headers #RUN apt-get install php7.0-opcache php-apcu libapache2-mod-fastcgi php7.0-fpm -#RUN a2enmod actions fastcgi alias +RUN a2enmod actions fastcgi alias +RUN rm /etc/apache2/sites-enabled/000-default.conf -rf +RUN mkdir /var/www/php-fcgi-scripts && mkdir /var/www/tmp && mkdir /var/www/cgi-bin -ADD typo3.conf /etc/apache2/sites-enabled/000-default.conf -RUN mkdir /var/www/html/php-fcgi-scripts && mkdir /var/www/tmp && mkdir /var/www/cgi-bin +RUN useradd -m -g www-data -s /bin/bash typo3user +ADD .php-fcgi-starter /var/www/php-fcgi-scripts/ +RUN chmod 775 /var/www/php-fcgi-scripts/.php-fcgi-starter && chown typo3user:www-data /var/www/php-fcgi-scripts/.php-fcgi-starter +RUN echo AllowUsers typo3user >> /etc/ssh/sshd_config && sed -i "s/.*PasswordAuthentication .*/PasswordAuthentication yes/g" /etc/ssh/sshd_config -ADD .php-fcgi-starter /var/www/php-fcgi-scripts +#cert for cag_tests +#ADD id_rsa /root/.ssh/ +#ADD id_rsa.pub /root/.ssh/ +#RUN chmod 600 /root/.ssh/id_rsa && chmod 600 /root/.ssh/id_rsa.pub +#RUN eval `ssh-agent` +#&& ssh-add /root/.ssh/id_rsa.pub # Adjust some php settings -ADD typo3.php.ini /etc/php/cgi/conf.d/ - -RUN rm -fr /var/www/html/* -VOLUME [ "/var/www/html/uploads", "/var/www/html/fileadmin"] +ADD typo3.php.ini /etc/php/7.0/cgi/conf.d/ +# place run script +ADD run-typo3.sh /var/www/cgi-bin/ +RUN chmod 755 /var/www/cgi-bin/ - - -RUN useradd composeruser -RUN su composeruser RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" RUN php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" -RUN php composer-setup.php +RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer RUN php -r "unlink('composer-setup.php');" -RUN chmod 755 composer.phar -#RUN su composeruser php composer.phar install create-project web-tp3/tp3_installer + +#RUN php /var/www/composer.phar --dev --stability=dev create-project web-tp3/tp3_installer:dev-8.x-dev typo3 +#RUN rm -R /var/www/html -rf && mv /typo3 /var/www/html + +VOLUME [ "/var/www/html/web/uploads", "/var/www/html/web/fileadmin", "/var/www/html/web/typo3temp" ,"/var/www/html/web/error" ] +RUN chown typo3user:www-data -R /var/www/html/ + +#apache and letscrypt for ssl +ADD typo3.conf /etc/apache2/sites-enabled/000-default.conf +RUN apt-get -yq install letsencrypt +#RUN certbot --apache -d localhost.tp3.de + # Expose environment variables ENV DB_HOST **LinkMe** ENV DB_PORT **LinkMe** ENV DB_NAME typo3 -ENV DB_USER admin -ENV DB_PASS **ChangeMe** +ENV DB_USER root +ENV DB_PASS my-secret-pw ENV INSTALL_TOOL_PASSWORD password +RUN service ssh restart +#install typo3 +#RUN bash /var/www/cgi-bin/run-typo3.sh -EXPOSE 80 -CMD ["/bin/bash", "-c", "/run-typo3.sh"] - -ADD AdditionalConfiguration.php /var/www/html/typo3conf/ - +#ADD AdditionalConfiguration.php /var/www/html/web/typo3conf/ # Install dependencies defined in composer.json #ADD composer.json /var/www/html/ -#ADD composer.lock /var/www/html/ -#RUN composer install && cp typo3conf/ext/typo3_console/Scripts/typo3cms . +#RUN cp /var/www/html/web/typo3conf/ext/typo3_console/Scripts/typo3cms/* /var/www/html/ +#apache +#RUN apachectl -d /etc/apache2 -f apache2.conf -e info -DFOREGROUND + +EXPOSE 80 +#ssh +EXPOSE 22 +#Xdebug +EXPOSE 9000 +#CMD ["apache2","-DFOREGROUND"] +ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] +CMD [] + diff --git a/README.md b/README.md index 47c6d3c..042c7f7 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,24 @@ Usage (standalone) This image needs an external MySQL server or linked MySQL container. To create a MySQL container: - docker run -d -e MYSQL_PASS="" --name db -p 3306:3306 mysql:stable + docker run -d -e MYSQL_ROOT_PASSWORD="my-secret-pw" --name db -p 3306:3306 webtp3/tp3sql To run TYPO3 by linking to the database created above: - docker run -d --link db:db -e DB_PASS="" -p 80:80 webtp3/docker + docker run -d --rm -it -v $PWD:/build --link db:db -e DB_PASS="my-secret-pw" -p 80:80 --name typo3 webtp3/docker:16.4-stable + +to have a bash simply add bash to the end of the command (as you can run any command in the docker image) +"docker run -d --rm -it -v $PWD:/build --link db:db -e DB_PASS="my-secret-pw" -p 80:80 --name typo3 webtp3/docker:8-stable bash" +Following branches are available: +8-stable (with typo3 installed) +16.4-stable (just apache and php 7.1 - waiting for install in /var/www/html) +18.4-stable (just apache and php 7.2 - waiting for install in /var/www/html) + + docker cp typo3 /from/ /to/ (Copy files/folders between a container and the local filesystem) + + + Usage (combined) ------------------ ia docker stack deploy or docker-compose @@ -26,10 +38,27 @@ ia docker stack deploy or docker-compose Now, you can use your web browser to access TYPO3 from the the follow address: http://localhost/typo3 + User is "tp3min" and password is "Init1111". + + +The mysql Adminer + + http://localhost:8080 + +Mysql Server can also be reached from outside on port 3306 + +SSH Server also for Rsync and other stuff +to use ssh server there is a user typo3user that needs a password (docker exec...) +graphicsmagick, imagemagick, letscrypt, openssl, php-xdebug and I think all what you need. + +Documentation +------------------ + + more about the base images an be found on the docker hub: -User is "tp3min" and password is "Init1111". +https://hub.docker.com/r/webtp3/docker -more about the base images an be foun on the docker hub: +The System runs with a php fastcgi wrapper. So you can easyly swap php Versions to tests on several ons. Web Server https://hub.docker.com/_/ubuntu/ diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 8c6f936..ab8924d 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -2,6 +2,20 @@ image: php:7.1.1 pipelines: default: + + - step: + name: Deploy to testing + image: docker:stable + deployment: test + script: + # for database start with composer + - ls -an + - apk add --no-cache py-pip bash + - pip install --no-cache-dir docker-compose + - docker-compose -f docker-compose.yml up + - docker exec typo3 cp -r . typo3:/var/www/html + - docker-compose -f docker-compose.yml down + - step: services: - docker @@ -14,11 +28,4 @@ pipelines: # authenticate with the Docker Hub registry - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD # push the new Docker image to the Docker registry - - docker push $IMAGE_NAME - - step: - caches: - - composer - script: - - apt-get update && apt-get install -y unzip - - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - - composer --dev --stability=dev create-project web-tp3/tp3_installer + #- docker push $IMAGE_NAME \ No newline at end of file diff --git a/composer.json b/composer.json index 90bbb28..4e94e16 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { - "name": "web-tp3/tp3_installer", - "description": "testing typo3", + "name": "web-tp3/docker", + "description": "image for testing typo3", "type": "project", "minimum-stability": "dev", - "version": "1.0.0", + "version": "16.4-stable", "license": "GPL-3.0+", "authors": [ @@ -18,62 +18,9 @@ "url": "https://composer.typo3.org/" } ], - "require": { - "typo3/cms": "dev-TYPO3_8-7", - "helhum/typo3-console": "^5", - "helhum/dotenv-connector": "^2", - "helhum/config-loader": "^0.8", - "ext-gd": "*", - "ext-fileinfo": "*", - "ext-zlib": "*", - "ext-openssl": "*", - "ext-zip": "*", - "ext-mysqli": "*", - "typo3/cms-cli": "*", - "typo3/class-alias-loader": "*", - "typo3/cms-composer-installers": "*", - "psr/http-message": "~1.0", - "cogpowered/finediff": "~0.3.1", - "guzzlehttp/guzzle": "^6.3.0", - "web-tp3/tp3_installer":"1.0.0" - }, - "require-dev": { - "deployer/deployer": "^6", - "consolidation/robo": "^1", - "codeception/codeception":"*", - "typo3/testing-framework": "8.x-dev", - "friendsofphp/php-cs-fixer": "^2.13@dev", - "se/selenium-server-standalone":"~2.53", - "typo3/cms-styleguide" :"~8.0.8", - "ext-soap": "*", - "phpunit/php-invoker":"^1.1", - "enm1989/chromedriver": "~2.30", - "fiunchinho/phpunit-randomizer": "~3.0.0", - "phpunit/phpunit": "*", - "nimut/testing-framework": "^3.0@dev" - - }, - "autoload": { - "psr-4": { - } - }, "extra": { - "typo3/cms": { - "cms-package-dir": "{$vendor-dir}/typo3/cms", - "web-dir": "web" - }, - "helhum/typo3-console": { - "install-extension-dummy": false - }, "helhum/dotenv-connector": { - "cache-dir": "var/cache" - }, - "branch-alias": { - "dev-TYPO3_8-7": "8.x-dev" + "env-file": ".env" } - }, - "non-feature-branches": [ - "TYPO3_.+" - ] - + } } diff --git a/docker-compose.yml b/docker-compose.yml index 279c4f0..302dde7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,31 @@ +#tp3 testing env + typo3: build: . - links: + links: - db ports: - - "80:80" + - 80:80 + - 9000:9000 environment: DB_NAME: typo3 - DB_USER: admin - DB_PASS: "**ChangeMe**" - DB_HOST: "db" - DB_PORT: "3306" + DB_USER: root + DB_PASS: my-secret-pw + DB_HOST: db + DB_PORT: 3306 + db: - image: mysql + image: webtp3/tp3sql restart: always environment: - MYSQL_ROOT_PASSWORD: "**ChangeMe**" \ No newline at end of file + MYSQL_ROOT_PASSWORD: my-secret-pw + ports: + - 3306:3306 + +adminer: + image: adminer + restart: always + links: + - db + ports: + - 8080:8080 diff --git a/run-typo3.sh b/run-typo3.sh index 2b3151a..bfde070 100644 --- a/run-typo3.sh +++ b/run-typo3.sh @@ -5,9 +5,9 @@ DB_HOST=${DB_1_PORT_3306_TCP_ADDR:-${DB_HOST}} DB_PORT=${DB_PORT_3306_TCP_PORT:-${DB_PORT}} DB_PORT=${DB_1_PORT_3306_TCP_PORT:-${DB_PORT}} -if [ "$DB_PASS" = "**ChangeMe**" ] && [ -n "$DB_1_ENV_MYSQL_PASS" ]; then - DB_PASS="$DB_1_ENV_MYSQL_PASS" -fi +#if [ "$DB_PASS" = "my-secret-pw" ] && [ -n "$DB_1_ENV_MYSQL_PASS" ]; then +# DB_PASS="$DB_1_ENV_MYSQL_PASS" +#fi echo "=> Using the following MySQL/MariaDB configuration:" echo "========================================================================" @@ -18,13 +18,14 @@ echo " Database Username: $DB_USER" echo "========================================================================" echo "=> Waiting for database ..." -for ((i=0;i<15;i++)) -do - DB_CONNECTABLE=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e 'status' >/dev/null 2>&1; echo "$?") - if [[ DB_CONNECTABLE -eq 0 ]]; then - break - fi +i=0 +while [ "$i" -le 15 ]; do + DB_CONNECTABLE=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e 'status' >/dev/null 2>&1; echo "$?") + if [[ DB_CONNECTABLE -eq 0 ]]; then + break + fi sleep 3 + i=$(( i + 1 )) done if [[ $DB_CONNECTABLE -eq 0 ]]; then @@ -55,25 +56,9 @@ else exit $DB_CONNECTABLE fi -if [ ! -f /var/www/html/typo3conf/LocalConfiguration.php ] - then - php typo3cms install:setup --non-interactive \ - --database-user-name="tp3min" \ - --database-host-name="$DB_HOST" \ - --database-port="$DB_PORT" \ - --database-name="$DB_NAME" \ - --database-user-password="$DB_PASS" \ - --database-create=0 \ - --admin-user-name="tp3min" \ - --admin-password="Init1111" \ - --site-name="TYPO3 Demo Installation" - - echo "Set permissions for /var/www/html folder ..." - chown www-data:www-data -R /var/www/html/fileadmin /var/www/html/typo3temp /var/www/html/uploads -fi # Start apache in foreground if no arguments are given if [ $# -eq 0 ] then - /run.sh + apachectl -d /etc/apache2 -f apache2.conf -e info -DFOREGROUND fi diff --git a/typo3.conf b/typo3.conf index 7223e46..f4b7bff 100644 --- a/typo3.conf +++ b/typo3.conf @@ -6,11 +6,11 @@ - DocumentRoot /var/www/html + DocumentRoot /var/www/html/web/ ServerAdmin webmaster@tp3.de - + ServerName localhost.tp3.de ErrorLog /var/log/apache2/error.log @@ -27,7 +27,7 @@ - + # Clear PHP settings of this website SetHandler None @@ -36,7 +36,7 @@ AllowOverride All Require all granted - + # Clear PHP settings of this website SetHandler None @@ -50,12 +50,12 @@ PerlModule ModPerl::Registry PerlModule Apache2::Reload - + PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI - + PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI @@ -66,14 +66,14 @@ - + SetHandler mod_python PythonHandler mod_python.publisher PythonDebug On - + SetHandler mod_python @@ -104,7 +104,7 @@ FcgidBusyTimeout 3600 FcgidMaxRequestLen 1073741824 - + SetHandler fcgid-script @@ -116,7 +116,7 @@ AllowOverride All Require all granted - + SetHandler fcgid-script @@ -133,7 +133,7 @@ # add support for apache mpm_itk - AssignUserId www-data www-data + AssignUserId typo3user www-data @@ -147,7 +147,7 @@ SetHandler None - DavLockDB /var/www/clients/client1/tmp/DavLock + DavLockDB /var/www/tmp/DavLock # DO NOT REMOVE THE COMMENTS! # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE! # WEBDAV BEGIN @@ -156,4 +156,6 @@ - \ No newline at end of file + + + diff --git a/typo3.php.ini b/typo3.php.ini index 7cb367a..23761c7 100644 --- a/typo3.php.ini +++ b/typo3.php.ini @@ -1,4 +1,5 @@ memory_limit = 512M max_execution_time = 240 upload_max_filesize = 200M -post_max_size = 200M \ No newline at end of file +post_max_size = 200M +max_input_vars=1500