Compare commits

..
Author SHA1 Message Date
marc c64058fff0 update of composer 2022-09-15 16:45:37 +02:00
21 changed files with 12991 additions and 9390 deletions
+1 -3
View File
@@ -4,8 +4,6 @@
.vscode
.DS_Store
docker-compose*.yml
.env
.env.template
# Back
back/.DS_Store
@@ -19,4 +17,4 @@ var
# Front
front/.DS_Store
front/node_modules/
front/dist/
front/dist/
-48
View File
@@ -1,48 +0,0 @@
name: Docker build test
on:
push:
branches:
- "*"
- "!master"
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
jobs:
build-back:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Fake env file
run: touch .env
- name: Build
run: docker-compose -f docker-compose.production.yml build back
build-front:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Fake env file
run: touch .env
- name: Build
run: docker-compose -f docker-compose.production.yml build front
-89
View File
@@ -1,89 +0,0 @@
name: Docker
on:
schedule:
- cron: "0 4 * * 0" # run every sunday at 4 am to test if the image builds correctly given that changes of debian or compose packages can break the image
push:
branches:
- "master"
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
jobs:
build-front:
name: Build front
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push front
uses: docker/build-push-action@v3
with:
context: front
dockerfile: Dockerfile
push: true
tags: numerisisep/numeris-front:latest
build-back:
name: Build back
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push back
uses: docker/build-push-action@v3
with:
context: back
dockerfile: Dockerfile.production
push: true
tags: numerisisep/numeris-back:latest
pull-and-recreate:
name: Pull and recreate
needs:
- build-front
- build-back
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
# password: ${{ secrets.PASSWORD }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
cd numeris
git pull
docker-compose -f docker-compose.production.yml pull
docker-compose -f docker-compose.production.yml up -d --force-recreate
-2
View File
@@ -2,5 +2,3 @@
vendor
public/storage
public/build
.env
.env.template
+9 -12
View File
@@ -1,4 +1,6 @@
FROM php:7.4-apache
FROM php:7.2-apache
RUN mkdir -p /home/numeris
# Install packages
RUN apt-get update && apt-get install -y \
@@ -6,9 +8,7 @@ RUN apt-get update && apt-get install -y \
zip \
unzip \
nano \
libpng-dev \
libzip-dev
libpng-dev
# Install the PHP mcrypt pdo_mysql extension
RUN docker-php-ext-install pdo_mysql gd zip
@@ -17,25 +17,22 @@ RUN docker-php-ext-install pdo_mysql gd zip
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Enable apache conf
COPY docker/apache/numeris.conf /etc/apache2/sites-available/numeris.conf
RUN a2dissite 000-default.conf && \
a2ensite numeris.conf && \
a2enmod headers && \
a2enmod rewrite && \
service apache2 restart
RUN a2dissite 000-default.conf && a2ensite numeris.conf && a2enmod rewrite && service apache2 restart
# Enable php conf
COPY docker/php/php.ini /usr/local/etc/php/conf.d/default.ini
WORKDIR /home/numeris
COPY . .
COPY . /home/numeris
# Composer install
WORKDIR /home/numeris
RUN composer install --no-interaction
# Final touch
RUN . ~/.bashrc
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN usermod -u 1000 www-data
RUN chown -R www-data:www-data /home/numeris
RUN chown -R www-data:www-data /var/log/apache2/
ENTRYPOINT [ "/home/numeris/entrypoint.sh" ]
WORKDIR /home/numeris
+10 -12
View File
@@ -1,4 +1,6 @@
FROM php:7.4-apache
FROM php:7.2-apache
RUN mkdir -p /home/numeris
# Install packages
RUN apt-get update && apt-get install -y \
@@ -6,8 +8,7 @@ RUN apt-get update && apt-get install -y \
zip \
unzip \
nano \
libpng-dev \
libzip-dev
libpng-dev
# Install the PHP mcrypt pdo_mysql extension
RUN docker-php-ext-install pdo_mysql gd zip
@@ -15,28 +16,25 @@ RUN docker-php-ext-install pdo_mysql gd zip
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Enable apache conf
COPY docker/apache/numeris.conf /etc/apache2/sites-available/numeris.conf
RUN a2dissite 000-default.conf && \
a2ensite numeris.conf && \
a2enmod headers && \
a2enmod rewrite && \
service apache2 restart
RUN a2dissite 000-default.conf && a2ensite numeris.conf && a2enmod rewrite && service apache2 restart
# Enable php conf
COPY docker/php/php.ini /usr/local/etc/php/conf.d/default.ini
WORKDIR /home/numeris
COPY . .
COPY . /home/numeris
### Back config ###
WORKDIR /home/numeris
RUN composer install --optimize-autoloader --no-dev --no-interaction
# Final touch
RUN . ~/.bashrc
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN usermod -u 1000 www-data
RUN chown -R www-data:www-data /home/numeris
RUN chown -R www-data:www-data /var/log/apache2/
WORKDIR /home/numeris
RUN php artisan config:cache
RUN php artisan route:cache
ENTRYPOINT [ "/home/numeris/entrypoint.sh" ]
+3 -11
View File
@@ -1,11 +1,7 @@
{
"name": "2seg/numeris-v2",
"description": "Home of the new website of Numéris.",
"keywords": [
"Numéris",
"association",
"website"
],
"keywords": ["Numéris", "association", "website"],
"license": "MIT",
"type": "project",
"authors": [
@@ -18,11 +14,6 @@
"name": "MinhNam Nguyen",
"email": "nguyen.minhnam@hotmail.fr",
"role": "Developer"
},
{
"name": "Marc Partensky",
"email": "marc@marcpartensky.com",
"role": "Developer"
}
],
"require": {
@@ -60,7 +51,8 @@
},
"extra": {
"laravel": {
"dont-discover": []
"dont-discover": [
]
}
},
"scripts": {
+2 -5
View File
@@ -6,13 +6,10 @@
# Force HTTPS when X-Forwarded-Proto is passed as HTTPS
# Useful when the reverse proxy is in HTTPS
SetEnvIf x-forwarded-proto https HTTPS=on
# Header set Access-Control-Allow-Origin "*"
# Header set Access-Control-Allow-Origin "numeris-isep.fr"
Header set Access-Control-Allow-Origin "https://numeris-isep.fr"
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
ErrorLog /var/log/apache2/numeris-error.log
CustomLog /var/log/apache2/numeris-access.log combined
</VirtualHost>
-12
View File
@@ -1,12 +0,0 @@
#!/usr/bin/env sh
php artisan key:generate
# php artisan key:generate --force
php artisan jwt:secret
# php artisan jwt:secret --force
# php artisan cache:clear
php artisan config:clear
php artisan migrate:refresh
docker-php-entrypoint
apache2-foreground
+20 -68
View File
@@ -1,90 +1,42 @@
version: "3.9"
version: '3'
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: numeris_phpmyadmin
restart: unless-stopped
ports:
- 3000:80
links:
- mysql:db
depends_on:
- mysql
networks:
- caddy
- mysql
labels:
caddy: phpmyadmin.numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
container_name: numeris_phpmyadmin
mysql:
image: mysql:5.7
container_name: numeris_mysql
restart: unless-stopped
networks:
- mysql
env_file:
- .env
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: 'numeris'
volumes:
- ./var/mysql:/var/lib/mysql
container_name: numeris_mysql
back:
image: numerisisep/numeris-back
container_name: numeris_back
restart: unless-stopped
build:
context: ./back
dockerfile: Dockerfile.production
networks:
- caddy
- mysql
env_file:
- .env
volumes:
- .env:/home/numeris/.env
depends_on:
- mysql
labels:
caddy: api.numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
# caddy.reverse_proxy.header_down: -Access-Control-Allow-Origin
front:
image: numerisisep/numeris-front
container_name: numeris_front
build:
context: ./front
dockerfile: Dockerfile.production
networks:
- caddy
labels:
caddy: numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
caddy:
image: lucaslorentz/caddy-docker-proxy:ci-alpine
restart: unless-stopped
environment:
CADDY_INGRESS_NETWORKS: caddy
APP_ENV: production
APP_DEBUG: 'false'
DB_CONNECTION: mysql
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
DB_DATABASE: ${DB_DATABASE}
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
ports:
- "80:80"
- "443:443"
volumes:
# docker rootless daemon socket https://docs.docker.com/engine/security/rootless/
- /var/run/docker.sock:/var/run/docker.sock
- caddy_data:/data
networks:
- caddy
healthcheck:
test: ["CMD", "curl", "-f", "localhost:80"]
networks:
caddy:
external: true
mysql:
volumes:
caddy_data:
mysql:
- ${BACK_PORT}:80
links:
- mysql
depends_on:
- mysql
container_name: numeris_back
-90
View File
@@ -1,90 +0,0 @@
version: "3.9"
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: numeris_phpmyadmin
restart: unless-stopped
ports:
- 3000:80
links:
- mysql:db
depends_on:
- mysql
networks:
- caddy
- mysql
labels:
caddy: phpmyadmin.staging.numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
# mysql:
# image: mysql:5.7
# container_name: numeris_mysql
# restart: unless-stopped
# networks:
# - mysql
# env_file:
# - .env
# volumes:
# - ./var/mysql:/var/lib/mysql
back:
image: numerisisep/numeris-back
container_name: numeris_back
restart: unless-stopped
build:
context: ./back
dockerfile: Dockerfile.production
networks:
- caddy
- mysql
env_file:
- .env
volumes:
- .env:/home/numeris/.env
depends_on:
- mysql
labels:
caddy: api.staging.numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
# caddy.reverse_proxy.header_down: -Access-Control-Allow-Origin
front:
image: numerisisep/numeris-front
container_name: numeris_front
build:
context: ./front
dockerfile: Dockerfile.production
networks:
- caddy
labels:
caddy: staging.numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
# caddy:
# image: lucaslorentz/caddy-docker-proxy:ci-alpine
# restart: unless-stopped
# environment:
# CADDY_INGRESS_NETWORKS: caddy
# ports:
# - "80:80"
# - "443:443"
# volumes:
# # docker rootless daemon socket https://docs.docker.com/engine/security/rootless/
# - /var/run/docker.sock:/var/run/docker.sock
# - caddy_data:/data
# networks:
# - caddy
# healthcheck:
# test: ["CMD", "curl", "-f", "localhost:80"]
networks:
caddy:
external: true
mysql:
volumes:
caddy_data:
mysql:
+28
View File
@@ -0,0 +1,28 @@
version: '3'
services:
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'numeris_testing'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
container_name: numeris_mysql
back:
build:
context: ./back
dockerfile: Dockerfile
environment:
DB_CONNECTION: testing
DB_HOST_TESTING: mysql
DB_PORT_TESTING: 3306
DB_DATABASE_TESTING: numeris_testing
DB_USERNAME_TESTING: root
DB_PASSWORD_TESTING:
ports:
- 8080:80
links:
- mysql
depends_on:
- mysql
container_name: numeris_back
+17 -13
View File
@@ -1,4 +1,4 @@
version: "3.9"
version: '3'
services:
phpmyadmin:
@@ -9,46 +9,50 @@ services:
- mysql:db
depends_on:
- mysql
container_name: numeris_phpmyadmin
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'numeris'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
container_name: numeris_mysql
back:
image: numerisisep/back:dev
container_name: numeris-back
build:
context: ./back
dockerfile: Dockerfile
env_file:
- ./back/.env
- back/.env
environment:
DB_HOST: ${DB_HOST:-mysql}
DB_PORT: ${DB_PORT:-3306}
DB_DATABASE: ${DB_DATABASE:-numeris}
DB_USERNAME: ${DB_USERNAME:-root}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
DB_DATABASE: ${DB_DATABASE}
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
volumes:
- ./back:/home/numeris
- /home/numeris/vendor
ports:
- ${BACK_PORT:-8080}:80
- ${BACK_PORT}:80
links:
- mysql
depends_on:
- mysql
container_name: numeris_back
front:
image: numerisisep/front:dev
container_name: numeris-front
build:
context: ./front
dockerfile: Dockerfile
volumes:
- ./front/src:/home/numeris/src
- /home/numeris/node_modules
links:
- back
expose:
- ${FRONT_PORT}
ports:
- ${FRONT_PORT:-4200}:80
# command: ng serve --host 0.0.0.0
- ${FRONT_PORT}:${FRONT_PORT}
command: ng s --host 0.0.0.0
container_name: numeris_front
-1
View File
@@ -1,4 +1,3 @@
.DS_Store
node_modules/
dist/
Dockerfile
+14 -12
View File
@@ -1,16 +1,18 @@
FROM node:11.15.0 as builder
FROM node:11.15.0
LABEL source="https://github.com/numerisisep/numeris-v2"
LABEL maintainer="support@numeris-isep.fr"
RUN mkdir -p /home/numeris
WORKDIR /opt/numeris
ENV PATH /opt/numeris/node_modules/.bin:$PATH
ENV PATH /home/numeris/node_modules/.bin:$PATH
COPY package.json yarn.lock ./
RUN yarn install
# RUN yarn add -g @angular/cli@7.3.9
COPY . .
RUN yarn run build-prod
COPY package*.json /home/numeris/
EXPOSE 80
ENTRYPOINT [ "ng", "serve", "--host", "0.0.0.0", "--port", "80" ]
# npm install
WORKDIR /home/numeris
RUN npm install
RUN npm install -g @angular/cli@7.3.9
COPY . /home/numeris
RUN npm rebuild node-sass
WORKDIR /home/numeris
-16
View File
@@ -1,16 +0,0 @@
FROM node:11.15.0 as builder
WORKDIR /opt/numeris
ENV PATH /opt/numeris/node_modules/.bin:$PATH
COPY package.json yarn.lock ./
RUN yarn install
# RUN yarn add -g @angular/cli@7.3.9
COPY . .
RUN yarn run build-prod
ENTRYPOINT [ "ng", "serve", "--configuration", "production", "--port", "80" ]
FROM nginx
COPY nginx.conf /etc/nginx/conf.d/default.conf
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /opt/numeris/dist /usr/share/nginx/html
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
-14
View File
@@ -1,14 +0,0 @@
server {
gzip on;
gzip_types text/plain text/css application/javascript;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 1000;
listen 80;
server_name 0.0.0.0;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
+12862
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -60,6 +60,6 @@
"protractor": "~5.4.2",
"ts-node": "~8.0.3",
"tslint": "~5.14.0",
"typescript": "3.1.1"
"typescript": "^3.2.4"
}
}
-8957
View File
File diff suppressed because it is too large Load Diff
+24 -24
View File
@@ -37,83 +37,83 @@ reload: stop start
#############################
back-install:
docker exec -it numeris-back composer install
docker exec -it numeris_back composer install
back-update:
docker exec -it numeris-back composer update
docker exec -it numeris_back composer update
front-install:
docker exec -it numeris-front npm install
docker exec -it numeris_front npm install
front-update:
docker exec -it numeris-front npm update
docker exec -it numeris_front npm update
front-fix-vulnerabilities:
docker exec -it numeris-front npm audit fix
docker exec -it numeris_front npm audit fix
## Shell commands
###################
shell-back:
docker exec -it numeris-back bash
docker exec -it numeris_back bash
shell-front:
docker exec -it numeris-front bash
docker exec -it numeris_front bash
shell-sql:
docker exec -it numeris-mysql bash
docker exec -it numeris_mysql bash
tinker:
docker exec -it numeris-back sh -c 'php artisan tinker'
docker exec -it numeris_back sh -c 'php artisan tinker'
## Database commands
######################
db-reset:
docker exec -it numeris-back sh -c 'php artisan migrate:refresh --seed'
docker exec -it numeris_back sh -c 'php artisan migrate:refresh --seed'
migrate:
docker exec -it numeris-back sh -c 'php artisan migrate'
docker exec -it numeris_back sh -c 'php artisan migrate'
migrate-prod:
docker exec -t numeris-back sh -c 'php artisan migrate --force'
docker exec -t numeris_back sh -c 'php artisan migrate --force'
db-refresh:
docker exec -it numeris-back sh -c 'php artisan migrate:refresh'
docker exec -it numeris_back sh -c 'php artisan migrate:refresh'
migrate-rollback:
docker exec -it numeris-back sh -c 'php artisan migrate:rollback'
docker exec -it numeris_back sh -c 'php artisan migrate:rollback'
db-seed:
docker exec -it numeris-back sh -c 'php artisan db:seed'
docker exec -it numeris_back sh -c 'php artisan db:seed'
## Test commands
###################
test:
docker exec -it numeris-back sh -c 'vendor/bin/phpunit'
docker exec -it numeris_back sh -c 'vendor/bin/phpunit'
## Utils commands
###################
log-back:
docker exec -it numeris-back sh -c 'less +G storage/logs/laravel.log'
docker exec -it numeris_back sh -c 'less +G storage/logs/laravel.log'
config-clear:
docker exec numeris-back sh -c 'php artisan config:clear'
docker exec numeris-back sh -c 'php artisan cache:clear'
docker exec numeris-back sh -c 'php artisan route:clear'
docker exec numeris_back sh -c 'php artisan config:clear'
docker exec numeris_back sh -c 'php artisan cache:clear'
docker exec numeris_back sh -c 'php artisan route:clear'
config-cache:
docker exec numeris-back sh -c 'php artisan route:cache'
docker exec numeris-back sh -c 'php artisan config:cache'
docker exec numeris_back sh -c 'php artisan route:cache'
docker exec numeris_back sh -c 'php artisan config:cache'
key-generate:
docker exec numeris-back sh -c 'php artisan key:generate'
docker exec numeris_back sh -c 'php artisan key:generate'
jwt-secret:
docker exec numeris-back sh -c 'php artisan jwt:secret'
docker exec numeris_back sh -c 'php artisan jwt:secret'