Compare commits

..
36 Commits
Author SHA1 Message Date
marc cd4eb1d8ee good names
Test docker build / back-prod (push) Canceled after 0s
Test docker build / front-prod (push) Canceled after 0s
Test docker build / back-dev (push) Canceled after 0s
Test docker build / front-dev (push) Canceled after 0s
2022-12-12 18:18:36 +01:00
marc af5089f2a0 github action instead of docker-compose 2022-12-12 18:16:17 +01:00
marc f0b2633cfb Merge branch 'master' into infra 2022-12-12 18:10:14 +01:00
marc bf1eb19369 yarn.lock
Docker build test / build-back (push) Canceled after 0s
Docker build test / build-front (push) Canceled after 0s
2022-12-12 18:09:56 +01:00
marc 65e45f2d56 no .env 2022-12-12 18:06:15 +01:00
marc 29322edd5e test on any pr 2022-12-12 18:03:27 +01:00
marc b03f1cdbe6 Merge branch 'dev-docker-compose' into infra 2022-12-12 18:01:47 +01:00
marc b3f0274d1b test dev
Docker build test / build-back (push) Canceled after 0s
Docker build test / build-front (push) Canceled after 0s
2022-12-12 18:00:31 +01:00
marc 1fbd976753 new names 2022-12-12 17:56:57 +01:00
marc e26d352601 Merge branch 'master' into infra 2022-12-12 17:55:20 +01:00
marc 5f3eb5399e dev no prod 2022-12-12 17:54:58 +01:00
marc ead6da4832 dev and prod 2022-12-12 17:50:45 +01:00
marc b14654d2a5 back dockerfile fix 2022-12-12 17:49:20 +01:00
marc 16864bb251 infra 2022-12-12 17:39:48 +01:00
marc bbaefbb18d Merge branch 'master' into infra 2022-12-12 17:38:34 +01:00
marc 4d4a423a6c no expose 2022-12-12 17:38:27 +01:00
marc 249963ced0 prod.yml + staging.yml 2022-12-12 17:36:52 +01:00
marc 6407ca2880 prod 2022-12-12 17:32:32 +01:00
marc 156eb02ce0 docker-compose.infra.yml 2022-12-12 17:30:39 +01:00
marc 79db3c1fcf 127 2022-12-07 15:23:07 +01:00
marc 13ff5bafe7 localhost no sockets 2022-12-07 15:22:34 +01:00
marc 5041afe20d fix 2022-12-07 15:20:37 +01:00
marc 40cf30d84e mounting sockets 2022-12-07 15:18:51 +01:00
marc 0ac9e861eb fix dockerfile front 2022-12-05 01:45:33 +01:00
marc 083c62bf5d no mysql 2022-12-04 23:54:51 +01:00
marc d377682495 docker-compose.staging.yml 2022-12-04 23:51:03 +01:00
marc 5e93d72f14 fix logs 2022-11-14 11:08:40 +01:00
marc 66839cf38b Merge pull request #6 from numeris-isep/marc-contrib 2022-11-05 22:54:44 +01:00
marc 99c79ab92f Merge pull request #5 from numeris-isep/added-github-action 2022-11-05 22:54:22 +01:00
marc 51dbf08c41 Merge pull request #4 from numeris-isep/fixed-docker 2022-11-05 22:54:01 +01:00
marc fc8c1611fa Merge pull request #3 from numeris-isep/fixed-back 2022-11-05 22:53:38 +01:00
marc 13bfdf606d Merge pull request #2 from numeris-isep/fixed-front 2022-11-05 22:53:21 +01:00
marc 4dc06d439d added github action support
Docker build test / build-back (push) Canceled after 0s
Docker build test / build-front (push) Canceled after 0s
2022-10-26 07:29:45 +02:00
marc 826bf35bc4 fixed docker compose files 2022-10-26 07:28:39 +02:00
marc c364757cf4 fixed the front 2022-10-26 07:26:34 +02:00
marc a4409fe221 marc 2022-10-21 22:11:25 +02:00
18 changed files with 9424 additions and 12969 deletions
+3 -1
View File
@@ -4,6 +4,8 @@
.vscode
.DS_Store
docker-compose*.yml
.env
.env.template
# Back
back/.DS_Store
@@ -17,4 +19,4 @@ var
# Front
front/.DS_Store
front/node_modules/
front/dist/
front/dist/
+88
View File
@@ -0,0 +1,88 @@
name: Deploy production
on:
push:
branches:
- "master"
# Publish `v1.2.3` tags as releases.
tags:
- v*
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:prod
cache-from: type=gha
cache-to: type=gha
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:prod
cache-from: type=gha
cache-to: type=gha
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.infra.yml pull
docker-compose -f docker-compose.infra.yml up -d --force-recreate
+86
View File
@@ -0,0 +1,86 @@
name: Deploy staging
on:
push:
branches:
- "staging"
tags:
- v*
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:staging
cache-from: type=gha
cache-to: type=gha
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:staging
cache-from: type=gha
cache-to: type=gha
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.infra.yml pull
docker-compose -f docker-compose.infra.yml up -d --force-recreate
+111
View File
@@ -0,0 +1,111 @@
name: Test docker build
on:
push:
branches:
- "*"
- "!master"
- "!staging"
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
jobs:
back-prod:
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 back prod
uses: docker/build-push-action@v3
with:
context: back
dockerfile: Dockerfile.production
push: false
tags: numerisisep/back:prod
cache-from: type=gha
cache-to: type=gha
front-prod:
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 front prod
uses: docker/build-push-action@v3
with:
context: front
dockerfile: Dockerfile.production
push: false
tags: numerisisep/front:prod
cache-from: type=gha
cache-to: type=gha
back-dev:
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 back dev
uses: docker/build-push-action@v3
with:
context: back
dockerfile: Dockerfile
push: false
tags: numerisisep/back:dev
cache-from: type=gha
cache-to: type=gha
front-dev:
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 front dev
uses: docker/build-push-action@v3
with:
context: front
dockerfile: Dockerfile
push: false
tags: numerisisep/front:dev
cache-from: type=gha
cache-to: type=gha
+5 -1
View File
@@ -17,7 +17,11 @@ 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 rewrite && service apache2 restart
RUN a2dissite 000-default.conf && \
a2ensite numeris.conf && \
a2enmod headers && \
a2enmod rewrite && \
service apache2 restart
# Enable php conf
COPY docker/php/php.ini /usr/local/etc/php/conf.d/default.ini
+11 -3
View File
@@ -1,7 +1,11 @@
{
"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": [
@@ -14,6 +18,11 @@
"name": "MinhNam Nguyen",
"email": "nguyen.minhnam@hotmail.fr",
"role": "Developer"
},
{
"name": "Marc Partensky",
"email": "marc@marcpartensky.com",
"role": "Developer"
}
],
"require": {
@@ -51,8 +60,7 @@
},
"extra": {
"laravel": {
"dont-discover": [
]
"dont-discover": []
}
},
"scripts": {
+2 -2
View File
@@ -13,6 +13,6 @@
Require all granted
</Directory>
ErrorLog /var/log/apache2/numeris-error.log
CustomLog /var/log/apache2/numeris-access.log combined
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
+112
View File
@@ -0,0 +1,112 @@
version: "3.9"
services:
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"]
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}}"
mysql:
image: mysql:5.7
container_name: numeris_mysql
restart: unless-stopped
networks:
- mysql
ports:
- 127.0.0.1:3306:3306
env_file:
- .env
volumes:
- ./var/mysql:/var/lib/mysql
# - /var/run/mysqld:/var/run/mysqld
back:
image: numerisisep/numeris-back:prod
container_name: numeris_back
restart: unless-stopped
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}}"
front:
image: numerisisep/numeris-front:prod
container_name: numeris_front
networks:
- caddy
labels:
caddy: numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
back-staging:
image: numerisisep/numeris-back:staging
container_name: numeris_back
restart: unless-stopped
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}}"
front-staging:
image: numerisisep/numeris-front:staging
container_name: numeris_front
networks:
- caddy
labels:
caddy: staging.numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
networks:
caddy:
external: true
mysql:
volumes:
caddy_data:
mysql:
-42
View File
@@ -1,42 +0,0 @@
version: '3'
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- 3000:80
links:
- mysql:db
depends_on:
- mysql
container_name: numeris_phpmyadmin
mysql:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: 'numeris'
volumes:
- ./var/mysql:/var/lib/mysql
container_name: numeris_mysql
back:
build:
context: ./back
dockerfile: Dockerfile.production
environment:
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:
- ${BACK_PORT}:80
links:
- mysql
depends_on:
- mysql
container_name: numeris_back
-28
View File
@@ -1,28 +0,0 @@
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
+7 -11
View File
@@ -22,19 +22,17 @@ services:
build:
context: ./back
dockerfile: Dockerfile
env_file:
- back/.env
environment:
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
DB_DATABASE: ${DB_DATABASE}
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: numeris
DB_USERNAME: root
DB_PASSWORD:
volumes:
- ./back:/home/numeris
- /home/numeris/vendor
ports:
- ${BACK_PORT}:80
- ${BACK_PORT:-8000}:80
links:
- mysql
depends_on:
@@ -50,9 +48,7 @@ services:
- /home/numeris/node_modules
links:
- back
expose:
- ${FRONT_PORT}
ports:
- ${FRONT_PORT}:${FRONT_PORT}
- ${FRONT_PORT:-8080}:80
command: ng s --host 0.0.0.0
container_name: numeris_front
+1
View File
@@ -1,3 +1,4 @@
.DS_Store
node_modules/
dist/
Dockerfile
+9 -18
View File
@@ -1,18 +1,9 @@
FROM node:11.15.0
RUN mkdir -p /home/numeris
ENV PATH /home/numeris/node_modules/.bin:$PATH
COPY package*.json /home/numeris/
# 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
FROM node:11.15.0 as builder
WORKDIR /opt/numeris
ENV PATH /opt/numeris/node_modules/.bin:$PATH
COPY package.json yarn.lock /opt/numeris/
RUN yarn install
# RUN yarn add -g @angular/cli@7.3.9
COPY . .
RUN yarn run build-prod
ENTRYPOINT [ "ng", "serve", "--port", "80" ]
+17
View File
@@ -0,0 +1,17 @@
FROM node:11.15.0 as builder
WORKDIR /opt/numeris
ENV PATH /opt/numeris/node_modules/.bin:$PATH
COPY package.json /opt/numeris/
COPY yarn.lock /opt/numeris/
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
@@ -0,0 +1,14 @@
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.2.4"
"typescript": "3.1.1"
}
}
+8957
View File
File diff suppressed because it is too large Load Diff