Code Monkey home page Code Monkey logo

muxwebapp's Introduction

Golang Mux Webapp Project Skeleton

Deployment Notes

  1. Build for linux (Ubuntu) architecture amd64:
cd <PROJECT>/
env GOOS=linux GOARCH=amd64 go build -o webapp -v
  1. Copy your project excluding the Go source *.go to your server in /var/www/html/<PROJECT>.
rsync -azv --exclude '*.go' ../<PROJECT> [email protected]:~/var/www/html/
  1. Configure supervisor to run the app.
sudo vim /etc/supervisor/conf.d/<PROJECT>.conf

# add the following
[program:<PROJECT>webapp]
environment =
   ENV=prod,
command=/var/www/html/<PROJECT>/webapp
autostart=true
autorestart=true
startretries=10
user=www-data
directory=/var/www/html/<PROJECT>/
redirect_stderr=true
stdout_logfile=/var/log/supervisor/<PROJECT>webapp.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=10

# reload supervisor
sudo supervisorctl reload
  1. Configure nginx as the frontend.
sudo vim /etc/nginx/sites-available/<PROJECT>.conf

# add the following
upstream <PROJECT> {
   server unix:/tmp/<PROJECT>.sock;
}

server {
   listen 80;
   server_name <PROJECT>;
   access_log /var/log/nginx/<PROJECT>-access.log;
   error_log /var/log/nginx/<PROJECT>-error.log error;
   location /static/ { alias /var/www/html/<PROJECT>/res/assets/; }
   location / {
       proxy_pass http://<PROJECT>;
   }
}

# enable the website configuration
sudo ln -s /etc/nginx/sites-available/<PROJECT>.conf /etc/nginx/sites-enabled
sudo service nginx reload

muxwebapp's People

Contributors

saidalisamed avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.