Skip to content
Snippets Groups Projects
Commit 7ab8302c authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Remove conf and code related to deployment as it has been moved to a dedicated project

parent f8f7e627
Branches
Tags
1 merge request!18Update the license
Pipeline #3709 passed
stages:
- sonar-analysis
- build
- deploy
variables:
SONAR_URL: https://sonarqube.forge.grandlyon.com
......@@ -9,7 +8,7 @@ variables:
sonarqube:
stage: sonar-analysis
only:
- development
- master
before_script:
- export PATH=$PATH:/usr/local/bin/sonar-scanner-3.2.0.1227-linux/bin/
- export NODE_PATH=$NODE_PATH:`npm root -g`
......@@ -31,12 +30,14 @@ build_development:
only:
- development
script:
- export TAG=dev
- export APP_PORT=8090
- export TAG=$CI_COMMIT_SHORT_SHA
- echo ${TAG}
- export ADMIN_GUI_BIND_PORT=8090
- export CONFIG_FILE_PATH=./config/config.json
- docker-compose build --build-arg conf=prod admin-gui
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose push
- "curl -X POST -F token=$CI_JOB_TOKEN -F ref=master -F variables[TAG]=${TAG} https://forge.grandlyon.com/api/v4/projects/320/trigger/pipeline"
build_release:
stage: build
......@@ -46,40 +47,9 @@ build_release:
- tags
script:
- export TAG=$(echo $CI_COMMIT_TAG | sed 's/v//g')
- export APP_PORT=8090
- echo ${TAG}
- export ADMIN_GUI_BIND_PORT=8090
- export CONFIG_FILE_PATH=./config/config.json
- docker-compose build --build-arg conf=prod admin-gui
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose push
deploy_development:
stage: deploy
only:
- development
script:
- export TAG=dev
- export APP_PORT=8090
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose pull
- export CONFIG_FILE_PATH=./config/config-dev.json
- docker-compose --project-name admin-gui-${TAG} up -d --force-recreate
environment:
name: development
deploy_staging:
stage: deploy
only:
- development
when: manual
script:
- export TAG=staging
- export APP_PORT=8190
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- TAG=dev docker-compose pull
- export REGISTRY_PATH=web-et-numerique/web-et-numerique-internet/data.grandlyon.com/web-portal/components/custom-apps/admin-gui
- docker tag $CI_REGISTRY/$REGISTRY_PATH:dev $CI_REGISTRY/$REGISTRY_PATH:${TAG}
- docker push $CI_REGISTRY/$REGISTRY_PATH:${TAG}
- export CONFIG_FILE_PATH=./config/config-rec.json
- docker-compose --project-name admin-gui-${TAG} up -d --force-recreate
environment:
name: staging
# AdminGui
# Admin GUI
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.8.
## Installation and usage
## Development server
The interface has been developed with the Angular framework, so you need to have Node.js installed on your machine in order to run the web application.
Once you have Node.js installed you need to install the Angular CLI. Open a command line and run:
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
```bash
npm install -g @angular/cli
```
## Code scaffolding
### Configuration
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
Open the /src/assets/config/config.json file and update the configuration in order to match yours.
## Build
### Run the web application
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
Using the Angular CLI:
## Running unit tests
```bash
ng serve
```
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
Using the npm script (which use the Angular CLI):
## Running end-to-end tests
```bash
npm run start
```
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
### Build the application
## Further help
We defined in the package.json two scripts that can build the application. One that generates an optimized build and the other an unoptimized build. The optimized build takes longer than the normal one.
Those two scripts contain an option --max_old_space_size=\<nb of max RAM octets the node process can take\>. Make sure the number does not exceed your RAM capacity (you can simply remove the option, it will use the default value: 512mb on 32-bit systems and 1gb on 64-bit systems). By incrising the node process memory limit we decrease the build time.
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
For development environment (not optimized)
```bash
npm run build:dev
```
For production environment (optimized)
```bash
npm run build:prod
```
### Build and deploy with Docker
The related files are:
* docker-compose.yml which indicates what Dockerfile should be used, what image is going to be build, volumes, exposed port...
* Dockerfile which describe the steps to build the docker image.
Some environment variables need to be set before building or running the image. Use the appropriate command to set those variables: SET on Windows, export on Linux.
```bash
export TAG=<version>
export ADMIN_GUI_BIND_PORT=<port the application should be running on>
```
Then to build the image run:
```bash
docker-compose build --build-arg conf=prod admin-gui #you can change prod to dev if you don't want an optimized build
```
Once the image is built on your machine, run the following command to start a container:
```bash
docker-compose --project-name admin-gui up
```
{
"organizations": {
"url": "https://data-reloaded-dev.alpha.grandlyon.com/api/organizations/organizations/"
},
"resources": {
"url": "https://data-reloaded-dev.alpha.grandlyon.com/api/resources/"
},
"mediaLibrary": {
"url": "https://data-reloaded-dev.alpha.grandlyon.com/api/media-library/"
},
"authentication": {
"url": "https://data-reloaded-dev.alpha.grandlyon.com/api/authentication/"
},
"middlewareLegacyAuth": {
"url": "https://data-reloaded-dev.alpha.grandlyon.com/api/middleware-legacy/"
},
"changelog": {
"url": "https://data-reloaded-dev.alpha.grandlyon.com/api/changelog/"
},
"credits": {
"url": "https://data-reloaded-dev.alpha.grandlyon.com/api/credits/credits/"
},
"restHeartAggregations": {
"url": "https://data-reloaded-dev.alpha.grandlyon.com/api/indexer-logs/indexerdb/"
},
"reuses": {
"url": "https://data-reloaded-dev.alpha.grandlyon.com/api/reuses/"
}
}
{
"organizations": {
"url": "https://data-reloaded-rec.alpha.grandlyon.com/api/organizations/organizations/"
},
"resources": {
"url": "https://data-reloaded-rec.alpha.grandlyon.com/api/resources/"
},
"mediaLibrary": {
"url": "https://data-reloaded-rec.alpha.grandlyon.com/api/media-library/"
},
"authentication": {
"url": "https://data-reloaded-rec.alpha.grandlyon.com/api/authentication/"
},
"middlewareLegacyAuth": {
"url": "https://data-reloaded-rec.alpha.grandlyon.com/api/middleware-legacy/"
},
"changelog": {
"url": "https://data-reloaded-rec.alpha.grandlyon.com/api/changelog/"
},
"credits": {
"url": "https://data-reloaded-rec.alpha.grandlyon.com/api/credits/credits/"
},
"reuses": {
"url": "https://data-reloaded-rec.alpha.grandlyon.com/api/reuses/"
},
"restHeartAggregations": {
"url": "https://data-reloaded-rec.alpha.grandlyon.com/api/indexer-logs/indexerdb/"
}
}
\ No newline at end of file
......@@ -5,9 +5,8 @@ services:
build: .
image: registry.forge.grandlyon.com/web-et-numerique/web-et-numerique-internet/data.grandlyon.com/web-portal/components/custom-apps/admin-gui:${TAG}
volumes:
- ${PWD}/nginx.conf.template:/etc/nginx/sites-enabled/default:ro
- ${CONFIG_FILE_PATH}:/usr/share/nginx/html/admin/assets/config/config.json:ro
- ./nginx.conf.template:/etc/nginx/sites-enabled/default:ro
ports:
- ${APP_PORT}:8080
- ${ADMIN_GUI_BIND_PORT}:8080
restart: unless-stopped
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment