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

Docker-compose up using the default docker-compose.yml file does not create mCaptcha container when using Oracle Linux Server 8.8 (Oracle Cloud) #89

Open
ghost opened this issue Jun 21, 2023 · 10 comments

Comments

@ghost
Copy link

ghost commented Jun 21, 2023

Hi,

I am trying to set up mCaptcha on a Oracle Could VM instance. I only want to set up the default configuration for now whilst I learn about mCaptcha.

For some reason I keep hitting these errors when I run docker-compose up within the mCaptcha directory:

Creating network "mcaptcha_default" with the default driver
Creating mcaptcha_mcaptcha_redis_1    ... done
Creating mcaptcha_mcaptcha_postgres_1 ... done
Creating mcaptcha_mcaptcha_1          ... done
Attaching to mcaptcha_mcaptcha_redis_1, mcaptcha_mcaptcha_postgres_1, mcaptcha_mcaptcha_1
mcaptcha_1           |  INFO  mcaptcha > mcaptcha: mCaptcha - a PoW-based CAPTCHA system.
mcaptcha_1           | For more information, see: https://mcaptcha.org
mcaptcha_1           | Build info:
mcaptcha_1           | Version: 0.1.0 commit: 6ede578ad55441457b016a7a3d52f038263641ed
mcaptcha_1           |  INFO  mcaptcha::settings > Loading config file from /etc/mcaptcha/config.toml
mcaptcha_1           |  INFO  mcaptcha::settings > Overriding [server].port with environment variable
mcaptcha_1           |  INFO  mcaptcha::settings > Overriding [database].url and [database].database_type with environment variable
mcaptcha_postgres_1  | The files belonging to this database system will be owned by user "postgres".
mcaptcha_postgres_1  | This user must also own the server process.
mcaptcha_postgres_1  |
mcaptcha_postgres_1  | The database cluster will be initialized with locale "en_US.utf8".
mcaptcha_postgres_1  | The default database encoding has accordingly been set to "UTF8".
mcaptcha_postgres_1  | The default text search configuration will be set to "english".
mcaptcha_postgres_1  |
mcaptcha_postgres_1  | Data page checksums are disabled.
mcaptcha_postgres_1  |
mcaptcha_postgres_1  | fixing permissions on existing directory /var/lib/postgresql/data/mcaptcha ... ok
mcaptcha_postgres_1  | creating subdirectories ... ok
mcaptcha_postgres_1  | selecting dynamic shared memory implementation ... posix
mcaptcha_postgres_1  | selecting default max_connections ... 100
mcaptcha_postgres_1  | selecting default shared_buffers ... 128MB
mcaptcha_postgres_1  | selecting default time zone ... Etc/UTC
mcaptcha_postgres_1  | creating configuration files ... ok
mcaptcha_postgres_1  | running bootstrap script ... ok
mcaptcha_1           |  INFO  mcaptcha::data     > Initializing credential manager
mcaptcha_redis_1     | 1:C 21 Jun 2023 23:45:51.323 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
mcaptcha_redis_1     | 1:C 21 Jun 2023 23:45:51.324 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=1, just started
mcaptcha_redis_1     | 1:C 21 Jun 2023 23:45:51.324 # Configuration loaded
mcaptcha_redis_1     | 1:M 21 Jun 2023 23:45:51.325 * monotonic clock: POSIX clock_gettime
mcaptcha_redis_1     | 1:M 21 Jun 2023 23:45:51.325 * Running mode=standalone, port=6379.
mcaptcha_redis_1     | 1:M 21 Jun 2023 23:45:51.326 # Server initialized
mcaptcha_redis_1     | 1:M 21 Jun 2023 23:45:51.326 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
mcaptcha_redis_1     | 1:M 21 Jun 2023 23:45:51.329 * <mcaptcha_cahce> Created new data type 'mcaptbuck'
mcaptcha_redis_1     | 1:M 21 Jun 2023 23:45:51.329 * <mcaptcha_cahce> Created new data type 'mcaptmcap'
mcaptcha_redis_1     | 1:M 21 Jun 2023 23:45:51.329 * <mcaptcha_cahce> Created new data type 'mcaptsafe'
mcaptcha_redis_1     | 1:M 21 Jun 2023 23:45:51.329 * <mcaptcha_cahce> Created new data type 'mcaptchal'
mcaptcha_redis_1     | 1:M 21 Jun 2023 23:45:51.329 * Module 'mcaptcha_cahce' loaded from /usr/lib/redis/modules/libcache.so
mcaptcha_redis_1     | 1:M 21 Jun 2023 23:45:51.330 * Ready to accept connections
mcaptcha_1           | thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: DBError(Io(Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" }))', src/db.rs:36:53
mcaptcha_1           | stack backtrace:
mcaptcha_1           |    0: rust_begin_unwind
mcaptcha_1           |              at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
mcaptcha_1           |    1: core::panicking::panic_fmt
mcaptcha_1           |              at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
mcaptcha_1           |    2: core::result::unwrap_failed
mcaptcha_1           |              at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1750:5
mcaptcha_1           |    3: std::thread::local::LocalKey<T>::with
mcaptcha_1           |    4: <core::pin::Pin<P> as core::future::future::Future>::poll
mcaptcha_1           |    5: tokio::runtime::scheduler::current_thread::Context::enter
mcaptcha_1           |    6: tokio::macros::scoped_tls::ScopedKey<T>::set
mcaptcha_1           |    7: tokio::runtime::scheduler::current_thread::CurrentThread::block_on
mcaptcha_1           |    8: tokio::runtime::runtime::Runtime::block_on
mcaptcha_1           |    9: mcaptcha::main
mcaptcha_1           | note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
mcaptcha_postgres_1  | performing post-bootstrap initialization ... ok
mcaptcha_postgres_1  | syncing data to disk ... ok
mcaptcha_postgres_1  |
mcaptcha_postgres_1  |
mcaptcha_postgres_1  | Success. You can now start the database server using:
mcaptcha_postgres_1  |
mcaptcha_postgres_1  |     pg_ctl -D /var/lib/postgresql/data/mcaptcha/ -l logfile start
mcaptcha_postgres_1  |
mcaptcha_postgres_1  | initdb: warning: enabling "trust" authentication for local connections
mcaptcha_postgres_1  | You can change this by editing pg_hba.conf or using the option -A, or
mcaptcha_postgres_1  | --auth-local and --auth-host, the next time you run initdb.
mcaptcha_postgres_1  | waiting for server to start....2023-06-21 23:45:57.019 UTC [47] LOG:  starting PostgreSQL 13.2 (Debian 13.2-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
mcaptcha_postgres_1  | 2023-06-21 23:45:57.023 UTC [47] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
mcaptcha_postgres_1  | 2023-06-21 23:45:57.034 UTC [48] LOG:  database system was shut down at 2023-06-21 23:45:55 UTC
mcaptcha_postgres_1  | 2023-06-21 23:45:57.043 UTC [47] LOG:  database system is ready to accept connections
mcaptcha_postgres_1  |  done
mcaptcha_postgres_1  | server started
mcaptcha_postgres_1  |
mcaptcha_postgres_1  | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
mcaptcha_postgres_1  |
mcaptcha_postgres_1  | 2023-06-21 23:45:57.436 UTC [47] LOG:  received fast shutdown request
mcaptcha_postgres_1  | waiting for server to shut down....2023-06-21 23:45:57.517 UTC [47] LOG:  aborting any active transactions
mcaptcha_postgres_1  | 2023-06-21 23:45:57.524 UTC [47] LOG:  background worker "logical replication launcher" (PID 54) exited with exit code 1
mcaptcha_postgres_1  | 2023-06-21 23:45:57.527 UTC [49] LOG:  shutting down
mcaptcha_postgres_1  | 2023-06-21 23:45:57.612 UTC [47] LOG:  database system is shut down
mcaptcha_postgres_1  |  done
mcaptcha_postgres_1  | server stopped
mcaptcha_postgres_1  |
mcaptcha_postgres_1  | PostgreSQL init process complete; ready for start up.
mcaptcha_postgres_1  |
mcaptcha_postgres_1  | 2023-06-21 23:45:57.923 UTC [1] LOG:  starting PostgreSQL 13.2 (Debian 13.2-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
mcaptcha_postgres_1  | 2023-06-21 23:45:57.923 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
mcaptcha_postgres_1  | 2023-06-21 23:45:57.923 UTC [1] LOG:  listening on IPv6 address "::", port 5432
mcaptcha_postgres_1  | 2023-06-21 23:45:57.932 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
mcaptcha_postgres_1  | 2023-06-21 23:45:57.940 UTC [66] LOG:  database system was shut down at 2023-06-21 23:45:57 UTC
mcaptcha_postgres_1  | 2023-06-21 23:45:58.016 UTC [1] LOG:  database system is ready to accept connections
mcaptcha_mcaptcha_1 exited with code 101

I dont know why this occuring, here is my docker-compose.yml file

version: "3.9"                                                                                                           
                                                                                                                         
services:                                                                                                                
  mcaptcha:                                                                                                              
    image: mcaptcha/mcaptcha:latest                                                                                      
    ports:                                                                                                               
      - 7000:7000                                                                                                        
    environment:                                                                                                         
      DATABASE_URL: postgres://postgres:password@mcaptcha_postgres:5432/postgres # set password at placeholder           
      MCAPTCHA_REDIS_URL: redis://mcaptcha_redis/                                                                        
      RUST_LOG: debug                                                                                                    
      PORT: 7000                                                                                                         
      RUST_BACKTRACE: 1                                                                                                  
    depends_on:                                                                                                          
      - mcaptcha_postgres                                                                                                
      - mcaptcha_redis                                                                                                   
                                                                                                                         
  mcaptcha_postgres:                                                                                                     
    image: postgres:13.2                                                                                                 
    volumes:                                                                                                             
      - mcaptcha-data:/var/lib/postgresql/                                                                               
    environment:                                                                                                         
      POSTGRES_PASSWORD: password # change password                                                                      
      PGDATA: /var/lib/postgresql/data/mcaptcha/                                                                         
                                                                                                                         
  mcaptcha_redis:                                                                                                        
    image: mcaptcha/cache:latest                                                                                         
                                                                                                                         
volumes:                                                                                                                 
  mcaptcha-data:                  

Any help is appreciated

@th3raid0r
Copy link

Given the logs, it looks like PostgresSQL wasn't ready to accept connections quite yet. (depends_on doesn't wait for init to complete just the container to be running) then when the mcaptcha container started it wasn't ready and failed to resolve.

I'd try standing up the other services explicitly first:

sudo docker compose up mcaptcha_redis mcaptcha_postgres -d

Then start the mcaptcha container:

sudo docker compose up mcaptcha -d


If that doesn't work, I think we'll need to know what OS you're running on Oracle Cloud as some linux flavors have certain security features enabled that tends to break docker bridges.

For example, in my Oracle Linux 9 server, I need to have SELinux run in permissive mode and disable Firewalld (in favor of a simpler, less opinionated firewall) in order to get things communicating well.

Hope that helps! I'll likely see what I can contribute code-wise this weekend (I'm a lemmy instance admin looking to contribute on the issue mentioned above as well).

@denis-ev
Copy link

@th3raid0r

I don't have a healthcheck for postgresql handy, but if you add a healthcheck to postgres
and then edit the docker-compose.yml like the following, you can get around this issue for sure.

version: "3.9"                                                                                                           
                                                                                                                         
services:                                                                                                                
  mcaptcha:                                                                                                              
    image: mcaptcha/mcaptcha:latest                                                                                      
    ports:                                                                                                               
      - 7000:7000                                                                                                        
    environment:                                                                                                         
      DATABASE_URL: postgres://postgres:password@mcaptcha_postgres:5432/postgres # set password at placeholder           
      MCAPTCHA_REDIS_URL: redis://mcaptcha_redis/                                                                        
      RUST_LOG: debug                                                                                                    
      PORT: 7000                                                                                                         
      RUST_BACKTRACE: 1                                                                                                  
    depends_on:                                                                                                          
      mcaptcha_postgres:
        condition: service_healthy ##added this, this container will then wait until postgres is healthy and only start then                                                                                                
      mcaptcha_redis:                                                                                                   
                                                                                                                         
  mcaptcha_postgres:                                                                                                     
    image: postgres:13.2                                                                                                 
    volumes:                                                                                                             
      - mcaptcha-data:/var/lib/postgresql/                                                                               
    environment:                                                                                                         
      POSTGRES_PASSWORD: password # change password                                                                      
      PGDATA: /var/lib/postgresql/data/mcaptcha/
    healthcheck: ##todo                                                                         
                                                                                                                         
  mcaptcha_redis:                                                                                                        
    image: mcaptcha/cache:latest                                                                                         
                                                                                                                         
volumes:                                                                                                                 
  mcaptcha-data:   

@ghost
Copy link
Author

ghost commented Jun 22, 2023

Thanks, logging on soon so will give it a try

@ghost
Copy link
Author

ghost commented Jun 22, 2023

@th3raid0r

I don't have a healthcheck for postgresql handy, but if you add a healthcheck to postgres and then edit the docker-compose.yml like the following, you can get around this issue for sure.

version: "3.9"                                                                                                           
                                                                                                                         
services:                                                                                                                
  mcaptcha:                                                                                                              
    image: mcaptcha/mcaptcha:latest                                                                                      
    ports:                                                                                                               
      - 7000:7000                                                                                                        
    environment:                                                                                                         
      DATABASE_URL: postgres://postgres:password@mcaptcha_postgres:5432/postgres # set password at placeholder           
      MCAPTCHA_REDIS_URL: redis://mcaptcha_redis/                                                                        
      RUST_LOG: debug                                                                                                    
      PORT: 7000                                                                                                         
      RUST_BACKTRACE: 1                                                                                                  
    depends_on:                                                                                                          
      mcaptcha_postgres:
        condition: service_healthy ##added this, this container will then wait until postgres is healthy and only start then                                                                                                
      mcaptcha_redis:                                                                                                   
                                                                                                                         
  mcaptcha_postgres:                                                                                                     
    image: postgres:13.2                                                                                                 
    volumes:                                                                                                             
      - mcaptcha-data:/var/lib/postgresql/                                                                               
    environment:                                                                                                         
      POSTGRES_PASSWORD: password # change password                                                                      
      PGDATA: /var/lib/postgresql/data/mcaptcha/
    healthcheck: ##todo                                                                         
                                                                                                                         
  mcaptcha_redis:                                                                                                        
    image: mcaptcha/cache:latest                                                                                         
                                                                                                                         
volumes:                                                                                                                 
  mcaptcha-data:   

I tried this but a condition as part of depends on was deprecated in Docker V3: See Here

Here is the new docker-compose.yml yaml file I have tried with this omitted, but with a postgres healthcheck included.

version: "3.9"

services:
  mcaptcha:
    image: mcaptcha/mcaptcha:latest
    ports:
      - 7000:7000
    environment:
      DATABASE_URL: postgres://postgres:password@mcaptcha_postgres:5432/postgres
      MCAPTCHA_REDIS_URL: redis://mcaptcha_redis/
      RUST_LOG: debug
      PORT: 7000
      RUST_BACKTRACE: 1
    depends_on:
      - mcaptcha_postgres
      - mcaptcha_redis

  mcaptcha_postgres:
    image: postgres:13.2
    volumes:
      - mcaptcha-data:/var/lib/postgresql/
    environment:
      POSTGRES_PASSWORD: password
      PGDATA: /var/lib/postgresql/data/mcaptcha/
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 30s
      timeout: 30s
      retries: 3

  mcaptcha_redis:
    image: mcaptcha/cache:latest

volumes:
  mcaptcha-data:

Ill keep working on it.

@ghost
Copy link
Author

ghost commented Jun 22, 2023

@th3raid0r

sudo docker compose up mcaptcha_redis mcaptcha_postgres -d

Appreciate the response and the assistance, I did have firewalld stopped when originally testing but selinux was enabled, I disabled selinux and I still couldnt stand the 2 containers up first prior to then standing up mCaptcha, for some reason redis was failing to start due to issues with the tmpfs when selinux was disabled. I have since re-enabled it and redis starts again without issue.

That said, I still keep running into the same faults with mCaptcha container failing to start due to the same error.

docker-compose up -d mcaptcha_redis mcaptcha_postgres
Starting mcaptcha_mcaptcha_postgres_1 ... done
Starting mcaptcha_mcaptcha_redis_1    ... done

docker ps
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
CONTAINER ID  IMAGE                            COMMAND               CREATED         STATUS                   PORTS       NAMES
8fc0aaab6eaa  docker.io/mcaptcha/cache:latest  redis-server --lo...  45 minutes ago  Up 26 seconds                        mcaptcha_mcaptcha_redis_1
80c6b1609a1d  docker.io/library/postgres:13.2  postgres              45 minutes ago  Up 26 seconds (healthy)              mcaptcha_mcaptcha_postgres_1

docker-compose up mcaptcha
mcaptcha_mcaptcha_redis_1 is up-to-date
mcaptcha_mcaptcha_postgres_1 is up-to-date
Starting mcaptcha_mcaptcha_1 ... done
Attaching to mcaptcha_mcaptcha_1
mcaptcha_1           |  INFO  mcaptcha > mcaptcha: mCaptcha - a PoW-based CAPTCHA system.
mcaptcha_1           | For more information, see: https://mcaptcha.org
mcaptcha_1           | Build info:
mcaptcha_1           | Version: 0.1.0 commit: 6ede578ad55441457b016a7a3d52f038263641ed
mcaptcha_1           |  INFO  mcaptcha::settings > Loading config file from /etc/mcaptcha/config.toml
mcaptcha_1           |  INFO  mcaptcha::settings > Overriding [server].port with environment variable
mcaptcha_1           |  INFO  mcaptcha::settings > Overriding [database].url and [database].database_type with environment variable
mcaptcha_1           |  INFO  mcaptcha::data     > Initializing credential manager
mcaptcha_1           | thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: DBError(Io(Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" }))', src/db.rs:36:53
mcaptcha_1           | stack backtrace:
mcaptcha_1           |    0: rust_begin_unwind
mcaptcha_1           |              at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
mcaptcha_1           |    1: core::panicking::panic_fmt
mcaptcha_1           |              at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
mcaptcha_1           |    2: core::result::unwrap_failed
mcaptcha_1           |              at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1750:5
mcaptcha_1           |    3: std::thread::local::LocalKey<T>::with
mcaptcha_1           |    4: <core::pin::Pin<P> as core::future::future::Future>::poll
mcaptcha_1           |    5: tokio::runtime::scheduler::current_thread::Context::enter
mcaptcha_1           |    6: tokio::macros::scoped_tls::ScopedKey<T>::set
mcaptcha_1           |    7: tokio::runtime::scheduler::current_thread::CurrentThread::block_on
mcaptcha_1           |    8: tokio::runtime::runtime::Runtime::block_on
mcaptcha_1           |    9: mcaptcha::main
mcaptcha_1           | note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

OS is:

cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.8"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:8:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.8
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.8

Using an Oracle Cloud VM instance, I dont think I can change the OS to a main distribution, could you let me know how you get on over the weekend and see if you run into the same fault?

@denis-ev
Copy link

@th3raid0r

I don't have a healthcheck for postgresql handy, but if you add a healthcheck to postgres and then edit the docker-compose.yml like the following, you can get around this issue for sure.

version: "3.9"

services:

mcaptcha:

image: mcaptcha/mcaptcha:latest                                                                                      
ports:                                                                                                               
  - 7000:7000                                                                                                        
environment:                                                                                                         
  DATABASE_URL: postgres://postgres:password@mcaptcha_postgres:5432/postgres # set password at placeholder           
  MCAPTCHA_REDIS_URL: redis://mcaptcha_redis/                                                                        
  RUST_LOG: debug                                                                                                    
  PORT: 7000                                                                                                         
  RUST_BACKTRACE: 1                                                                                                  
depends_on:                                                                                                          
  mcaptcha_postgres:
    condition: service_healthy ##added this, this container will then wait until postgres is healthy and only start then                                                                                                
  mcaptcha_redis:                                                                                                   

mcaptcha_postgres:

image: postgres:13.2                                                                                                 
volumes:                                                                                                             
  - mcaptcha-data:/var/lib/postgresql/                                                                               
environment:                                                                                                         
  POSTGRES_PASSWORD: password # change password                                                                      
  PGDATA: /var/lib/postgresql/data/mcaptcha/
healthcheck: ##todo                                                                         

mcaptcha_redis:

image: mcaptcha/cache:latest                                                                                         

volumes:

mcaptcha-data:

I tried this but a condition as part of depends on was deprecated in Docker V3: See Here

Here is the new docker-compose.yml yaml file I have tried with this omitted, but with a postgres healthcheck included.


version: "3.9"



services:

  mcaptcha:

    image: mcaptcha/mcaptcha:latest

    ports:

      - 7000:7000

    environment:

      DATABASE_URL: postgres://postgres:password@mcaptcha_postgres:5432/postgres

      MCAPTCHA_REDIS_URL: redis://mcaptcha_redis/

      RUST_LOG: debug

      PORT: 7000

      RUST_BACKTRACE: 1

    depends_on:

      - mcaptcha_postgres

      - mcaptcha_redis



  mcaptcha_postgres:

    image: postgres:13.2

    volumes:

      - mcaptcha-data:/var/lib/postgresql/

    environment:

      POSTGRES_PASSWORD: password

      PGDATA: /var/lib/postgresql/data/mcaptcha/

    healthcheck:

      test: ["CMD-SHELL", "pg_isready -U postgres"]

      interval: 30s

      timeout: 30s

      retries: 3



  mcaptcha_redis:

    image: mcaptcha/cache:latest



volumes:

  mcaptcha-data:

Ill keep working on it.

That's annoying ...
Well what they are saying on the website is basically, that the container or project should have the check and just repeat kind.

The easiest to do that is creating an entry point script and haven a check if it can connect there.
I'll have a look at an example tonight.

Cheers

@ghost
Copy link
Author

ghost commented Jun 22, 2023

Sounds good, thank you!

@ghost
Copy link
Author

ghost commented Jun 24, 2023

Going to update the issue heading. I have had success getting mCaptcha set up on my own local Ubuntu home-server, using the exact same docker-compose.yml file I created with the healthcheck. Hurrah 😄

The fault with what I am experiencing with my Cloud VM is specific to that Oracle Fedora OS. I will also raise this to Oracle support to see if they have any tips for me. At somepoint I will need to host mCaptcha directly in the cloud.

I will leave this issue open until I come back with a fix. This will help inform others if they have the same issue in the future.

@ghost ghost changed the title Having issues with docker-compose up using the default configuration Docker-compose up using the default docker-compose.yml file does not create mCaptcha container when using Oracle Linux Server 8.8 (Oracle Cloud) Jun 24, 2023
@ghost
Copy link
Author

ghost commented Jun 24, 2023

I have added in MCAPTCHA_SERVER_DOMAIN: (my server IP public IP goes here) to my docker-compose-yml file as per this issue #32 but it didn't fix anything when standing up the containers on my Oracle Linux Server OS.

@realaravinth redis looks quite resource intensive is that right? Just looking at the specs here: https://docs.redis.com/latest/rs/installing-upgrading/install/plan-deployment/hardware-requirements/

Please would you be able to confirm? Wondering if my issue is due to not enough available memory.

@realaravinth
Copy link
Member

Hi, I haven't caught up with the thread yet, I'm in the middle of tests at my Uni but its so nice seeing people chip in to help each other 😊


redis looks quite resource intensive is that right? Just looking at the specs here

Redis' memory usage depends on the amount of data you store on it, so technically you can get away with running it on a server with lesser resources.

We are using only Redis to support large-scale deployment where a single mCaptcha instance will have to support multiple websites. So if your deployment is small-scale, I'd recommend going the embedded cache route.

I have to improve documentation on using the embedded cache, but here's how you do it:

  1. Create config/ directory and config/config.toml file and populate it. *Comment out (or remove) the redis section in the configuration file. For instance:
  • config/config.tml
debug = true
source_code = "https://github.com/mCaptcha/mCaptcha"
commercial = false
allow_demo = true
allow_registration = true

[server]
# Please set a unique value, your mCaptcha instance's security depends on this being 
# unique
cookie_secret = "Zae0OOxf^bOJ#zN^&k7VozgW&QAx%n02TQFXpRMG4cCU0xMzgu3dna@tQ9dvc&TlE6p*n#kXUdLZJCQsuODIV%r$@o4%770ePQB7m#dpV!optk01NpY0@615w5e2Br4d"
# The port at which you want authentication to listen to
# takes a number, choose from 1000-10000 if you dont know what you are doing
port = 7000
#IP address. Enter 0.0.0.0 to listen on all available addresses
ip= "0.0.0.0" 
# enter your hostname, eg: example.com
domain = "localhost"
# Set true if you have setup TLS with a reverse proxy like Nginx.
# Does HTTPS redirect and sends additional headers that can only be used if
# HTTPS available to improve security
proxy_has_tls = false
#url_prefix = ""

[captcha]
# Please set a unique value, your mCaptcha instance's security depends on this being 
# unique
salt = "asdl;kjfhjawehfpa;osdkjasdvjaksndfpoanjdfainsdfaijdsfajlkjdsaf;ajsdfweroire"
# garbage collection period to manage mCaptcha system
# leave untouched if you don't know what you are doing
gc = 30
runners = 4
queue_length = 2000
enable_stats = true

[captcha.default_difficulty_strategy]
avg_traffic_difficulty =  50000 # almost instant solution
peak_sustainable_traffic_difficulty = 3000000 # roughly 1.5s
broke_my_site_traffic_difficulty = 5000000  # greater than 3.5s
duration = 30 # cooldown period in seconds

[database]
# This section deals with the database location and how to access it
# Please note that at the moment, we have support for only postgresqa.
# Example, if you are Batman, your config would be:
# hostname = "batcave.org"
# port = "5432"
# username = "batman"
# password = "somereallycomplicatedBatmanpassword"
hostname = "localhost"
port = "5432"
username = "postgres"
password = "password"
name = "postgres"
pool = 4
database_type="postgres" # "postgres", "maria"

[smtp]
from = "admin@localhost"
reply = "admin@localhost"
url = "127.0.0.1"
port = 10025
username = "admin"
password = "password"
  1. Remove the Redis container from the docker-compose file and remove MCAPTCHA_REDIS_URL environment variable from the mCaptcha container definition. And bind mount ./config/ to /etc/mcaptcha`. For example:
  • docker-compose.yml
version: "3.9"

services:
  mcaptcha:
    image: mcaptcha/mcaptcha:latest
    ports:
      - 7000:7000
    environment:
      DATABASE_URL: postgres://postgres:password@mcaptcha_postgres:5432/postgres # set password at placeholder
      RUST_LOG: debug
      PORT: 7000
    volumes:
      - type: bind
        source: ./config
        target: /etc/mcaptcha/
    depends_on:
      - mcaptcha_postgres

  mcaptcha_postgres:
    image: postgres:13.2
    volumes:
      - mcaptcha-data:/var/lib/postgresql/
    environment:
      POSTGRES_PASSWORD: password # change password
      PGDATA: /var/lib/postgresql/data/mcaptcha/

volumes:
  mcaptcha-data:

I should become free after tomorrow, if the issue still persists, I'll be available then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants