Return to Level1Techs.com

AdminDev 2.0

Hey everyone! Happy Devember! :smiley:

This is going to be a continuation, spiritual successor, call it what you will of my AdminDev Labs thread. I am going to revamp my website to be officially version 2.0 and change from Node.js to Golang. I’ll likely keep the CSS (trim it up, maybe) and use the HTML of the existing EJS.

It’s been around for a while and it’s starting to show, I think. Lately I’ve been focusing on software delivery and infrastructure as code (Groovy, Python, Ruby, Bash) so I’ve lost a bit of my webdev 31337 skillz I think.

This will be an all around refactoring, retooling, and relearning :sunglasses:

Web server will be in Go, content will be CSS/HTML, and I’ll have a script to deploy/push changes to the server.

So far I’ve done a lot!

package main

import "fmt"

func main() {
    fmt.Println("vim-go")
}

Lmao. That’s the boilerplate that comes with the vim plugin :joy: :rofl:

Just been staring at the screen :frowning:

14 Likes

Happy Dev-ing and good luck

1 Like

:thonk: hmm maybe I should make a devember thread…

2 Likes

Awesome! Good luck!

2 Likes

Day 2

I have a simple server that presents the index page. Yay.

.
├── controllers
│   └── general.go
├── main.go
└── templates
    └── index.gohtml

main.go

package main

import (
	"html/template"
	"net/http"
	"projects/site/controllers"
)

var tpl *template.Template

func init() {
	tpl = template.Must(template.ParseGlob("templates/*"))
}

func main() {
	c := controllers.NewController(tpl)
	http.HandleFunc("/", c.Index)
	http.ListenAndServe(":3000", nil)
}

general.go

package controllers

import (
	"html/template"
	"net/http"
)

type Controller struct {
	tpl *template.Template
}

func NewController(t *template.Template) *Controller {
	return &Controller{t}
}

func (c Controller) Index(w http.ResponseWriter, req *http.Request) {
	c.tpl.Execute(w, "index.gohtml")
}

index.gohtml

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>AdminDev Labs</title>
    <link rel="stylesheet" href="/main.css" type="text/css">
</head>
<body>
<h1>AdminDev Labs</h1>
<p>This is a test, bitches!</p>
</body>
</html>

image

7 Likes

Moar updates!!!

1 Like
CaptainsLog.txt

CSS is infuriating

End Log...
2 Likes

That’s what frameworks are for!

Just use something like Tacyons or if you want minimalism use Milligram.

2 Likes

Milligram looks cool. Their water drop “loading” is really what I’m trying to do.

My issue isn’t really not knowing what to use it’s what to do. I want the loading screen to have a black hole effect, where all the contents on the page “suck in” towards the center and the new page loads.

Just weird to conceptualize in something that I’m not terribly familiar with.

1 Like

Here is a repo where I spent a few hours trying to understand Mithril.js and configuring Webpack from fucking scratch.

https://gitlab.com/Dynamic-Gravity/my-portfolio

It was lean as fuck. Like 80KB raw and about 10KB gziped.

2 Likes

You mean like how Discord does it?

I believe they do that with SVG’s and canvas layering.

1 Like

I’d have to take a look, haven’t logged into Discord for a while.

At least I got the CSS file working lmao.

func main() {
	c := controllers.NewController(tpl)
	http.HandleFunc("/", c.Index)
	http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
	http.ListenAndServe(":3000", nil)
}

1 Like

All right, looks a bit better lol. Done for the day.

Yay.

Testing mobile compatibility:

@Dynamic_Gravity Thanks man, I got some ideas from the links you provided lol. Minimalism is the way to go :stuck_out_tongue_winking_eye:

8 Likes

Got a repo up.

Now I’m done for the day lol.

6 Likes

Few of my co-workers are getting into Go too, although we look at it from the C++ perspective. All this activity around it makes me think I need to look into it too, but I also need to learn modern C++.

2 Likes

Definitely worth it. Especially if you want in on embedded development stuff. Go has been fun.

It’s CSS that is killing me right now lol. Trying to get rid of the scroll bar on Firefox. It’s apparently not possible (not giving up).


I updated the about and podcast pages. It’s was pretty easy, basically copied and paste. I want to get some sort of caching going, too. Right now when I click between pages the “hero image” flashes. I’m hoping caching will remedy that (it did with Node.js).

Rough To-Do

+ Caching
+ Logging
+ Finish pages
+ Redirection/Error handling
+ Throw it on Heroku/DigitalOcean/AWS/Whatever
1 Like

Here is a .gitlab-ci.yml file for deploying to a heroku dyno.

Need to define two env vars: HEROKU_APP_NAME, and $HEROKU_API_KEY.

stages:
  - test
  - deploy

run_tests:
   stage: test
   image: node:latest
   script:
     - npm ci
     - npm run test
   tags:
     - docker

deploy_to_prod:
  stage: deploy
  image: ruby:latest
  script:
    - apt-get update -qy
    - apt-get install -y ruby-dev
    - gem install dpl
    - dpl --provider=heroku --app=$HEROKU_APP_NAME --api-key=$HEROKU_API_KEY
  only:
    - master
  tags:
    - ruby
  when: on_success
1 Like

image

Let me get the thing all pretty like before I get a hosting platform :joy:

4 Likes

Is best <3