Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flagr latch #593

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cd_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Publish Docker SemVer Tag
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: openflagr/flagr
name: Allen-Career-Institute/flagr
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Changelog

https://github.com/openflagr/flagr/releases
https://github.com/Allen-Career-Institute/flagr/releases
44 changes: 33 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
######################################
# Prepare npm_builder
######################################
FROM node:16 as npm_builder
WORKDIR /go/src/github.com/openflagr/flagr
ADD . .
FROM node:18 as npm_builder
WORKDIR /go/src/github.com/Allen-Career-Institute/flagr
ARG ENVIRONMENT=local
ENV ENVIRONMENT=${ENVIRONMENT}
COPY . .
ARG FLAGR_UI_POSSIBLE_ENTITY_TYPES=null
ENV VUE_APP_FLAGR_UI_POSSIBLE_ENTITY_TYPES ${FLAGR_UI_POSSIBLE_ENTITY_TYPES}
RUN make build_ui
Expand All @@ -12,29 +14,49 @@ RUN make build_ui
# Prepare go_builder
######################################
FROM golang:1.21-alpine as go_builder
WORKDIR /go/src/github.com/openflagr/flagr
WORKDIR /go/src/github.com/Allen-Career-Institute/flagr

RUN apk add --no-cache git make build-base
ADD . .
RUN apk add --no-cache build-base git make
COPY . .
RUN make build

FROM alpine

COPY --from=go_builder /go/src/github.com/openflagr/flagr/flagr .
COPY --from=go_builder /go/src/github.com/Allen-Career-Institute/flagr/flagr .

ENV HOST=0.0.0.0
# ENV PORT=3000 (for local testing)
ENV PORT=18000

ENV FLAGR_DB_DBDRIVER=sqlite3
ENV FLAGR_DB_DBCONNECTIONSTR=/data/demo_sqlite3.db
ENV FLAGR_RECORDER_ENABLED=false

COPY --from=npm_builder /go/src/github.com/openflagr/flagr/browser/flagr-ui/dist ./browser/flagr-ui/dist
ENV FLAGR_RECORDER_ENABLED=true

# JWT Environment Variables
ENV FLAGR_JWT_AUTH_ENABLED=true
ENV FLAGR_JWT_AUTH_DEBUG=true
ENV FLAGR_JWT_AUTH_WHITELIST_PATHS="/api/v1/health,/api/v1/evaluation,/login,/callback,/static,/favicon.ico"
ENV FLAGR_JWT_AUTH_EXACT_WHITELIST_PATHS=",/,/login,/callback"
ENV FLAGR_JWT_AUTH_COOKIE_TOKEN_NAME="access_token"
# ENV FLAGR_JWT_AUTH_SECRET="secret"
ENV FLAGR_JWT_AUTH_NO_TOKEN_STATUS_CODE=307
# ENV FLAGR_JWT_AUTH_NO_TOKEN_REDIRECT_URL="http://localhost:3000/login" (for local testing)
# ENV FLAGR_JWT_AUTH_NO_TOKEN_REDIRECT_URL="http://localhost:18000/login" (to be overriden in k8 yaml file as per env)
ENV FLAGR_JWT_AUTH_USER_CLAIM=uid
ENV FLAGR_JWT_AUTH_SIGNING_METHOD=HS256

# CORS Environment Variables
ENV FLAGR_CORS_ALLOWED_METHODS="GET,POST,PUT,DELETE,PATCH,OPTIONS"
ENV FLAGR_CORS_ALLOWED_HEADERS="*"

COPY --from=npm_builder /go/src/github.com/Allen-Career-Institute/flagr/browser/flagr-ui/dist ./browser/flagr-ui/dist

RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser

ADD --chown=appuser:appgroup ./buildscripts/demo_sqlite3.db /data/demo_sqlite3.db
COPY --chown=appuser:appgroup ./buildscripts/demo_sqlite3.db /data/demo_sqlite3.db

# EXPOSE 3000 (for local testing)
EXPOSE 18000

CMD "./flagr"
15 changes: 15 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Wiki: https://acikota.atlassian.net/wiki/spaces/Platform/pages/311787592/Centralising+stages+of+the+pipeline+for+golang+backend+services
@Library('Allen_Shared_Libraries') _
commonPipelineForGolang(
jenkinsAgentImage: '537984406465.dkr.ecr.ap-south-1.amazonaws.com/allen-jenkins-agent:v4',
environment: [
GOPRIVATE : "https://github.com/Allen-Career-Institute/*",
DEPLOY_GITOPS_REPO : "central-gitops-repo",
DEPLOY_TARGET_FILE : "app-charts/flagr/values-dev.yaml",
DEPLOY_TARGET_FILE_LIVE : "app-charts-live/flagr/values-dev.yaml",
DEPLOY_TARGET_BRANCH : "main",
REGISTRY : "537984406465.dkr.ecr.ap-south-1.amazonaws.com",
REPOSITORY : "flagr",
SLACK_CHANNEL : "pipeline-comms"
]
)
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
ENVIRONMENT ?= production
PWD := $(shell pwd)
GOPATH := $(shell go env GOPATH)
UIPATH := $(PWD)/browser/flagr-ui

ifeq ($(ENVIRONMENT),dev)
BUILD_CMD = build:dev
else ifeq ($(ENVIRONMENT),stage)
BUILD_CMD = build:stage
else ifeq ($(ENVIRONMENT),local)
BUILD_CMD = build:local
else
BUILD_CMD = build
endif
################################
### Public
################################
Expand All @@ -11,7 +20,7 @@ all: deps gen build build_ui run
rebuild: gen build

test: verifiers
@go test -race -covermode=atomic -coverprofile=coverage.txt github.com/openflagr/flagr/pkg/...
@go test -race -covermode=atomic -coverprofile=coverage.txt github.com/Allen-Career-Institute/flagr/pkg/...

.PHONY: benchmark
benchmark:
Expand All @@ -26,11 +35,11 @@ vendor:

build:
@echo "Building Flagr Server to $(PWD)/flagr ..."
@go build -o $(PWD)/flagr github.com/openflagr/flagr/swagger_gen/cmd/flagr-server
@go build -o $(PWD)/flagr github.com/Allen-Career-Institute/flagr/swagger_gen/cmd/flagr-server

build_ui:
@echo "Building Flagr UI ..."
@cd ./browser/flagr-ui/; npm install && npm run build
@echo "Building Flagr UI ... $(ENVIRONMENT)"
@cd ./browser/flagr-ui/; npm install && npm run $(BUILD_CMD)

run_ui:
@cd ./browser/flagr-ui/; npm run serve
Expand Down Expand Up @@ -87,3 +96,7 @@ swagger: verify_swagger
@mkdir $(PWD)/swagger_gen
@swagger generate server -t ./swagger_gen -f $(PWD)/docs/api_docs/bundle.yaml
@cp /tmp/configure_flagr.go $(PWD)/swagger_gen/restapi/configure_flagr.go 2>/dev/null || :

lint:
find . -name "*.go" ! -name "*.pb.go" | xargs goimports -w
golangci-lint run --timeout 2m0s
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<p align="center">
<a href="https://github.com/openflagr/flagr/actions/workflows/ci.yml?query=branch%3Amain+" target="_blank">
<img src="https://github.com/openflagr/flagr/actions/workflows/ci.yml/badge.svg?branch=main">
<a href="https://github.com/Allen-Career-Institute/flagr/actions/workflows/ci.yml?query=branch%3Amain+" target="_blank">
<img src="https://github.com/Allen-Career-Institute/flagr/actions/workflows/ci.yml/badge.svg?branch=main">
</a>
<a href="https://goreportcard.com/report/github.com/openflagr/flagr" target="_blank">
<img src="https://goreportcard.com/badge/github.com/openflagr/flagr">
<a href="https://goreportcard.com/report/github.com/Allen-Career-Institute/flagr" target="_blank">
<img src="https://goreportcard.com/badge/github.com/Allen-Career-Institute/flagr">
</a>
<a href="https://godoc.org/github.com/openflagr/flagr" target="_blank">
<a href="https://godoc.org/github.com/Allen-Career-Institute/flagr" target="_blank">
<img src="https://img.shields.io/badge/godoc-reference-green.svg">
</a>
<a href="https://github.com/openflagr/flagr/releases" target="_blank">
<img src="https://img.shields.io/github/release/openflagr/flagr.svg?style=flat&color=green">
<a href="https://github.com/Allen-Career-Institute/flagr/releases" target="_blank">
<img src="https://img.shields.io/github/release/Allen-Career-Institute/flagr.svg?style=flat&color=green">
</a>
<a href="https://codecov.io/gh/openflagr/flagr">
<img src="https://codecov.io/gh/openflagr/flagr/branch/main/graph/badge.svg?token=iwjv26grrN">
<a href="https://codecov.io/gh/Allen-Career-Institute/flagr">
<img src="https://codecov.io/gh/Allen-Career-Institute/flagr/branch/main/graph/badge.svg?token=iwjv26grrN">
</a>
</p>

## Introduction
`openflagr/flagr` is a community-driven OSS effort of advancing the development of Flagr.
`Openflagr/flagr` is a community-driven OSS effort of advancing the development of Flagr.

Flagr is an open source Go service that delivers the right experience to the right entity and monitors the impact. It provides feature flags, experimentation (A/B testing), and dynamic configuration. It has clear swagger REST APIs for flags management and flag evaluation.

Expand All @@ -30,8 +30,8 @@ Try it with Docker.

```sh
# Start the docker container
docker pull ghcr.io/openflagr/flagr
docker run -it -p 18000:18000 ghcr.io/openflagr/flagr
docker pull ghcr.io/Allen-Career-Institute/flagr
docker run -it -p 18000:18000 ghcr.io/Allen-Career-Institute/flagr

# Open the Flagr UI
open localhost:18000
Expand Down Expand Up @@ -88,6 +88,6 @@ Error Set:
| Ruby | [rbflagr](https://github.com/openflagr/rbflagr) |

## License and Credit
- [`openflagr/flagr`](https://github.com/openflagr/flagr) Apache 2.0
- [`Allen-Career-Institute/flagr`](https://github.com/Allen-Career-Institute/flagr) Apache 2.0
- [`checkr/flagr`](https://github.com/checkr/flagr) Apache 2.0

4 changes: 3 additions & 1 deletion browser/flagr-ui/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
BASE_URL=""
VUE_APP_API_URL=http://127.0.0.1:18000/api/v1
VUE_APP_API_URL=http://flagr.allen-demo.in/api/v1
VUE_APP_SSO_API_URL=https://bff-dev.allen-demo.in/internal-bff/
VUE_APP_FLAGR_UI_POSSIBLE_ENTITY_TYPES=null
NODE_ENV=development
4 changes: 3 additions & 1 deletion browser/flagr-ui/.env.production
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
VUE_APP_API_URL=api/v1
VUE_APP_API_URL=http://flagr.allen-live.in/api/v1
VUE_APP_SSO_API_URL=https://api.allen-live.in/internal-bff/
NODE_ENV=production
3 changes: 3 additions & 0 deletions browser/flagr-ui/.env.stage
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VUE_APP_API_URL=https://flagr.allen-stage.in/api/v1
VUE_APP_SSO_API_URL=https://bff.allen-stage.in/internal-bff/
NODE_ENV=stage
13 changes: 13 additions & 0 deletions browser/flagr-ui/assets/images/google.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Loading
Loading