Commit e58c6f69 authored by Sébastien DA ROCHA's avatar Sébastien DA ROCHA

Initial export

parent cae51552
Pipeline #13504 passed with stage
in 2 minutes and 58 seconds
.vscode
node_modules
.env
\ No newline at end of file
stages:
- build
build_development:
stage: build
tags:
- build
only:
- development
script:
- export TAG=$CI_COMMIT_SHORT_SHA
- export RENDERTRON_BIND_PORT=3200
- docker-compose build
- 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/336/trigger/pipeline'
build_release:
stage: build
tags:
- build
only:
- tags
script:
- export TAG=$(echo $CI_COMMIT_TAG | sed 's/v//g')
- export RENDERTRON_BIND_PORT=3200
- docker-compose build
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose push
FROM node:12-stretch
# install Chrome
RUN apt-get update \
&& apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/GoogleChrome/rendertron.git
WORKDIR /rendertron
RUN npm install && npm run build
#ADD make-config-from-env.js .
#ADD entrypoint.sh .
ADD start.sh config.json.template config.py ./
RUN mkdir /cache
EXPOSE 3000
VOLUME ["/cache"]
CMD ["./start.sh"]
# rendertron
# Rendertron
## Installation
Docker image for rendertron (https://github.com/GoogleChrome/rendertron)
## Environment variables
In order to run the code, some environment variables are needed. They are specified in the `template.env` file at the root of the project.
For a local deployment:
1. `cp template.env .env`
2. Edit .env according to the chosen configuration
The values will be read from the file by default when running with docker. If you run the service outside of docker you can export those variables.
## Running the app with docker
```bash
# build
docker-compose build
# deploy
docker-compose up [-d]
# build and deploy
docker-compose up --build [-d]
```
{
"timeout": 10000,
"port": 3000,
"host": "0.0.0.0",
"width": 1000,
"height": 1000,
"reqHeaders": {},
"cache": "filesystem",
"cacheConfig": {
"cacheDurationMinutes": 86400,
"cacheMaxEntries": 1000,
"snapshotDir": "/cache"
},
"renderOnly": [
"https://data.grandlyon.com",
"https://preprod.data.grandlyon.com",
"https://portail-dev.grandlyon.neogeo.fr"
],
"closeBrowserdefault": false,
"restrictedUrlPatterndefault": null
}
{
"timeout": 10000,
"port": 3000,
"host": "0.0.0.0",
"width": 1000,
"height": 1000,
"reqHeaders": {},
"cache": "filesystem",
"cacheConfig": {
"cacheDurationMinutes": 86400,
"cacheMaxEntries": 1000,
"snapshotDir": "/cache"
},
"renderOnly": [
],
"closeBrowserdefault": false,
"restrictedUrlPatterndefault": null
}
#!/usr/bin/env python3
import os
import json
import sys
URL_ALLOWED = os.environ.get("URL_ALLOWED")
if not URL_ALLOWED:
print("Missing value : environment variable URL_ALLOWED")
sys.exit(1)
with open('config.json.template') as template:
config = json.load(template)
config['renderOnly'] = URL_ALLOWED.split(',')
with open('config.json', 'w') as output_file:
json.dump(config, output_file)
version: "3"
services:
rendertron:
build: .
image: registry.forge.grandlyon.com/web-et-numerique/web-et-numerique-internet/data.grandlyon.com/web-portal/components/off-the-shelf-apps/rendertron:${TAG}
ports:
- ${RENDERTRON_BIND_PORT}:3000
environment:
- URL_ALLOWED=${URL_ALLOWED}
restart: unless-stopped
volumes:
- rendertron_cache:/cache
volumes:
rendertron_cache:
#!/bin/bash -e
./config.py
npm run start
TAG=<tag of the image to be used>
RENDERTRON_BIND_PORT=<proxy port>
URL_ALLOWED=<urls allowed to be rendered (comma separated value for multiple values)>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment