Note:
This is not a Personal Project by me las-nish\
Type | Details | Status | Changed to |
---|---|---|---|
Database | MariaDB | Changed | PostgreSQL DB |
Concept | Multi Tenant Database Concept | Removed | Normal Database |
Service | Domain Name | Removed | Just an IP Address |
Service | AWS Server | Changed | Vultr Server |
Software | JetBrains DataGrip | Changed | Visual Studio Code |
Software | JetBrains GoLand | Changed | Visual Studio Code |
Directory structure in /Server
adm -> Administrator section
bgo -> GO language binary tarball
bin -> Website binary executable
bpg -> PostgreSQL binary tarball
cdn -> Website file storage
cmd -> GO file of the project
dta -> Database warehouse
thm -> Website complete theme
Language | Version | For What | Architecture | Platform |
---|---|---|---|---|
GO | >= 17.7 | Backend | x86_64 | Linux |
JS | Undefined | Front End | Undefined | Undefined |
SCSS | >= 1.49.4 | Front End | Undefined | Undefined |
Database | Version | Architecture | Platform |
---|---|---|---|
PostgreSQL | >= 10.20 | x86_64 | Linux |
Library Name | Reason | Why | References |
---|---|---|---|
Gorilla Handlers | Optimizing HTTP Server responses with GZIP compression | By sending a compressed response we save bandwidth and download time eventually rendering the page faster | Go Web Development CookBook, Page 48 |
Gorilla Mux | Implementing HTTP request routing | Define more than one URL route in web application | Go Web Development CookBook, Page 66 |
Directory Structure for Server
Server
|- adm : Administrator Directory
|- bgo : Go Language Binary Tarball Directory
|- bin : Web Site's bin Directory
|- bpg : PostgreSQL Binary Tarball Directory
|- cdn : Storage Directory
|- cmd : GO Files Directory
|- dta : Database Storage Directory
|- thm : Theme Directory
|- www : Site Directory
Just ignore Server/bgo
directory, if you installing GO compiler using package managers
- Create temporary global variable in
.bashrc
file,export c_path=/codinoc_server
- Test it using
echo $c_path
- Create Main directory using
sudo mkdir $c_path
- Add linux user permission to that directory using
sudo chown -R [USER_NAME]:[USER_NAME]
- Copy all project files and folders into
$c_path
directory
sudo chmod -R +rwx $c_path/bgo/bin && \
sudo chmod -R +rwx $c_path/bpg/bin
sudo yum install glib* && \
sudo dnf provides */libncurses.so.5 && \
sudo dnf install ncurses-compat-libs
- Follow this tutorial to install GO Language in any linux distro or this one
- Setup GO Packages used by the project
go env -w GO111MODULE=auto
go get github.com/gorilla/mux &&
go get github.com/gorilla/handlers
Download and extract PostgreSQL archive pn /Server/bpg
directory
We use PostgreSQL 10.20 Linux Binary Tarball here and you can download it using this link
- Initialize data directory
cd $c_path/bpg/bin
./pg_ctl -D $c_path/dta initdb
- Start PostgreSQL server
./pg_ctl -D $c_path/dta -l logfile start
- Stop PostgreSQL Server
./pg_ctl -D $c_path/dta -l logfile stop
- Running status of PostgreSQL
pgrep pg_ctl
- Login to PostgreSQL Server
./psql [DATABASE-NAME]
Note:
On the first login, need to create a Database
./psql template1
CREATE DATABASE sample_db;
TODO
Add these content into the hosts
file using sudo nano /etc/hosts
# Codinoc IDE
127.0.0.1:8080 codinoc.com
So after that, we can access to site using codinoc.com:8080/
in web browser