Skip to content
Snippets Groups Projects
Commit 57719a8e authored by Alessandro Cerioni's avatar Alessandro Cerioni
Browse files

Added GitLab CI. Loading the configuration from environment variables.

parent 2637cf26
No related branches found
No related tags found
No related merge requests found
Pipeline #
variables:
GHOST_API: https://ghost-intothesky.alpha.grandlyon.com/ghost/api
#GHOST_ADMIN_API_KEY:
INDEXER__ES_URL: https://elastic2.alpha.grandlyon.com
INDEXER__ES_POSTS_INDEX: posts.ingest.v5
INDEXER__ES_PAGES_INDEX: pages.ingest.v5
REINDEXER__ES_SOURCE_URL: https://elastic2.alpha.grandlyon.com:443
REINDEXER__ES_DESTINATION_URL: https://elastic2.alpha.grandlyon.com
REINDEXER__SOURCE_POSTS_INDEX: posts.ingest.v5
REINDEXER__SOURCE_PAGES_INDEX: pages.ingest.v5
REINDEXER__DESTINATION_POSTS_INDEX: posts.v5
REINDEXER__DESTINATION_PAGES_INDEX: pages.v5
REINDEXER__POSTS_TEMPLATE_NAME: ghost-posts-template
REINDEXER__PAGES_TEMPLATE_NAME: ghost-pages-template
stages:
- build
- deploy
build_development:
stage: build
only:
- development
script:
- export TAG=dev
- export CONTENT_INDEXER_BIND_PORT=4000
- docker-compose build
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose push
build_release:
stage: build
only:
- tags
except:
- /^(?!master).+@/
script:
- export TAG=$(echo $CI_COMMIT_TAG | sed 's/v//g')
- export CONTENT_INDEXER_BIND_PORT=4000
- docker-compose build
- 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 CONTENT_INDEXER_BIND_PORT=4000
- envsubst < config.template.yml > config.yml
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose pull
- docker-compose --project-name service-email-${TAG} up -d --force-recreate
environment:
name: development
deploy_staging:
stage: deploy
only:
- development
when: manual
script:
- export TAG=staging
- export CONTENT_INDEXER_BIND_PORT=4100
- envsubst < config.template.yml > config.yml
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- TAG=dev docker-compose pull
- docker tag $CI_REGISTRY/refonte-data/service-email:dev $CI_REGISTRY/refonte-data/service-email:${TAG}
- docker push $CI_REGISTRY/refonte-data/service-email:${TAG}
- docker-compose --project-name service-email-${TAG} up -d --force-recreate
environment:
name: staging
content_getter:
# wp_api: <the_wordpress_api_url>
# wp_username: <the_wordpress_username>
# wp_password: <the_wordpress_password>
ghost_api: <the_ghost_api_url, ex. https://your-domain/ghost/api>
ghost_admin_api_key: <the_ghost_admin_api_key>
ghost_api: ${GHOST_API}
ghost_admin_api_key: ${GHOST_ADMIN_API_KEY}
indexer:
url: <the_elasticsearch_url>
url: ${INDEXER__ES_URL}
index:
posts: <the_elasticsearch_index_for_posts>
pages: <the_elasticsearch_index_for_pages>
posts: ${INDEXER__ES_POSTS_INDEX}
pages: ${INDEXER__ES_PAGES_INDEX}
reindexer:
source_url: <the_source_elasticsearch_url>
destination_url: <the_destination_elasticsearch_url>
source_url: ${REINDEXER__ES_SOURCE_URL}
destination_url: ${REINDEXER__ES_DESTINATION_URL}
source_index:
posts: <the_source_elasticsearch_index_for_posts>
pages: <the_source_elasticsearch_index_for_pages>
posts: ${REINDEXER__SOURCE_POSTS_INDEX}
pages: ${REINDEXER__SOURCE_PAGES_INDEX}
destination_index:
posts: <the_destination_elasticsearch_index_for_posts>
pages: <the_destination_elasticsearch_index_for_pages>
posts: ${REINDEXER__DESTINATION_POSTS_INDEX}
pages: ${REINDEXER__DESTINATION_PAGES_INDEX}}
template:
posts: <the_name_to_use_for_the_elasticsearch_dynamic_template_for_posts>
pages: <the_name_to_use_for_the_elasticsearch_dynamic_template_for_pages>
posts: ${REINDEXER__POSTS_TEMPLATE_NAME}
pages: ${REINDEXER__PAGES_TEMPLATE_NAME}
......@@ -3,7 +3,8 @@ version: "3.0"
services:
api:
build: .
image: registry.alpha.grandlyon.com/refonte-data/content-indexer:${TAG}
ports:
- 8000:8000
- ${CONTENT_INDEXER_BIND_PORT}:8000
volumes:
- ./config.yaml:/app/config.yaml
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment