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

Add CACTI_URL_PATH #73

Closed
xbolshe opened this issue Aug 15, 2020 · 6 comments
Closed

Add CACTI_URL_PATH #73

xbolshe opened this issue Aug 15, 2020 · 6 comments

Comments

@xbolshe
Copy link

xbolshe commented Aug 15, 2020

Now $url_path = '/cacti/' is hardcoded in config.php. And there is no possibility to change it via an environment variable.
My proposal is to add CACTI_URL_PATH to have a possibility to change url_path. It is useful for Kubernetes with Ingress controller.

$url_path = '/cacti/';

@scline
Copy link
Owner

scline commented Aug 15, 2020

By chance do you know what values need to change in the HTTP config file? Example if the /cacti/ URL was changed to /test/:

<VirtualHost *:80>
	DocumentRoot    /cacti
	Alias           /cacti          /cacti
        RedirectMatch   ^/$             /cacti
        <Directory "/cacti">
                Require all granted
        </Directory>
</VirtualHost>


<VirtualHost *:443>
	DocumentRoot            /cacti
	Alias                   /cacti          /cacti
        RedirectMatch           ^/$             /cacti
        <Directory "/cacti">
                Require all granted
        </Directory>
        SSLEngine On
        SSLCertificateFile      /etc/ssl/certs/cacti.crt
        SSLCertificateKeyFile   /etc/ssl/certs/cacti.key
</VirtualHost>

@xbolshe
Copy link
Author

xbolshe commented Aug 15, 2020

In my understanding,

<VirtualHost *:80>
	DocumentRoot    /cacti                         <--- folder, do not change
	Alias           /cacti          /cacti                 <----- change first, 2nd is a folder
        RedirectMatch   ^/$             /cacti         <--- URL, need to use CACTI_URL_PATH
        <Directory "/cacti">                               <--- folder, do not change
                Require all granted
        </Directory>
</VirtualHost>


<VirtualHost *:443>
	DocumentRoot            /cacti                   <--- folder, do not change
	Alias                   /cacti          /cacti            <----- change first, 2nd is a folder
        RedirectMatch           ^/$             /cacti     <--- URL, need to use CACTI_URL_PATH
        <Directory "/cacti">                                    <--- folder, do not change
                Require all granted
        </Directory>
        SSLEngine On
        SSLCertificateFile      /etc/ssl/certs/cacti.crt
        SSLCertificateKeyFile   /etc/ssl/certs/cacti.key
</VirtualHost>

More information:
https://httpd.apache.org/docs/2.4/mod/mod_alias.html
https://httpd.apache.org/docs/2.4/mod/core.html#documentroot
https://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirectmatch

scline added a commit that referenced this issue Aug 15, 2020
@scline
Copy link
Owner

scline commented Aug 15, 2020

Ah perfect, I had some things backwards thank you so much!

@scline scline mentioned this issue Aug 15, 2020
@scline
Copy link
Owner

scline commented Aug 15, 2020

Give the 1.2.14 branch a shot when you can, example docker-compose where the URL is now http://<cacti_ip>/xbolshe

version: '2'
services:


  cacti:
    image: "smcline06/cacti:1.2.14"
    container_name: cacti
    domainname: example.com
    hostname: cacti
    ports:
      - "80:80"
      - "443:443"
    environment:
      - DB_NAME=cacti_master
      - DB_USER=cactiuser
      - DB_PASS=cactipassword
      - DB_HOST=db
      - DB_PORT=3306
      - DB_ROOT_PASS=rootpassword
      - CACTI_URL_PATH=xbolshe
      - INITIALIZE_DB=1
      - TZ=America/Los_Angeles
    volumes:
      - cacti-data:/cacti
      - cacti-spine:/spine
      - cacti-backups:/backups
    links:
      - db


  db:
    image: "mariadb:10.3"
    container_name: cacti_db
    domainname: example.com
    hostname: db
    ports:
      - "3306:3306"
    command:
      - mysqld
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
      - --max_connections=200
      - --max_heap_table_size=128M
      - --max_allowed_packet=32M
      - --tmp_table_size=128M
      - --join_buffer_size=128M
      - --innodb_buffer_pool_size=1G
      - --innodb_doublewrite=ON
      - --innodb_flush_log_at_timeout=3
      - --innodb_read_io_threads=32
      - --innodb_write_io_threads=16
      - --innodb_buffer_pool_instances=9
      - --innodb_file_format=Barracuda
      - --innodb_large_prefix=1
      - --innodb_io_capacity=5000
      - --innodb_io_capacity_max=10000
    environment:
      - MYSQL_ROOT_PASSWORD=rootpassword
      - TZ=America/Los_Angeles
    volumes:
      - cacti-db:/var/lib/mysql


volumes:
  cacti-db:
  cacti-data:
  cacti-spine:
  cacti-backups:

@xbolshe
Copy link
Author

xbolshe commented Aug 16, 2020

Yes, CACTI_URL_PATH works well starting from Cacti installation in smcline06/cacti:1.2.14.

@scline
Copy link
Owner

scline commented Aug 16, 2020

Thank you, merged to master. latest will now have these changes.

@scline scline closed this as completed Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants