Skip to content

Instantly share code, notes, and snippets.

View RemiBou's full-sized avatar

Rémi BOURGAREL RemiBou

View GitHub Profile
#!/bin/bash
export COMPOSE_PROJECT_NAME=franceremote
docker context use default
docker-compose build || exit 1
docker-compose push || exit 1
docker context use fr
docker-compose pull || (docker context use default && exit 1)
docker-compose up -d || (docker context use default && exit 1)
docker-compose logs -f web
docker context use default
version: '3.4'
x-logging: &logging
logging:
driver: "json-file"
options:
max-size: 10M
max-file: 1
services:
fluentd:
image: $INTERNAL_REGISTRY/fluentd
FROM openjdk:10-jdk-slim
RUN apt-get update && apt-get install -y curl
ENV jvm_args ""
RUN mkdir -p /usr/src/agent
WORKDIR /usr/src/agent
RUN curl -s --output apm-agent.jar https://search.maven.org/remotecontent?filepath=co/elastic/apm/apm-agent-attach/1.6.1/apm-agent-attach-1.6.1.jar
ARG jar_name
WORKDIR /usr/src/api
COPY ./application-api-purchase-restapi/build/libs/${jar_name}.jar application.jar
CMD java -jar /usr/src/agent/apm-agent.jar --continuous --args 'service_name=api;server_urls=http://kibana-apm-server:8200' & \
/**
* The security configuration.
* <P>
* @author Pangee.
* @version 1.0.0-SNAPSHOT
*/
@Configuration
@EnableWebSecurity
@EnableRedisHttpSession
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class Record
{
public DateTime Start;
public DateTime End;
public long Id;
public TimeSpan Duration => End - Start;
private static long[] _pows = Enumerable.Range(0, 8).Select(i => (long)Math.Pow(10, i)).ToArray();
public Record(string line)
{
public class FakeMyDbContext : IMyDbContext
{
public FakeMyDbContext(IEnumerable<Customer> customers )
{
Customers = customers.AsQueryable();
}
public IQueryable<Customer> Customers { get; set; }
}
public class CustomerController : Controller
{
private IMyDbContext _dbContext;
public CustomerController(IMyDbContext dbContext)
{
_dbContext = dbContext;
}
public ActionResult Index()
@RemiBou
RemiBou / gist:3705756
Created September 12, 2012 10:17
Unit Test and Entity Framework 4 Controller
public class CustomerController : Controller
{
private MyDbContext _dbContext;
public ActionResult Index()
{
return View(_dbContext.Customers.OrderBy(c => c.Name).ToList());
}
}
public class MyDbContext : DbContext
{
public class Program
{
public static void Main(params object[] para)
{
//ninject bootstrapping
var standardKernel = new StandardKernel();
standardKernel.Bind<DbContext>().To<DbContext>();
standardKernel.Bind<MessageProcessor>().To<MessageProcessor>();
MessageProcessor messageProcessor = standardKernel.Get<MessageProcessor>();
//link the commands with their handlers, and the events with their observers
@RemiBou
RemiBou / gist:3690647
Created September 10, 2012 12:27
Remi DDD : sample entities
public class Product
{
public string Name { get; set; }
public int Id { get; set; }
public decimal Price { get; set; }
}
public class Order
{
public int Id { get; set; }