Skip to content

warren-bank/render-web-services

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fork Details

Goals

  • update the Docker container and associated scripts to enable a small private instance of the backend PHP server to be rapidly deployed for free on the hosting provider: render.com

https://render.com/
https://render.com/docs/free

free tier includes:
* 750 hours of web service uptime
  - web service is spun down after 15 minutes of inactivity
  - web service is spun up as needed, and 1st request can experience a delay of up to 30 seconds
* 1 Redis instance
  - ephemeral.. not backed by a disk
* 1 PostgreSQL
  - automatically expires 90 days after creation

--------------------------------------------------------------------------------

https://dashboard.render.com/register
  - no credit card required
  - only need to provide:
    * email address
    * password

https://dashboard.render.com/
https://dashboard.render.com/billing#free-usage

--------------------------------------------------------------------------------

https://dashboard.render.com/new/redis

Name               = hauk
Region             = Oregon (US West)
Maxmemory Policy   = allkeys-lru (recommended for caches)
Instance Type      = Free (25 MB RAM, 50 Connection Limit, No Persistence)

Internal Redis URL = redis://red-8qrs2p3h5q110nyy5le4:6379

--------------------------------------------------------------------------------

https://dashboard.render.com/select-repo?type=web

Public Git Repository = https://github.com/warren-bank/render-web-services
Name                  = warren-bank-hauk
Region                = Oregon (US West)
Branch                = hauk
Root Directory        = [empty]
Runtime               = Docker
Instance Type         = Free (512 MB RAM, 0.1 CPU)

Advanced > Environment Variables:
=================================
REDIS_HOST    = red-8qrs2p3h5q110nyy5le4
REDIS_PORT    = 6379
AUTH_METHOD   = PASSWORD
PASSWORD_HASH = $2y$10$4ZP1iY8A3dZygXoPgsXYV.S3gHzBbiT9nSfONjhWrvMxVPkcFq1Ka
VELOCITY_UNIT = MILES_PER_HOUR
PUBLIC_URL    = https://warren-bank-hauk.onrender.com/


Customization

  • the name of the web service must be universally unique
    • ex: warren-bank-hauk
    • choose your own
  • the value given to the environment variable PASSWORD_HASH should correspond to non-empty password that restricts access to the server
    • the following value corresponds to an empty password, which should not be used:
        $2y$10$4ZP1iY8A3dZygXoPgsXYV.S3gHzBbiT9nSfONjhWrvMxVPkcFq1Ka
      
    • using PHP, the command to generate your own is:
        # generate hash of password with randomized salt
        pw='my_server_password'
        php -n -r "print password_hash('${pw}', PASSWORD_BCRYPT);"
      
        # output
        $2y$10$WzDdd.xmPkBS03JhwQkk4.nMRUkY3ol76l/Kx9nJRmBbtW7aUfyTK
      
        # verify output
        hash='$2y$10$WzDdd.xmPkBS03JhwQkk4.nMRUkY3ol76l/Kx9nJRmBbtW7aUfyTK'
        php -n -r "print password_verify('${pw}', '${hash}') ? 'OK' : 'ERROR';"
      
        # output
        OK
    • using htpasswd, the command to generate your own is:
        # generate hash of password with randomized salt
        pw='my_server_password'
        htpasswd -n -b -B -C 10 "" "$pw" | tail -c +2
      
        # output
        $2y$10$CjhWuGGulQDPdxGwhqxkE.2zVTsz6AV0JeuMGsr51sEX1ZEPTAxn6
      
        # verify output
        hash='$2y$10$CjhWuGGulQDPdxGwhqxkE.2zVTsz6AV0JeuMGsr51sEX1ZEPTAxn6'
        php -n -r "print password_verify('${pw}', '${hash}') ? 'OK' : 'ERROR';"
      
        # output
        OK

Final Comments

  • This git repo is public. Anyone who wishes to host their own Hauk server using the free tier on render.com can link to it. There's no need to fork a copy, though you can if you prefer.

About

Web Services hosted on free tier at render.com

Resources

License

Stars

Watchers

Forks

Packages

No packages published