Skip to content

Commit

Permalink
docs: FAQ - internet access is via a corporate proxy (#393)
Browse files Browse the repository at this point in the history
Should resolve these installation issues:
#364 and
#371

Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 authored Sep 23, 2024
1 parent 0ad1c04 commit f25902e
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/Installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ where ``<version-tag>`` is the version you want to install.
To install it in development mode, follow the instructions on this page: :ref:`dev-setup`.

4. Setup Deploy daemon
----------------------
**********************

Upon the successful installation of the AppAPI, a one-time configuration is essential.
Details on this configuration can be found in the subsequent section: :ref:`create-deploy-daemon`.
Expand Down
161 changes: 161 additions & 0 deletions docs/faq/BehindCompanyProxy.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
Corporate Proxy - Permanent Settings for PHP CLI
================================================

If you're using our application within a corporate network that requires proxy settings, you might encounter issues when running PHP CLI commands that attempt to access the internet.

To resolve this, you need to configure permanent proxy settings for the PHP CLI environment.

Symptoms
--------

When running the command:

.. code-block:: bash
php occ app_api:app:register --force-scopes test-deploy docker_socket_proxy --info-xml https://raw.githubusercontent.com/cloud-py-api/test-deploy/main/appinfo/info.xml --test-deploy-mode --no-ansi --no-warnings
You may receive an error similar to:

.. code-block:: text
file_get_contents(https://raw.githubusercontent.com/cloud-py-api/test-deploy/main/appinfo/info.xml): Failed to open stream: Connection timed out at /var/www/html/custom_apps/app_api/lib/Service/ExAppService.php#277
Cause
-----

This issue occurs because the PHP CLI environment does not have the proxy settings configured, unlike the web PHP environment which may already be using proxy settings specified in your web server configuration.

Permanent Solution
------------------

To permanently configure proxy settings for PHP CLI, you can either modify the PHP CLI `php.ini` file or set environment variables system-wide.

Method 1: Edit PHP CLI `php.ini` File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. **Locate the PHP CLI `php.ini` File**

Run the following command to find the loaded configuration file for PHP CLI:

.. code-block:: bash
php --ini
Look for the line:

.. code-block:: text
Loaded Configuration File: /path/to/php.ini
2. **Edit the `php.ini` File**

Open the `php.ini` file in a text editor with appropriate permissions:

.. code-block:: bash
sudo nano /path/to/php.ini
3. **Add Proxy Settings**

Add the following lines to configure the proxy settings:

.. code-block:: ini
[HTTP]
; Proxy settings for HTTP
http.proxy_host = "proxy.example.com"
http.proxy_port = 8080
http.proxy_user = "username"
http.proxy_password = "password"
[HTTPS]
; Proxy settings for HTTPS
https.proxy_host = "proxy.example.com"
https.proxy_port = 8080
https.proxy_user = "username"
https.proxy_password = "password"
Replace the placeholders with your actual proxy server details:

- `proxy.example.com`: Your proxy server address.
- `8080`: Your proxy server port.
- `username`: Your proxy username (if required).
- `password`: Your proxy password (if required).

4. **Save and Close the File**

Save the changes and exit the text editor.

5. **Verify the Configuration**

Run the PHP CLI command again:

.. code-block:: bash
php occ app_api:app:register
It should now be able to access the internet through the proxy.

**Note:** Not all PHP functions respect the proxy settings in `php.ini`. If issues persist, consider using system-wide environment variables.

Method 2: Set System-Wide Environment Variables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. **Edit Shell Profile**

For a permanent solution, add the proxy settings to the system-wide environment variables. Open the `/etc/environment` file:

.. code-block:: bash
sudo nano /etc/environment

2. **Add Proxy Environment Variables**

Add the following lines to the file:

.. code-block:: bash
http_proxy="http://proxy.example.com:8080"
https_proxy="http://proxy.example.com:8080"

# If your proxy requires authentication:
http_proxy="http://username:[email protected]:8080"
https_proxy="http://username:[email protected]:8080"

Replace the placeholders with your actual proxy details.

3. **Apply the Changes**

Log out and log back in, or reboot the system to apply the changes.

4. **Verify the Configuration**

Run the command again:

.. code-block:: bash
php occ app_api:app:register --force-scopes test-deploy docker_socket_proxy --info-xml https://raw.githubusercontent.com/cloud-py-api/test-deploy/main/appinfo/info.xml --test-deploy-mode --no-ansi --no-warnings

It should now work without connectivity issues.

**Note:** This method sets the proxy settings for all users and applications on the system.

Troubleshooting
---------------

- **Incorrect Proxy Details**

Ensure all proxy details are correct. Incorrect hostnames, ports, or credentials will prevent connectivity.

- **Environment Variables Not Loaded**

Make sure the environment variables are correctly loaded. A system reboot or re-login may be necessary.

- **Firewall Restrictions**

Verify with your network administrator that your system is allowed to access the internet through the proxy.

Contact Support
---------------

If you've followed these steps and still experience issues, please contact our support team for further assistance.
3 changes: 2 additions & 1 deletion docs/faq/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ or provide a brief answer.

This section will be updated with time, as new questions arise.
If you have a question that is not listed here or the answer is not enough for you, please feel free to
ask it by creating an issue in the `AppAPI repository <https://github.com/cloud-py-api/app_api/issues>`_.
ask it by creating an issue in the `AppAPI repository <https://github.com/nextcloud/app_api/issues>`_.


.. toctree::
Expand All @@ -20,4 +20,5 @@ or provide a brief answer.
DockerSocketProxy
GpuSupport
Scaling
BehindCompanyProxy
Troubleshooting

0 comments on commit f25902e

Please sign in to comment.