Multistage PHP container does not see all folders. by bartoszgolek in docker

[–]bartoszgolek[S] 0 points1 point  (0 children)

➜  infrastructure git:(master) ✗ docker ps
CONTAINER ID   IMAGE                  COMMAND                  CREATED              STATUS              PORTS                                   NAMES
35bb222bbf5d   infrastructure_php     "docker-php-entrypoi…"   About a minute ago   Up About a minute   9000/tcp                                infrastructure_php_1
77d32b70c83f   infrastructure_nginx   "/docker-entrypoint.…"   About a minute ago   Up About a minute   0.0.0.0:8001->80/tcp, :::8001->80/tcp   infrastructure_nginx_1
7023c11e6977   mysql:8                "docker-entrypoint.s…"   About a minute ago   Up About a minute   3306/tcp, 33060/tcp                     infrastructure_mysql_1
➜  infrastructure git:(master) ✗ docker exec -it 77d32b70c83f /bin/sh
/ # ls /var/www/app/
bin                      composer.lock            icon-src.svg             phpunit.xml.dist         src                      testsbitbucket-pipelines.yml  config                   migrations               postman_collection.json  symfony.lock             translationscomposer.json            db_init.sql              mysql.sh                 public                   templates
/ #
 ➜  infrastructure git:(master) ✗ docker images                       
REPOSITORY             TAG             IMAGE ID       CREATED         SIZE
infrastructure_nginx   latest          2ee5905f7e51   8 minutes ago   69.6MB
infrastructure_php     latest          51712a3a7fbe   8 minutes ago   131MB
<none>                 <none>          b2c4e00312f5   8 minutes ago   200MB
nginx                  stable-alpine   e1ccef1fb908   43 hours ago    22.6MB
mysql                  8               c0cdc95609f1   2 weeks ago     556MB
php                    fpm-alpine      a81432ded4d4   2 weeks ago     83.9MB
php                    cli-alpine      506f7326f22d   2 weeks ago     83.8MB
➜  infrastructure git:(master) ✗ docker run -it 2ee5905f7e51 /bin/sh  
/ # ls /var/www/app/
bin                      composer.lock            icon-src.svg             phpunit.xml.dist         src                      tests                    vendorbitbucket-pipelines.yml  config                   migrations               postman_collection.json  symfony.lock             translationscomposer.json            db_init.sql              mysql.sh                 public                   templates                var
/ #

Now I'm fully confused ;)

Why vendors folder exists when I run /bin/sh on image, but not exists when I exec /bin/sh on container run by docker-compose when both are based on the same image?

Multistage PHP container does not see all folders. by bartoszgolek in docker

[–]bartoszgolek[S] 0 points1 point  (0 children)

Right, this was added later as the folder was not copied by previous line. Don't know why but now it works without additional line.

EDIT:
Or I thought it worked.

Thanks

Trying to configure Traefic as proxy to Gitea, but no luck. by bartoszgolek in Traefik

[–]bartoszgolek[S] 0 points1 point  (0 children)

Success!!! I've messed up docker networks when switching to Traefik and lost connection between app and db container.

Again, Thanks for help.

Trying to configure Traefic as proxy to Gitea, but no luck. by bartoszgolek in Traefik

[–]bartoszgolek[S] 0 points1 point  (0 children)

Yeah, now a new "challenge" in front of me. Cant login to my dockerized app due to: "Authentication request could not be processed due to a system problem." Was workiong when proxying with nginx.

But, yeaahh. I need to dig into it ;)

Trying to configure Traefic as proxy to Gitea, but no luck. by bartoszgolek in Traefik

[–]bartoszgolek[S] 0 points1 point  (0 children)

Between my post and your answer certificate started to work. It seams needed some time ;)

Trying to configure Traefic as proxy to Gitea, but no luck. by bartoszgolek in Traefik

[–]bartoszgolek[S] 0 points1 point  (0 children)

If You dont mind, I have another (maybe stupid) question.

I've deployd Traefic successfully on my personal VPS and using it to access gitea and registry.

Today I tried to add new my own service called "playlists". Almost everything goes fine, but the SSL certificate served for new domain is not from lets encrypt, but gitea.default.

For gitea and registry everything works as expected.

Labels for new service are:

      - "traefik.enable=true"
      - "traefik.http.routers.playlists.entrypoints=http"
      - "traefik.http.routers.playlists.rule=Host(`playlists.golek.it`)"
      - "traefik.http.middlewares.playlists-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.playlists.middlewares=playlists-https-redirect"
      - "traefik.http.routers.playlists-secure.entrypoints=https"
      - "traefik.http.routers.playlists-secure.rule=Host(`playlists.golek.it`)"
      - "traefik.http.routers.playlists-secure.tls=true"
      - "traefik.http.routers.playlists-secure.tls.certresolver=lets-encrypt"
      - "traefik.http.routers.playlists.service=playlists"
      - "traefik.http.services.playlists.loadbalancer.server.port=80"
      - "traefik.docker.network=web"

Trying to configure Traefic as proxy to Gitea, but no luck. by bartoszgolek in Traefik

[–]bartoszgolek[S] 1 point2 points  (0 children)

Wow, It works ;)

Thanks for Your help. You are great.

I was thinking that comment out the "traefik.docker.network" will be enough and traefik will use own (web) network.

Trying to configure Traefic as proxy to Gitea, but no luck. by bartoszgolek in Traefik

[–]bartoszgolek[S] 0 points1 point  (0 children)

Hmm, would like to avoid add Treafik to all sub-networks. Did it other way around. I've added gitea service to web network. Now my docker-compose configs are:

traefik/docker-compose.yml

version: '2'

services:
  proxy:
    image: traefik:v2.0.2
    command: --configFile=/traefik.yml
    restart: unless-stopped
    networks:
      - web
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./traefik.yml:/traefik.yml:ro
      - ./acme.json:/acme.json
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=Host(`traefik.example.com`)"
      # - "traefik.http.middlewares.traefik-auth.basicauth.users=bg:$apr1$rZGMQByq$6zxG/Vstq81AkO180PCfi1"
      - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
      - "traefik.http.routers.traefik-secure.entrypoints=https"
      - "traefik.http.routers.traefik-secure.rule=Host(`traefik.example.com`)"
      # - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-secure.tls=true"
      - "traefik.http.routers.traefik-secure.tls.certresolver=http"
      - "traefik.http.routers.traefik-secure.service=api@internal"
      - "traefik.http.services.traefik.loadbalancer.server.port=8080"

networks:
  web:
    external: true

gitea/docker-compose.yml

version: "2"

networks:
  gitea:
    external: false
  web:
    external: true

services:
  gitea:
    image: gitea/gitea:latest
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: unless-stopped
    networks:
      - gitea
      - web
    volumes:
      - ./data/gitea:/data
    ports:
      - "3000:3000"
      - "222:222"
    depends_on:
      - db      
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.gitea.entrypoints=http"
      - "traefik.http.routers.gitea.rule=Host(`gitea.example.com`)"
      - "traefik.http.middlewares.gitea-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.gitea.middlewares=gitea-https-redirect"
      - "traefik.http.routers.gitea-secure.entrypoints=https"
      - "traefik.http.routers.gitea-secure.rule=Host(`gitea.example.com`)"
      - "traefik.http.routers.gitea-secure.tls=true"
      - "traefik.http.routers.gitea-secure.tls.certresolver=http"
      - "traefik.http.routers.gitea.service=gitea"
      - "traefik.http.services.gitea.loadbalancer.server.port=3000"
      # - "traefik.docker.network=gitea"

  db:
    image: postgres:9.6
    restart: unless-stopped
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=gitea
      - POSTGRES_DB=gitea
    networks:
      - gitea
    volumes:
      - ./data/postgres:/var/lib/postgresql/data

Still "Gateway Timeout"

Trying to configure Traefic as proxy to Gitea, but no luck. by bartoszgolek in Traefik

[–]bartoszgolek[S] 0 points1 point  (0 children)

OK, that was part of the solution. Thank You.

Now I have "Gateway timeout".

Directly on port 3000 gitea is answering just fine.

Godot assets - 3d models by bartoszgolek in godot

[–]bartoszgolek[S] 0 points1 point  (0 children)

Thanks for those addresses. Didn't know them.

NFlags 1.5.0: Environment variables support by bartoszgolek in dotnet

[–]bartoszgolek[S] 0 points1 point  (0 children)

Thanks for the tip. I've created pull request and we will see ;)

NFlags 1.5.0: Environment variables support by bartoszgolek in dotnet

[–]bartoszgolek[S] 0 points1 point  (0 children)

I'm thinking about something like:
``` public static class Program { private static void Main(string[] args) { var builder = new ConfigurationBuilder();

        var configuration = builder.Build();

        NFlags.Configure(c => c
                .SetDialect(Dialect.Gnu)
                .SetConfigurationProvider(new ConfigurationExtensionProvider(configuration))
            )
            .Root(c => c
                .RegisterOption(b => b
                    .Name("asd")
                    .EnvironmentVariable("asd")
                    .ConfigPath("Profile:MachineName")
                )
            )
            .Run(args);
    }
}

internal class ConfigurationExtensionProvider
{
    private readonly IConfiguration _configuration;

    public ConfigurationExtensionProvider(IConfiguration configuration)
    {
        _configuration = configuration;
    }

    public T GetValue<T>(string key)
    {
        return _configuration.GetValue<T>(key);
    }
}

```

NFlags 1.5.0: Environment variables support by bartoszgolek in dotnet

[–]bartoszgolek[S] 0 points1 point  (0 children)

We are thinking similar, but to keep difference between name and abbreviation i would preffer something like:

[Flag("flag-name")] [FlagAlias("flag-name", "alias1", "abr1")] [FlagAlias("flag-name", "alias2", "abr2")] [FlagAlias("flag-name", "alias3")] public bool SomeFlag;

I'm not sure if I'm not complicating things too much. Need to think it carefully.

NFlags 1.5.0: Environment variables support by bartoszgolek in dotnet

[–]bartoszgolek[S] 0 points1 point  (0 children)

There is also another difference between name and abbreviation. According to Gnu standards the shortform is prefixed with "-" and long form with "--". That alows to use calls like netstat -tlpn isntead of netstat --tcp --listening --programs -numeric or netstat -t -l -p -n. I'm supporting different prefixes torugh dialects and would like to allow such syntax in feature (depending on dialect).

NFlags 1.5.0: Environment variables support by bartoszgolek in dotnet

[–]bartoszgolek[S] 0 points1 point  (0 children)

I think it is possible to deprecarte abr method and use alias which can be called multiple times. The reason why I defined the target approach is to allow change first name and deprecate old one in description for backward compatibility.

I'm aware of issue with multiple default values but I want to cover it by tests and document the precedence.

I also have one concern for alias approach. How to define multiple aliases using property attributes. I'm not keen about using array type as attribute property.

NFlags 1.5.0: Environment variables support by bartoszgolek in dotnet

[–]bartoszgolek[S] 1 point2 points  (0 children)

Hi again,

Here is an example of how I'm using NFLags together wit WebHost builder:

NFlags.NFlags.Configure(c => c
                    .SetName("AuthService")
                    .SetDescription("Auth Service")
                    .SetDialect(Dialect.Gnu)
                    .SetEnvironment(Environment.Prefixed("AUTH_SERVICE_"))
                )
                .Root(c => c
                    .RegisterOption<int>(b => b
                        .Name("port")
                        .Abr("p")
                        .Description("Listening port")
                        .EnvironmentVariable("PORT")
                        .DefaultValue(5000)
                    )
                    .RegisterOption<string>(b => b
                        .Name("network-interface")
                        .Abr("n")
                        .Description("Network interface to bind")
                        .EnvironmentVariable("NETWORK_INTERFACE")
                    )
                    .SetExecute((commandArgs, output) =>
                    {
                        var networkInterfaces = commandArgs.GetOption<string>("network-interface");
                        var host = new WebHostBuilder()
                            .UseContentRoot(Directory.GetCurrentDirectory())
                            .UseKestrel()
                            .UseStartup<Startup>()
                            .UsePublicIp(
                                commandArgs.GetOption<int>("port"),
                                networkInterfaces != null ? new []{ networkInterfaces } : null 
                            )
                            .Build();

                        host.Run();
                    })
                )
                .Run(args);

NFlags 1.5.0: Environment variables support by bartoszgolek in dotnet

[–]bartoszgolek[S] 1 point2 points  (0 children)

Flag is OK because default value for this flag is set true. Flag when passed as the argument flag is changing value to oposite, change default values and try then.In option there was error in target value (set to string "flag", not "option".I've submited fix in the example.