Skip to content

Commit

Permalink
feat: use sqlite and more (#108)
Browse files Browse the repository at this point in the history
* feat: use sqlite

* snap

* snap

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* gh actions

* fix

* gha

* fix

* add indexing workflow

* fix

* gh

* gh

* fix

* fix

* fix

* fix

* fix

* index: throw error

* fix

* chore: wkfl

* fix workflows

* fix: dev secrets

* fix

* update API and mapping

* fix tests / sort out address issue from geo data

* update query params

* Update README.md

* fix(ci): adjust resources

* wip: indexing

* feat(api): add swagger doc

* wip: readmes

* wip: k8s+gh actions

* doc

* fix(index): fix dockerfile

* fix(index): wait longer and try harder

* feat: add frontend demo

* fix(front): REACT_APP_API_URL runtime variable

* fix: snaps

* fix(api): embed openapi.yaml

* fix(api): swagger

* fix(api): fix docker+swagger

* fix(api): openapi

* fix(api): onlyWithConvention -> convention + update front demo

* fix: snaps

* add not ranked option #73 #112

* upgrade packages / delete assembly

* update github actions + move to node 16

* fix: #50 multiple convention for one etablissement

* add prenom to naming searchfield

* fix(ci): update workflows and default index

* fix(ci): dev secrets

* snaps

* fix(ci): prod secrets

* update and fix tests

* chore: add codeql-config

* chore: use codeql-config

* feat: add additional api-legacy component

* fix(ci): search labels

Co-authored-by: Remi Mélisson <rmelisson@gmail.com>
  • Loading branch information
Julien Bouquillon and rmelisson authored Dec 3, 2021
1 parent 48c17db commit b8168f0
Show file tree
Hide file tree
Showing 89 changed files with 17,807 additions and 3,842 deletions.
7 changes: 7 additions & 0 deletions .github/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: "CodeQL config"

paths:
- index
- api
paths-ignore:
- api/swagger-ui
3 changes: 2 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'python' ]
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
Expand All @@ -46,6 +46,7 @@ jobs:
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql-config.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/deactivate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Deactivate

on:
pull_request:
types: [closed]

jobs:
bury_review_env:
name: 🪦 Review
runs-on: ubuntu-latest
steps:
- uses: SocialGouv/actions/autodevops-deactivate@V1
with:
kube-config: ${{ secrets.KUBECONFIG }}
github-token: ${{ secrets.GITHUB_TOKEN }}
47 changes: 43 additions & 4 deletions .github/workflows/indexing-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,52 @@ on:

concurrency:
cancel-in-progress: true
group: indexing
group: indexing-dev

jobs:
index:
name: Index
name: Index Dev
runs-on: ubuntu-latest
steps:
- name: Echo
- name: Checkout repository
uses: actions/checkout@v2

- name: Yarn cache setup
uses: c-hive/gha-yarn-cache@v2
with:
directory: .k8s

- name: Install kosko-charts dependencies
shell: bash
run: yarn --cwd .k8s install --frozen-lockfile --prefer-offline

- name: Generate indexing job
shell: bash
run: yarn --cwd .k8s --silent generate --env dev jobs/indexing > indexing.yml
env:
RANCHER_PROJECT_ID: ${{ secrets.RANCHER_PROJECT_ID }}
SOCIALGOUV_BASE_DOMAIN: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}

- name: Archive indexing job
uses: actions/upload-artifact@v2
with:
name: indexing.yml
path: indexing.yml

- name: Get namespace name
uses: mikefarah/yq@master
id: namespace
with:
cmd: yq eval ".metadata.namespace" indexing.yml | head -n 1

- name: Create kubernetes config
shell: bash
run: |
mkdir ~/.kube
touch ~/.kube/config
echo ${{ secrets.KUBECONFIG }} | base64 -d > ~/.kube/config
- name: Launch indexing Job
shell: bash
run: echo "Hello, world"
run: |
kubectl apply -f indexing.yml --namespace ${{ steps.namespace.outputs.result }}
57 changes: 57 additions & 0 deletions .github/workflows/indexing-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Indexing (prod)

on:
workflow_dispatch:

concurrency:
cancel-in-progress: true
group: indexing-prod

jobs:
index:
name: Index Prod
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Yarn cache setup
uses: c-hive/gha-yarn-cache@v2
with:
directory: .k8s

- name: Install kosko-charts dependencies
shell: bash
run: yarn --cwd .k8s install --frozen-lockfile --prefer-offline

- name: Generate indexing job
shell: bash
# HACK: we use preprod to run the job on the dev cluster
run: yarn --cwd .k8s --silent generate --env preprod jobs/indexing > indexing.yml
env:
RANCHER_PROJECT_ID: ${{ secrets.RANCHER_PROJECT_ID }}
SOCIALGOUV_BASE_DOMAIN: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}

- name: Archive indexing job
uses: actions/upload-artifact@v2
with:
name: indexing.yml
path: indexing.yml

- name: Get namespace name
uses: mikefarah/yq@master
id: namespace
with:
cmd: yq eval ".metadata.namespace" indexing.yml | head -n 1

- name: Create kubernetes config
shell: bash
run: |
mkdir ~/.kube
touch ~/.kube/config
echo ${{ secrets.KUBECONFIG }} | base64 -d > ~/.kube/config
- name: Launch indexing Job
shell: bash
run: |
kubectl apply -f indexing.yml --namespace ${{ steps.namespace.outputs.result }}
75 changes: 75 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Production

on:
push:
tags:
- v*

concurrency:
group: production
cancel-in-progress: true

jobs:
##############################################################################
## BUILD AND REGISTER DOCKER IMAGE
##############################################################################
register:
name: Build & Register docker images
runs-on: ubuntu-latest
steps:
- name: Get project name
run: |
echo "project=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Register API
uses: SocialGouv/actions/autodevops-build-register@v1
with:
project: ${{ env.project }}
imageName: ${{ env.project }}/search
token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: ./api/Dockerfile
dockercontext: ./api

- name: Register Frontend (demo)
uses: SocialGouv/actions/autodevops-build-register@v1
with:
project: ${{ env.project }}
imageName: ${{ env.project }}/front
token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: ./front/Dockerfile
dockercontext: ./front

- name: Register Indexing
uses: SocialGouv/actions/autodevops-build-register@v1
with:
project: ${{ env.project }}
imageName: ${{ env.project }}/index
token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: ./index/Dockerfile
dockercontext: ./index

##############################################################################
## DEPLOY PRODUCTION APPLICATION
##############################################################################
deploy-prod:
name: Deploy production
runs-on: ubuntu-latest
needs: [register]
environment:
name: production
url: https://recherche-entreprises.fabrique.social.gouv.fr
steps:
- name: Use k8s manifests generation
uses: SocialGouv/actions/k8s-manifests@v1
with:
environment: "prod"
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}

- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-deploy@v1
with:
environment: "prod"
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Release

on:
workflow_dispatch:
push:
branches: [master, alpha, beta, next]

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: SocialGouv/actions/autodevops-release@v1
with:
github-token: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
author-name: ${{ secrets.SOCIALGROOVYBOT_NAME }}
author-email: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
81 changes: 81 additions & 0 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Review

on:
push:
branches:
- "**"
tags-ignore:
- v*

concurrency:
cancel-in-progress: true
group: ${{ github.ref }}

jobs:
##############################################################################
## BUILD AND REGISTER DOCKER IMAGES
##############################################################################
register:
name: Build & Register
runs-on: ubuntu-latest
steps:
- name: Get project name
run: |
echo "project=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Register API
uses: SocialGouv/actions/autodevops-build-register@v1
with:
project: ${{ env.project }}
imageName: ${{ env.project }}/search
token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: ./api/Dockerfile
dockercontext: ./api

- name: Register Frontend (demo)
uses: SocialGouv/actions/autodevops-build-register@v1
with:
project: ${{ env.project }}
imageName: ${{ env.project }}/front
token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: ./front/Dockerfile
dockercontext: ./front

- name: Register Indexing
uses: SocialGouv/actions/autodevops-build-register@v1
with:
project: ${{ env.project }}
imageName: ${{ env.project }}/index
token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: ./index/Dockerfile
dockercontext: ./index

##############################################################################
## GENERATE KUBERNETES MANIFESTS
##############################################################################
manifests:
name: Generate k8s manifests
runs-on: ubuntu-latest
steps:
- name: Use k8s manifests generation
uses: SocialGouv/actions/k8s-manifests@v1
with:
environment: "dev"
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}

##############################################################################
## DEPLOY APPLICATION OVER KUBERNETES
##############################################################################
deploy:
name: Deploy application
runs-on: ubuntu-latest
needs: [register, manifests]
steps:
- name: Use autodevops deployment
uses: SocialGouv/actions/autodevops-deploy@v1
with:
environment: "dev"
token: ${{ secrets.GITHUB_TOKEN }}
kubeconfig: ${{ secrets.KUBECONFIG }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
Loading

0 comments on commit b8168f0

Please sign in to comment.