How to install My Idlers using Docker, Cloud SQL on Ubuntu 20.04

My Idlers is a web app for displaying, organizing, and storing information about servers (VPS), shared & reseller hosting, seedboxes, domains, DNS, and misc services.

Despite what the name infers this self-hosted web app isn't just for storing idling server information. By using a YABs output you can get disk & network speed values along with GeekBench 5 scores to do easier comparing and sorting.

My Idlers Features

Features included on My Idlers :

  • Add servers
  • Add shared hosting
  • Add domains
  • Auto get IP's from hostname
  • Check up/down status
  • Get YABs data from the output
  • Compare 2 servers
  • Save & view YABs output
  • Update YABs disk & network results
  • Next due date system
  • Multi-currency compatibility
  • Multi payment-term compatibility
  • Pre-defined operating systems
  • Assign labels
  • Assign server type (KVM, OVZ, LXC & dedi)
  • Easy to edit values

Prerequisites

My Environments

Virtual Machine / VPS Cloud SQL
IP Private : 10.184.0.3 IP Private : 10.27.0.3
Port 8000 to 80 with NGINX DB_DATABASE : myidle
DB_USERNAME : myidlers
DB_PASSWORD : sementarasendiri123

Run My Idlers using Docker and Cloud SQL

On this post, I'm using Cloud SQL from GCP so make sure it uses private connections to both VM and SQL by assigning private IP on Connections tab

Choose Network (VPC) that we are using

After it has been done, click Save.

Add a new user on the Users tab because we are not using root to this database.

Create a new user in Cloud SQL on Users tab

Back to SSH in VM, use the following command :

docker run -d \
  -p 8000:8000\
  -e APP_URL=https://... \
  -e DB_HOST=... \
  -e DB_DATABASE=... \
  -e DB_USERNAME=... \
  -e DB_PASSWORD=... \
  ghcr.io/cp6/my-idlers:latest

In my case :

docker run -d \
  -p 8000:8000\
  -e APP_URL=http://my-idlers.ns1.my.id \
  -e DB_HOST=10.27.0.3 \
  -e DB_DATABASE=myidle \
  -e DB_USERNAME=myidlers \
  -e DB_PASSWORD=sementarasendiri123 \
  ghcr.io/cp6/my-idlers:latest

(Output)

root@naufalvm:/home/ariq# docker run -d -p 127.0.0.1:8000:8000 -e APP_URL=http://my-idlers.ns1.my.id -e DB_HOST=10.27.0.3 -e DB_DATABASE=myidle -e DB_USERNAME=myidlers -e DB_PASSWORD=sementarasendiri123 ghcr.io/cp6/my-idlers:latest
89fa8b3321a260af9563dbc5817114e59a10960e03b0ba7b999e68e8ffc43409

Run the following command to set up database one time

docker exec ... php artisan migrate:fresh --seed --force  # Set up database one time

Replace ... with your docker container instance id.

in my case (with output) :

root@naufalvm:/home/ariq# docker exec 89f php artisan migrate:fresh --seed --force  # Set up database one time
Dropped all tables successfully.
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table (40.23ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table (39.42ms)
Migrating: 2021_02_10_122904_create_servers_table
Migrated:  2021_02_10_122904_create_servers_table (60.08ms)
Migrating: 2022_01_30_112059_create_providers_table
Migrated:  2022_01_30_112059_create_providers_table (40.34ms)
Migrating: 2022_01_30_112350_create_locations_table
Migrated:  2022_01_30_112350_create_locations_table (45.45ms)
Migrating: 2022_02_01_031629_create_os_table
Migrated:  2022_02_01_031629_create_os_table (39.90ms)
Migrating: 2022_02_01_233932_create_domains_table
Migrated:  2022_02_01_233932_create_domains_table (55.23ms)
Migrating: 2022_02_02_005352_create_d_n_s_table
Migrated:  2022_02_02_005352_create_d_n_s_table (55.66ms)
Migrating: 2022_02_03_035702_create_labels_table
Migrated:  2022_02_03_035702_create_labels_table (71.51ms)
Migrating: 2022_02_03_040140_create_shareds_table
Migrated:  2022_02_03_040140_create_shareds_table (57.06ms)
Migrating: 2022_02_03_040152_create_resellers_table
Migrated:  2022_02_03_040152_create_resellers_table (57.29ms)
Migrating: 2022_02_05_104355_create_yabs_table
Migrated:  2022_02_05_104355_create_yabs_table (95.09ms)
Migrating: 2022_02_05_104551_create_disk_speed_table
Migrated:  2022_02_05_104551_create_disk_speed_table (58.44ms)
Migrating: 2022_02_05_104919_create_network_speed_table
Migrated:  2022_02_05_104919_create_network_speed_table (55.21ms)
Migrating: 2022_02_05_105219_create_pricing_table
Migrated:  2022_02_05_105219_create_pricing_table (41.97ms)
Migrating: 2022_02_08_010323_create_labels_assigned_table
Migrated:  2022_02_08_010323_create_labels_assigned_table (54.01ms)
Migrating: 2022_02_09_032438_create_settings_table
Migrated:  2022_02_09_032438_create_settings_table (55.49ms)
Migrating: 2022_02_11_022150_create_miscs_table
Migrated:  2022_02_11_022150_create_miscs_table (54.83ms)
Migrating: 2022_02_21_001233_create_ips_table
Migrated:  2022_02_21_001233_create_ips_table (96.74ms)
Migrating: 2022_03_05_125635_add_cols_to_settings
Migrated:  2022_03_05_125635_add_cols_to_settings (34.08ms)
Migrating: 2022_03_09_022939_add_homepage_amount_cols_to_settings
Migrated:  2022_03_09_022939_add_homepage_amount_cols_to_settings (36.32ms)
Migrating: 2022_05_09_114227_add_foreign_keys
Migrated:  2022_05_09_114227_add_foreign_keys (356.02ms)
Migrating: 2022_05_09_154509_add_dark_mode_setting
Migrated:  2022_05_09_154509_add_dark_mode_setting (36.08ms)
Migrating: 2022_05_15_105254_create_seedboxes_table
Migrated:  2022_05_15_105254_create_seedboxes_table (53.88ms)
Seeding: Database\Seeders\SettingsSeeder
Seeded:  Database\Seeders\SettingsSeeder (5.63ms)
Seeding: Database\Seeders\ProvidersSeeder
Seeded:  Database\Seeders\ProvidersSeeder (5.91ms)
Seeding: Database\Seeders\LocationsSeeder
Seeded:  Database\Seeders\LocationsSeeder (8.29ms)
Seeding: Database\Seeders\OsSeeder
Seeded:  Database\Seeders\OsSeeder (5.95ms)
Seeding: Database\Seeders\LabelsSeeder
Seeded:  Database\Seeders\LabelsSeeder (5.60ms)
Database seeding completed successfully.

Install NGINX and Certbot

Install NGINX as a proxy to serve the application directly :

apt install nginx python-certbot-nginx

Check your default vhost config file on /etc/nginx/sites-enabled or /etc/nginx/conf.d and replace location / block with :

location / {
        proxy_pass http://localhost:8000;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
}
This location / block to ensure ports 8000 are served on port 80 with NGINX

After replaced, reload your nginx config with this :

service nginx reload

Issue SSL cert with certbot by using the following command :

certbot --nginx -d yourdomain.com
Replace yourdomain.com with your own domain names

This will immediately request your email address, agree with the Terms of Service, and so on.

in my case (with output) :

root@naufalvm:/etc/nginx/sites-enabled# certbot --nginx -d my-idlers.ns1.my.id
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): myemail@gmail.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for my-idlers.ns1.my.id
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/default

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/default

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://my-idlers.ns1.my.id
Issue a free SSL Certificate with Certbot

Choose number 2 on Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. It will create your nginx config automatically to set redirect port 80 to port 443.

My Idlers Preview

My Idlers preview, i have 4 servers right now xD

You can check more screenshots of My Idlers on Github/my-idlers, or check their demo.

GitHub - cp6/my-idlers: Web app for displaying, organizing and storing information about servers (VPS), shared hosting and domains.
Web app for displaying, organizing and storing information about servers (VPS), shared hosting and domains. - GitHub - cp6/my-idlers: Web app for displaying, organizing and storing information abou...

Thanks for reading! 😊