Clone the repo. FROM the root directory run the following commands:
go mod vendor
go mod tidy
Run below commands after enterring your respective credentials
- Run this command :
migrate -path database/migration/ -database "mysql://your_db_username:your_db_password@tcp(localhost:3306)/DB_NAME" -verbose up - If this command gives error run command :
migrate -path database/migration/ -database "mysql://your_db_username:your_db_password@tcp(localhost:3306)/DB_NAME" force version
- run command
go test ./pkg/models. - Ensure that should be OK
go build -o mvc ./cmd/main.go- Run the binary file:
./mvc
- Open localhost:9000 on your browser
Replace you_domain_name by the domain name you want to access the website.
- Install apache2 :
sudo apt install apache2 sudo a2enmod proxy proxy_httpsudo nano /etc/apache2/sites-available/your_domain_name.conf- Copy and paste the virtual host file.
sudo a2ensite your_domain_name.confsudo a2dissite 000-default.confsudo apache2ctl configtestsudo nano /etc/hostsAdd the following line:
127.0.0.1 your_domain_name
sudo systemctl restart apache2sudo systemctl status apache2Check your_domain_name on your browser
Run command make in root directory.
To host your website virtually on a custom domain name run these commands :
chmod +x ./scripts/virtualHostSetup.sh
./scripts/virtualHostSetup.sh
Run commands
chmod +x ./scripts/setup.sh
./scripts/setup.sh