Skip to content

Commit

Permalink
Merge pull request #1179 from EcrituresNumeriques/feature/1178
Browse files Browse the repository at this point in the history
  • Loading branch information
thom4parisot authored Jan 22, 2025
2 parents 32a438b + 6838a25 commit bbdf148
Show file tree
Hide file tree
Showing 40 changed files with 399 additions and 7,277 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ on:
env:
SNOWPACK_PUBLIC_BACKEND_ENDPOINT: https://stylo.huma-num.fr
SNOWPACK_PUBLIC_GRAPHQL_ENDPOINT: https://stylo.huma-num.fr/graphql
SNOWPACK_PUBLIC_EXPORT_ENDPOINT: https://stylo.ecrituresnumeriques.ca
SNOWPACK_PUBLIC_PANDOC_EXPORT_ENDPOINT: https://export.stylo.huma-num.fr
SNOWPACK_PUBLIC_HUMAN_ID_REGISTER_ENDPOINT: https://humanid.huma-num.fr/register?service=https://stylo.huma-num.fr/authorization-code/callback
SNOWPACK_MATOMO_URL: https://analyseweb.huma-num.fr/
SNOWPACK_MATOMO_SITE_ID: 286
SNOWPACK_PUBLIC_ANNOTATIONS_CANONICAL_BASE_URL: https://stylo.ecrituresnumeriques.ca
SENTRY_DSN: https://276d5080680a70a3edf98783a2b264d0@o4507130700496896.ingest.de.sentry.io/4507130704560208
SENTRY_ENVIRONMENT: prod

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ on:
env:
SNOWPACK_PUBLIC_BACKEND_ENDPOINT: https://stylo-dev.huma-num.fr
SNOWPACK_PUBLIC_GRAPHQL_ENDPOINT: https://stylo-dev.huma-num.fr/graphql
SNOWPACK_PUBLIC_EXPORT_ENDPOINT: https://stylo-dev.huma-num.fr
SNOWPACK_PUBLIC_PANDOC_EXPORT_ENDPOINT: https://export.stylo-dev.huma-num.fr
SNOWPACK_PUBLIC_HUMAN_ID_REGISTER_ENDPOINT: https://auth-test.huma-num.fr/register?service=https://stylo-dev.huma-num.fr/authorization-code/callback
SNOWPACK_MATOMO_URL: https://analyseweb.huma-num.fr/
SNOWPACK_MATOMO_SITE_ID: 286
SNOWPACK_PUBLIC_ANNOTATIONS_CANONICAL_BASE_URL: https://stylo-dev.huma-num.fr
SENTRY_DSN: https://276d5080680a70a3edf98783a2b264d0@o4507130700496896.ingest.de.sentry.io/4507130704560208
SENTRY_ENVIRONMENT: dev

Expand Down
82 changes: 41 additions & 41 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ on:
type: string
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v2.1.3
- 'v*' # Push events to matching v*, i.e. v1.0, v2.1.3
branches:
- master
- master
paths:
- 'graphql/**'
- 'front/**'
- 'export/**'
- '.github/workflows/docker.yml'
- 'docker-compose.yaml'
- 'stylo-example.env'
- 'graphql/**'
- 'front/**'
- 'export/**'
- '.github/workflows/docker.yml'
- 'docker-compose.yaml'
- 'stylo-example.env'
pull_request:
paths:
- 'graphql/dockerfile'
- 'front/dockerfile'
- 'export/dockerfile'
- '.github/workflows/docker.yml'
- 'docker-compose.yaml'
- 'stylo-example.env'
- 'graphql/dockerfile'
- 'front/dockerfile'
- 'export/dockerfile'
- '.github/workflows/docker.yml'
- 'docker-compose.yaml'
- 'stylo-example.env'

jobs:
build-and-push:
Expand All @@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: true
matrix:
app: [front-stylo, graphql-stylo, export-stylo]
app: [front-stylo, graphql-stylo]

# A couple of things need to be done to perform an automated push of Stylo Docker images on GitHub
# 1. For each Stylo "Package" in EcrituresNumeriques, add People or Teams and set their access (Read, Write or Admin)
Expand All @@ -57,33 +57,33 @@ jobs:
TAG: ${{ inputs.release-version || 'latest' }}

steps:
- uses: actions/checkout@v4
with:
ref: ${{ (inputs.release-version && format('v{0}', inputs.release-version)) || github.ref }}
- uses: docker/setup-buildx-action@v3
- run: cp stylo-example.env .env
- uses: actions/checkout@v4
with:
ref: ${{ (inputs.release-version && format('v{0}', inputs.release-version)) || github.ref }}
- uses: docker/setup-buildx-action@v3
- run: cp stylo-example.env .env

# Needed to expose ACTIONS_CACHE_URL and ACTIONS_RUNTIME_URL variables
# Which are unreachable outside of an action context
- uses: crazy-max/ghaction-github-runtime@v3
# Needed to expose ACTIONS_CACHE_URL and ACTIONS_RUNTIME_URL variables
# Which are unreachable outside of an action context
- uses: crazy-max/ghaction-github-runtime@v3

# https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-from
# https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-to
# https://docs.docker.com/build/ci/github-actions/examples/#github-cache
# https://docs.docker.com/build/bake/compose-file/
# buildx bake `--cache-from=type=gha` somewhat assumes Docker Hub is the registry, even though the image name tells it otherwise
# hence the repeated `--set` flags
# it could be better by factoring `--set` options
- name: Build images
run: |
docker buildx bake -f docker-compose.yaml \
--set '*.platform=linux/amd64' \
--set *.args.SENTRY_RELEASE=${{ inputs.release-version || 'latest' }} \
--load --pull ${{ matrix.app }}
# https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-from
# https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-to
# https://docs.docker.com/build/ci/github-actions/examples/#github-cache
# https://docs.docker.com/build/bake/compose-file/
# buildx bake `--cache-from=type=gha` somewhat assumes Docker Hub is the registry, even though the image name tells it otherwise
# hence the repeated `--set` flags
# it could be better by factoring `--set` options
- name: Build images
run: |
docker buildx bake -f docker-compose.yaml \
--set '*.platform=linux/amd64' \
--set *.args.SENTRY_RELEASE=${{ inputs.release-version || 'latest' }} \
--load --pull ${{ matrix.app }}
- name: Login to GitHub Container Registry ghcr.io
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Login to GitHub Container Registry ghcr.io
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- if: ${{ github.ref_type == 'tag' || github.ref_name == 'master' || github.ref_name == 'main' }}
name: Push images (on tag, or default branch)
run: docker buildx bake -f docker-compose.yaml --push ${{ matrix.app }}
- if: ${{ github.ref_type == 'tag' || github.ref_name == 'master' || github.ref_name == 'main' }}
name: Push images (on tag, or default branch)
run: docker buildx bake -f docker-compose.yaml --push ${{ matrix.app }}
19 changes: 0 additions & 19 deletions .github/workflows/node-export.yml

This file was deleted.

11 changes: 5 additions & 6 deletions HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Depending on your needs, you may want to install Stylo in different ways :

- [With Docker](#run-with-docker) (suited to run Stylo rapidly)
- [Without Docker](#run-without-docker) (suited to tailor your Stylo setup)
- [With Docker](#run-with-docker) (suited to run Stylo rapidly)
- [Without Docker](#run-without-docker) (suited to tailor your Stylo setup)

[Ansible playbooks](#deploy-with-ansible) enable you to deploy Stylo on a remote machine, accessible with the SSH protocol.

Expand All @@ -13,10 +13,8 @@ You can find various pointers in our [GitHub Actions automations](./.github/work

First step is to clone the project, you can use either the HTTPS or SSH version of the repository URL:


$ git clone [email protected]:EcrituresNumeriques/stylo.git


## Run with Docker

Useful to run a fully fledged Stylo in no time.
Expand All @@ -29,9 +27,11 @@ Run the following command:
**NOTE:** The first time, this command can take a few dozen minutes depending on your network speed and machine capabilities. Subsequent calls will be faster.

This gives your access to:

- Stylo (frontend): http://localhost:3000
- GraphQL endpoint: http://localhost:3030
- Export endpoint: http://localhost:3060
- Export endpoint: http://localhost:3080
- Pandoc API: http://localhost:3090

## Run without Docker

Expand All @@ -54,7 +54,6 @@ After _cloning_ the repo, build the service and its dependencies:
$ npm clean-install
$ npm start


After the image is built, you should have a Stylo instance running on your server.
Now, we need to expose it to the outside world with a reverse proxy.

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ L'application se lance en combinant une base de données MongoDB, et des applica
cp stylo-example.env .env
npm clean-install
npm --prefix front clean-install
npm --prefix export clean-install
npm --prefix graphql clean-install
```

Expand Down Expand Up @@ -71,7 +70,7 @@ docker compose run -ti --build --rm graphql-stylo npm run generate-service-token
Ensuite, ainsi que le reste du temps :

```bash
docker compose up mongodb-stylo export-gateway pandoc-api
docker compose up mongodb-stylo export-stylo pandoc-api
npm run dev
```

Expand All @@ -87,6 +86,6 @@ Pour installer une instance Stylo en tant que service à disposition d'utilisate
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FEcrituresNumeriques%2Fstylo.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FEcrituresNumeriques%2Fstylo?ref=badge_shield)


## License

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FEcrituresNumeriques%2Fstylo.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FEcrituresNumeriques%2Fstylo?ref=badge_large)
19 changes: 2 additions & 17 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,6 @@ services:
ports:
- 127.0.0.1:3030:3030

export-stylo:
build:
context: ./export/
labels:
- org.opencontainers.image.source=https://github.com/EcrituresNumeriques/stylo
container_name: 'export-stylo' # export-stylo-legacy
image: 'ghcr.io/ecrituresnumeriques/stylo-export:${TAG:-latest}'
depends_on:
mongodb-stylo:
condition: service_healthy
env_file:
- .env
ports:
- 127.0.0.1:3060:3060

front-stylo:
build:
context: ./front
Expand All @@ -67,9 +52,9 @@ services:
depends_on:
- graphql-stylo

export-gateway:
export-stylo:
image: 'davidbgk/stylo-export:2.0.0'
container_name: 'export-gateway' # export-stylo-modern
container_name: 'export-stylo'
env_file:
- .env
environment:
Expand Down
12 changes: 0 additions & 12 deletions export/dockerfile

This file was deleted.

Loading

0 comments on commit bbdf148

Please sign in to comment.