Showing posts with label Without. Show all posts
Showing posts with label Without. Show all posts

January 30, 2026

Making a Local Dev Server accessible via Public Domain using Cloudflare Tunnel

Hi all,

Today, we are going to discuss how you can publicly access the local running server with a domain and Cloudflare tunnel.

Pre-requisites

  1. Domain
  2. DNS on Cloudflare
  3. Cloudflare One account access
  4. Local server

Set up the environment

Application

Make sure your application runs locally on a port like 8000,9000 etc.

Cloudflare Tunnel

  1. Log in to your Cloudflare One account.
  2. Go to "Zero Trust".
  3. Expand Networks and select Connectors.
  4. Click on “Create a tunnel”.
  5. Select “Cloudflared”.
  6. Give a name to your tunnel.
  7. Click on “Save”.
  8. In the "Choose your environment" section, select the environment where the server is running.
  9. Follow the instructions to install and run a connector.
  10. Here, you need to move to your server machine.
  11. Open the terminal and perform the instructions to install the "cloudflared" tool.
  12. Run using the token (part of the command).
  13. Once the installation is completed. Click on Save.

Add IP/CIDR

  1. Edit the tunnel to add the IP/CIDR.
  2. Choose based on your local DHCP.

Published application routes

  1. Click on “Add a published application route”.
  2. Give an optional subdomain.
  3. Select the domain from the dropdown.
    1. You need to have your domain managed by Cloudflare (DNS).
  4. An optional path to make sure you have a frontend and a backend that work together.
  5. Under service, select Type as HTTP, and your local machine server port.
  6. Select the URL of the server application, including the localport.
    1. localhost:9000
  7. Click on “Save”.
Note: If you have a frontend and a backend, then you need to add one more application route.

In my scenario, the frontend path is * with localhost:9001, and the backend path is api/* with localhost:8000.

Run the tunnel

  1. Make sure your local web server is running
  2. Log in to cloudflared
    • cloudflared tunnel login
    • Authorize the tunnel on the web browser post login
  3. List the tunnels
    • cloudflared tunnel list
  4. Get the tunnel token from the tunnel you created in Cloudflare connectors
  5. Run the command on the local terminal
    • cloudflared tunnel run --token eyJhIjoiM2...
  6. Now, you should be able to browse your configured subdomain with your local web server content. 

Troubleshooted issue

If the frontend with path "/*" is above the backend route, then your backend APIs will never be reached.

So, "move up" the backend with "/api/*" path above the frontend to serve the requests.

Feel free to reach out to me if you have any doubts and clarifications needed at my email psrdotcom@gmail.com


June 02, 2012

Live CD Ubuntu Customization Kit (UCK) without Internet

Hi friends,

As many of you know that, UCK (Ubuntu Customization Kit) requires Internet when customizing the Live CD.

Why we need Internet while customization?

  • To get the updates from the repositories we need the internet.
  • To install any software using apt-get/synaptic package manager.
Do we need Internet all the time?

According to me, We may not need the Internet for small updates.
So, I have modified the customization scripts to work without Internet.


Pre-requisites:

Please download the following files.

sources.gz: 
According the ubuntu distro, we need to get the sources.gz from the link
http://archive.ubuntu.com/ubuntu/ubuntu/ubuntu/dists/$DISTRO_CODENAME/main/source/Sources.gz

gfxboot-theme-ubuntu_x.x.x:
http://archive.ubuntu.com/ubuntu/ubuntu/ubuntu/pool/main/g/gfxboot-theme-ubuntu/

Please place these two files in ~/Softwares/UCK/ directory

Note: ~ is home directory of the user.

Apply Patches

If you installed UCK, you will having the /usr/lib/uck/customization-profiles/localized_cd/ directory
In that directory, you will be having customize and customize_iso scripts.

Those two scripts will be copies to /home//tmp folder while running the UCK.

So, please apply the following patches in /usr/lib/uck/customization-profiles/localized_cd/ 

Now apply the patch as shown below

$ patch -u customize customize.patch
$ patch -u customize_iso customize_iso.patch

customize.patch


--- customize 2012-06-01 21:47:31.905741928 +0530
+++ customize_old 2012-06-01 21:46:03.509742149 +0530
@@ -121,8 +121,7 @@
arch=`if [ -d /lib64 ]; then echo x86_64; else echo i586; fi`
echo ">> Customizing: $rel, $kernel $arch"

-# Commented by PSR
-#prepare_install || failure "Preparing installation failed, error=$?"
+prepare_install || failure "Preparing installation failed, error=$?"

# List of packages to install to support the selected languages:
PACKAGES_TO_INSTALL=""
@@ -153,16 +152,16 @@
fi
done

-# Commented by PSR
- #install_packages $PACKAGES_TO_INSTALL || failure "Installing language packs failed, error=$?"
+ install_packages $PACKAGES_TO_INSTALL ||
+ failure "Installing language packs failed, error=$?"

# NOTE: we first install selected language packs, then remove others as
# installing a language pack might pull in packages that were not
# previously present
echo "Removing unnecessary language packages..."
REMOVED_PACKAGES=`dpkg-query --show | cut -f1 | grep -E '^(language-pack|language-support|firefox-locale)' | grep -Ev "[-]($LANGPACKS_CONCATENATED)\>"`
-# Commented by PSR
-# remove_packages $REMOVED_PACKAGES || failure "Removing packages failed, error=$?"
+ remove_packages $REMOVED_PACKAGES ||
+ failure "Removing packages failed, error=$?"
fi

if [ "$RUN_MANUAL_CUSTOMIZATIONS" = "yes" ] ; then

customize_iso.patch


--- customize_iso 2012-06-01 21:47:38.369741917 +0530
+++customize_iso_old 2012-06-01 21:46:00.441742156 +0530
@@ -50,9 +50,6 @@
REMASTER_DIR="$REMASTER_HOME/remaster-root"
BOOT_LANG=`cat "$SCRIPT_DIR/livecd_locale"`

-# Added by PSR
-SOURCES_DIR="/home/user/Softwares/UCK"
-
function failure()
{
echo "$@"
@@ -83,21 +80,12 @@
DISTRO_CODENAME=`cd "$ISO_REMASTER_DIR"/dists && find . -maxdepth 1 -type d | grep '/' | cut -d '/' -f2` || failure "Unable to identify Ubuntu distro codename"
APT_SOURCES_TMP_DIR=`mktemp -d`
-# Commented by PSR
-# wget -c http://archive.ubuntu.com/ubuntu/ubuntu/ubuntu/dists/$DISTRO_CODENAME/main/source/Sources.gz -O "$APT_SOURCES_TMP_DIR"/Sources.gz
-
-# Added by PSR
- cp "$SOURCES_DIR"/"$DISTRO_CODENAME"_Sources.gz "$APT_SOURCES_TMP_DIR"/Sources.gz
-
-# Commented by PSR
-# GFXBOOT_THEME_UBUNTU_SOURCE_PACKAGE=http://archive.ubuntu.com/ubuntu/ubuntu/ubuntu/pool/main/g/gfxboot-theme-ubuntu/$(zgrep gz "$APT_SOURCES_TMP_DIR"/Sources.gz | grep gfxboot-theme-ubuntu | sed -n 1p | awk '{ print $3 }')
+ wget -c http://archive.ubuntu.com/ubuntu/ubuntu/ubuntu/dists/$DISTRO_CODENAME/main/source/Sources.gz -O "$APT_SOURCES_TMP_DIR"/Sources.gz
+ GFXBOOT_THEME_UBUNTU_SOURCE_PACKAGE=http://archive.ubuntu.com/ubuntu/ubuntu/ubuntu/pool/main/g/gfxboot-theme-ubuntu/$(zgrep gz "$APT_SOURCES_TMP_DIR"/Sources.gz | grep gfxboot-theme-ubuntu | sed -n 1p | awk '{ print $3 }')

-# Commented by PSR
-# wget $GFXBOOT_THEME_UBUNTU_SOURCE_PACKAGE || -# failure "Unable to download gfxboot-theme-ubuntu source package from $GFXBOOT_THEME_UBUNTU_SOURCE_PACKAGE"
+ wget $GFXBOOT_THEME_UBUNTU_SOURCE_PACKAGE || + failure "Unable to download gfxboot-theme-ubuntu source package from $GFXBOOT_THEME_UBUNTU_SOURCE_PACKAGE"

-# Added by PSR
- cp "$SOURCES_DIR"/gfxboot-theme-ubuntu_0.14.2.tar.gz .
tar xfz *.tar.gz || failure "Unable to extract gfxboot-theme-ubuntu source package"
fi

Please apply the patch files and run the UCK without Internet.

Enjoy a quick Ubuntu Customization.

Please send you comments and feedback

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com