Git Product home page Git Product logo

pubstore's Introduction

pubstore

A publication store, to be associated with an LCP Server.

Note: This project is for demonstration purposes only and should not be used in a production environment.

Quick Start

  1. Clone the repository:
   git clone https://github.com/edrlab/pubstore.git
  1. Compile
make build

or

GOPATH=$PWD/build go install cmd/pubstore/pubstore.go
  1. run
make run

or

./build/bin/pubstore
  1. Run the PubStore server:

Access the PubStore API at http://localhost:8080 (or the appropriate base URL according to your configuration).

Configuration

The configuration of the server is kept both in a configudation file and in environment variable. It is possible to mix both sets, as confidential information is better kept as environment variables.

The server will use the PUBSTORE_CONFIG environment variable to find a configuration file. Its value must be a file path.

Configuration properties are expressed in snake case in the configuration file, and screaming snake case prefiexed by PUBSTORE when expressed as environment variables. As an example, the port conguration property becomes the PUBSTORE_PORT environment variable, public_base_url becomes PUBSTORE_PUBLIC_BASE_URL, and the version property of the lcp_server section becomes PUBSTORE_LCP_SERVER_VERSION.

  • port:tThe port on which the HTTP server will listen. Default value: 8080.
  • public_base_url: the base URL for the pubstore server. Default value: http://localhost:8080.
  • dsn: the data source name, i.e. database connection string. Default value: sqlite3://pubstore.sqlite.
  • oauth_seed: a string used as a seed for OAuth2 server authorization.
  • root_dir: the path to static files and views used by the web interface. Default value: current directory.
  • resources: the path to the cover images used by the Web interface.
  • page_size: the page size used in the REST API and Web interface.
  • print_limit: the print limit set in LCP licenses generated from the associated LCP Server.
  • copy_limit: the copy limit set in LCP licenses generated from the associated LCP Server.
  • username: the Basic Auth username used to notify Pubstore of a new encrypted publication.
  • password: the Basic Auth password used to notify Pubstore of a new encrypted publication.
  • lcp_server: a section relative to the access to the associated LCP Server.

The lcp_server section contains:

  • url: the URL of the LCP server.
  • version: the version of the LCP server: "v1" or "v2".
  • username: the username for the LCP server.
  • password: the password for the LCP server.

You can modify these environment variables according to your requirements. Make sure to set the appropriate values based on your deployment environment.

Note: The environment variables are used during the Docker image build process and are set as defaults in the resulting image. You can override these defaults by providing custom values when running the container.

Note: Be careful when using the LCP_SERVER_URL environment variable. The default value points to https://front-prod.edrlab.org, which is intended for test purposes only. Make sure to use a secure and production-ready LCP server URL in a real production environment.

Docker

docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres

docker build -t pubstore .

docker run -p 8080:8080 -e DSN="host=host.docker.internal user=postgres password=mysecretpassword dbname=postgres port=5432 sslmode=disable" pubstore

Deployment

it's currently deployed on Google Cloud Platform Cloud Run and Cloud SQL (postgresql:14)

https://pubstore.edrlab.org

API

Swagger

Swagger documentation : https://pubstore.edrlab.org/api/v1/swagger/index.html

to compile the swagger documentation, you need to install https://github.com/swaggo/swag

make docs
make build
make run

pubstore's People

Contributors

panac avatar arthur-lemeur avatar llemeurfr avatar

Stargazers

Sgal Cheung avatar

Watchers

Daniel Weck avatar  avatar  avatar  avatar

Forkers

drndos

pubstore's Issues

Couldn't run make build?

When I git clone this repo and make a build, some issues occur

/pubstore/build go install ./cmd/pubstore/pubstore.go
/bin/sh: 工作(Work): No such file or directory
make: *** [cmd/pubstore/pubstore.go] Error 1

After reach I found this problem:
The GOPATH setting method in this Makefile is based on the old Go project management method, which uses GOPATH. In modern Go development, it is recommended to use Go Modules to manage dependencies without the need to set GOPATH.

So, I update this Makefile

ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

BUILD_DIR=$(ROOT_DIR)/build

rm=rm -rf

pubstore=cmd/pubstore/pubstore.go

swag=~/go/bin/swag

.PHONY: all clean $(pubstore) test docs run

all: $(pubstore)

clean:
    $(rm)  $(BUILD_DIR)

test:
    go test -coverpkg=./pkg/./... ./pkg/./...

build: $(pubstore)

docs:
    $(swag) init -g router.go -d pkg/api -o pkg/docs

$(pubstore):
    go install ./$@

run:
    go run $(pubstore)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.