Skip to content

Commit 1c7eca9

Browse files
authored
Upgrade latest yii2 and angular 8 (#22)
* Upgraded API * (WIP) Upgraded backend * Fixed linting for backend * Updated README.md * Regenerated package-lock.json * Fixed linting for frontend * Added travis.yml and upgraded Node for backend/frontend * Updated nodejs version and added .dockerignore * Fixed backend * Update travis.yml * Fixed api/ping * Fixed lint and travis ci * Fix for travis ci * Fix for travis ci again * Fix travis ci again * Fix for travis ci again2 * Fix for travis ci again3 * Updated docker-compose.yml * Fix for travis ci again4 * Fix travis ci again5
1 parent 0187949 commit 1c7eca9

File tree

185 files changed

+20883
-20438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+20883
-20438
lines changed

.travis.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ sudo: required
22

33
language: php
44
php:
5-
- 7.1.9
5+
- 7.3.9
66

77
services:
88
- docker
@@ -15,16 +15,18 @@ branches:
1515
- master
1616

1717
before_install:
18-
- curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
19-
- sudo apt-get install -y nodejs
18+
- nvm install 12.10.0
19+
- node -v
20+
- npm -v
2021

2122
before_script:
2223
- cp .env-dist .env
2324
- export $(cat .env | sed -e /^$/d -e /^#/d | xargs)
2425
- env
2526
- docker-compose up -d --build
2627
- docker ps -a
27-
- while [ "$(curl -o /dev/null -Isw '%{http_code}\n' http://localhost/api/ping)" -ne "200" ]; do sleep 3; echo "Waiting API to be available..."; done
28+
- while [[ "$(curl -o /dev/null -Isw '%{http_code}\n' http://localhost/api/ping)" -ne 200 ]]; do sleep 3; echo "Waiting API to be available..."; done
29+
- docker logs api
2830
- cd api
2931
- composer install
3032
- cd ..
@@ -45,15 +47,15 @@ script:
4547
- cd frontend
4648
- npm run lint
4749
- npm run test
48-
- npm run e2e
50+
# - npm run e2e # Temporary disable as travis not supporting latest chrome
4951
- cd ..
5052
- cd backend
5153
- npm run lint
5254
- npm run test
5355
- cd ..
5456

5557
after_script:
56-
- docker-compose down
58+
- docker-compose down -t1 -v
5759

5860
notifications:
5961
email: false

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Yii2 REST API + Angular 6 Boilerplate
1+
# Yii2 REST API + Angular 8 Boilerplate
22

33
[![Build Status](https://travis-ci.org/chrisleekr/yii2-angular-boilerplate.svg?branch=master)](https://travis-ci.org/chrisleekr/yii2-angular-boilerplate)
44

5-
This is a boilerplate project for future use. The project consists of REST API developed by Yii2 and backend/frontend developed by Angular 6 with Bootstrap 4. Frontend project is compatible to provide server-side rendering(Angular Universal) using [@ng-toolkit/universal](https://github.com/maciejtreder/ng-toolkit).
5+
This is a boilerplate project for future use. The project consists of REST API developed by Yii2 and backend/frontend developed by Angular 8 with Bootstrap 4. Frontend project is compatible to provide server-side rendering(Angular Universal) using [@ng-toolkit/universal](https://github.com/maciejtreder/ng-toolkit).
66

77
The project involves:
88
* API
99
- Yii2 REST API, Yii2 RBAC, JWT (JSON Web Token), Memcached, *Basic Unit & Functional Test using Codeception*
1010
* Backend: Staff/Administrator dashboard to manage staffs, users and settings
11-
- Angular 6, Bootstrap 4, JWT (JSON Web Token), *Basic Unit test using
11+
- Angular 8, Bootstrap 4, JWT (JSON Web Token), *Basic Unit test using
1212
Karma+Jasmine*, Moment.js, Sweet Alert, Underscore.js
1313
* Frontend: User website to support user registration, login and account management
14-
- Angular 6, [@ng-toolkit/universal](https://github.com/maciejtreder/ng-toolkit), Bootstrap 4, JWT (JSON Web
14+
- Angular 8, [@ng-toolkit/universal](https://github.com/maciejtreder/ng-toolkit), Bootstrap 4, JWT (JSON Web
1515
Token), *Basic Unit using Karma+Jasmine, Basic E2E test using Protractor+Jasmine*, Moment.js, Sweet Alert
1616

1717
**Demo**
@@ -200,7 +200,7 @@ As mentioned earlier, you have to open `Developer Tool` to prevent cache if you
200200
- [X] Enhance user authorization with Yii2 RBAC (Role Based Access Control)
201201
- [X] Develop new customer management section
202202
- [X] Apply JWT(JSON Web Token) for user authentication
203-
- [X] Upgrade Angular 4 to Angular 6
203+
- [X] Upgrade Angular 4 to Angular 8
204204
- [X] Dockerize application
205205
- [X] Apply [server side rendering](https://github.com/maciejtreder/ng-toolkit) for Frontend project
206206
- [△] Develop more test code

api/.dockerignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# phpstorm project files
2+
.idea
3+
4+
# netbeans project files
5+
nbproject
6+
7+
# zend studio for eclipse project files
8+
.buildpath
9+
.project
10+
.settings
11+
12+
# windows thumbnail cache
13+
Thumbs.db
14+
15+
# composer vendor dir
16+
/vendor
17+
18+
# composer itself is not needed
19+
composer.phar
20+
21+
# Mac DS_Store Files
22+
.DS_Store
23+
24+
# phpunit itself is not needed
25+
phpunit.phar
26+
# local phpunit config
27+
/phpunit.xml
28+
29+
/tests/_output/*
30+
/tests/_support/_generated
31+
32+
/runtime
33+
/web/assets
34+
35+
/.migrated

api/.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ phpunit.phar
2626
# local phpunit config
2727
/phpunit.xml
2828

29-
tests/_output/*
30-
tests/_support/_generated
29+
/tests/_output/*
30+
/tests/_support/_generated
3131

32-
_references_
32+
/.migrated

api/Dockerfile

Lines changed: 36 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,42 @@
1-
# PHP Docker image for Yii 2.0 Framework runtime
2-
# ==============================================
3-
4-
FROM php:7.1.9-fpm-alpine
5-
6-
# Install system packages & PHP extensions required for Yii 2.0 Framework
7-
# virtual pkg names and ENV $PHPIZE_DEPS are definied in base image
8-
# C* and LDFlAGS are also definied in base image, so we use these for our custom pecl builds
9-
# we install (newer) imagick from edge repo due to SEGFAULT bugs
10-
# hopefully this won't break other things...
11-
RUN apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS && \
12-
apk add --no-cache --virtual .imagemagick-edge \
13-
--repository http://dl-3.alpinelinux.org/alpine/v3.6/main/ \
14-
--allow-untrusted \
15-
imagemagick \
16-
imagemagick-dev && \
17-
apk add --update --virtual .pecl-build-deps \
18-
icu-dev \
19-
curl-dev \
20-
freetype-dev \
21-
pcre-dev \
22-
postgresql-dev \
23-
libtool \
24-
libmcrypt-dev \
25-
libjpeg-turbo-dev \
26-
libpng-dev \
27-
libxml2-dev && \
28-
apk add --no-cache --virtual .build-dependencies $PHPIZE_DEPS \
29-
zlib-dev \
30-
cyrus-sasl-dev \
31-
g++ \
32-
libtool \
33-
make \
34-
pcre-dev && \
35-
apk add \
36-
git \
37-
curl \
38-
bash \
39-
bash-completion \
40-
icu \
41-
pcre \
42-
freetype \
43-
libmcrypt \
44-
libintl \
45-
libjpeg-turbo \
46-
imagemagick \
47-
libpng \
48-
libltdl \
49-
libxml2 \
50-
mysql-client \
51-
nodejs \
52-
postgresql-client \
53-
libmemcached-dev && \
54-
export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" && \
55-
pecl install \
56-
apcu \
57-
imagick-3.4.3 \
58-
xdebug \
59-
memcached && \
60-
docker-php-ext-enable imagick && \
61-
docker-php-ext-enable apcu && \
62-
docker-php-ext-enable memcached && \
63-
docker-php-ext-configure gd \
64-
--with-gd \
65-
--with-freetype-dir=/usr/include/ \
66-
--with-png-dir=/usr/include/ \
67-
--with-jpeg-dir=/usr/include/ && \
68-
docker-php-ext-configure bcmath && \
69-
docker-php-ext-install \
70-
soap \
71-
mcrypt \
72-
zip \
73-
curl \
74-
bcmath \
75-
exif \
76-
gd \
77-
iconv \
78-
intl \
79-
mbstring \
80-
opcache \
81-
pdo_mysql \
82-
pdo_pgsql && \
83-
apk del \
84-
.pecl-build-deps .phpize-deps
1+
FROM php:7.3.9-apache-stretch
852

863

4+
RUN requirements="nano cron mariadb-client libwebp-dev libxpm-dev libmcrypt-dev libmcrypt4 libcurl3-dev libxml2-dev \
5+
libmemcached-dev zlib1g-dev libc6 libstdc++6 libkrb5-3 openssl debconf libfreetype6-dev libjpeg-dev libtiff-dev \
6+
libpng-dev git imagemagick libmagickwand-dev ghostscript gsfonts libbz2-dev libzip-dev zip unzip" \
7+
&& apt-get update && apt-get install -y --no-install-recommends $requirements && apt-get clean && rm -rf /var/lib/apt/lists/* \
8+
&& docker-php-ext-install mysqli \
9+
pdo_mysql \
10+
iconv \
11+
gd \
12+
mbstring \
13+
soap \
14+
exif \
15+
opcache \
16+
&& pecl install apcu \
17+
xdebug \
18+
imagick \
19+
memcached \
20+
&& docker-php-ext-enable memcached \
21+
xdebug \
22+
imagick \
23+
apcu \
24+
opcache
25+
8726
# Configure version constraints
8827
ENV VERSION_COMPOSER_ASSET_PLUGIN=^1.4.2 \
8928
VERSION_PRESTISSIMO_PLUGIN=^0.3.7 \
9029
PATH=/app:/app/vendor/bin:/root/.composer/vendor/bin:$PATH \
9130
TERM=linux \
9231
COMPOSER_ALLOW_SUPERUSER=1
9332

33+
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/ssl-cert-snakeoil.key -out /etc/ssl/certs/ssl-cert-snakeoil.pem -subj "/C=AT/ST=Vienna/L=Vienna/O=Security/OU=Development/CN=example.com"
34+
35+
RUN a2enmod headers && \
36+
a2enmod rewrite && \
37+
a2ensite default-ssl && \
38+
a2enmod ssl
39+
9440
# Add configuration files
9541
COPY image-files/ /
9642

@@ -110,8 +56,6 @@ RUN curl -sS https://getcomposer.org/installer | php -- \
11056
composer global dumpautoload --optimize && \
11157
composer clear-cache
11258

113-
# Install nginx
114-
RUN apk --update add nginx
11559

11660
WORKDIR /srv
11761

@@ -120,8 +64,13 @@ RUN /usr/local/bin/composer install --prefer-dist
12064
ENV PATH /srv/vendor/bin:${PATH}
12165

12266
COPY . /srv/
67+
12368
RUN chown -R www-data:www-data /srv/ \
69+
&& mkdir /srv/runtime \
12470
&& chmod 777 -R /srv/runtime
12571

12672
EXPOSE 80
127-
CMD ["docker-entrypoint.sh"]
73+
74+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
75+
76+
CMD ["apache2-foreground"]

api/composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
},
1515
"minimum-stability": "stable",
1616
"require": {
17-
"php": ">=5.4.0",
17+
"php": ">=7.3.0",
1818
"yiisoft/yii2": "~2.0.14",
1919
"yiisoft/yii2-bootstrap": "~2.0.0",
2020
"yiisoft/yii2-swiftmailer": "~2.0.0",
2121
"firebase/php-jwt": "^4.0",
22-
"guzzlehttp/guzzle": "^6.3"
22+
"guzzlehttp/guzzle": "^6.3",
23+
"ext-json": "*"
2324
},
2425
"require-dev": {
2526
"yiisoft/yii2-debug": "~2.0.0",

0 commit comments

Comments
 (0)