Skip to content

ulysse-lacour/Jolify-front

Repository files navigation

JOLIFY APP

Techs :

Nuxt

For detailed explanation on how things work, check out the documentation or bellow :

Details

You can create the following extra directories, some of which have special behaviors. Only pages is required; you can delete them if you don't want to use their functionality.

assets

The assets directory contains your uncompiled assets such as Stylus or Sass files, images, or fonts.

More information about the usage of this directory in the documentation.

components

The components directory contains your Vue.js components. Components make up the different parts of your page and can be reused and imported into your pages, layouts and even other components.

More information about the usage of this directory in the documentation.

layouts

Layouts are a great help when you want to change the look and feel of your Nuxt app, whether you want to include a sidebar or have distinct layouts for mobile and desktop.

More information about the usage of this directory in the documentation.

pages

This directory contains your application views and routes. Nuxt will read all the *.vue files inside this directory and setup Vue Router automatically.

More information about the usage of this directory in the documentation.

plugins

The plugins directory contains JavaScript plugins that you want to run before instantiating the root Vue.js Application. This is the place to add Vue plugins and to inject functions or constants. Every time you need to use Vue.use(), you should create a file in plugins/ and add its path to plugins in nuxt.config.js.

More information about the usage of this directory in the documentation.

static

This directory contains your static files. Each file inside this directory is mapped to /.

Example: /static/robots.txt is mapped as /robots.txt.

More information about the usage of this directory in the documentation.

store

This directory contains your Vuex Store files. Vuex Store option is implemented in the Nuxt.js framework.

Creating a file in this directory automatically activates the option in the framework.

More information about the usage of this directory in the documentation.

Gsap

Npm documentation

GreenSock documentation

Lazysizes

Documentation

Pwa

Documentation

Tailwind

Cheatsheet



Deploy

Set up nginx

Create server block :

sudo nano /etc/nginx/sites-available/my_project

And add :

server {
    listen 80;
    listen [::]:80;
    index index.html;
    server_name IP_ADRESS_OR_DOMAIN_NAME;

    access_log /home/eljovial/nuxt/my_project/logs/access.log;
    error_log /home/eljovial/nuxt/my_project/logs/error.log error;

    location / {
        proxy_pass http://localhost:PORT_NUMBER;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Link to sites-enabled :

sudo ln -s /etc/nginx/sites-available/my_project /etc/nginx/sites-enabled

Check for syntax errors :

sudo nginx -t

Don't forget to use the right directory structure bellow !

Restart nginx :

sudo systemctl restart nginx

Or you can restart nginx with bash ~/restart_nginx.sh


Add project to server

Directories structure

In order to use versioning we use this directory structure :

/MyAppName
|--/releases
|----/v1.0.0
|----/v1.1.0
|----/v1.2.0
|----/...
|
|--/current -> /releases/v1.2.0 (symlink)
|
|--/logs
|----/access.log
|----/error.log

Create symlink with :

ln -s /home/eljovial/nuxt/my_project/releases/v1.2.0 /home/eljovial/nuxt/my_project/current

Git clone inside version directory instead of pull/merge newest version :

git clone https://$PAT@github.com/GIT_USERNAME/REPOSITORY_NAME.git

To update app just git clone to latest version directory you created, update the symlink, delete older symlink and delete older app.


Make suree to add a .env file inside project directory and add your env variables

touch .env

Run app in production

First of all :

# install dependencies
npm install
# build for production
npm run build
# if static site build with
npm run generate

Deplpoy (PM2)


Documentation

To run the app in background, inside project directory next to our package.json file, run :

pm2 start npm --name MyAppName -- start

Then, inside project directory, to configure our pm2 config file run :

pm2 init

This will create ecosystem.config.js file, replace its content with :

module.exports = {
  apps: [
    {
      name: 'app_name', // App name that shows in `pm2 ls`
      exec_mode: 'cluster', // enables clustering
      instances: 'max', // or an integer
      cwd: './current', // only if using a subdirectory
      script: './node_modules/nuxt/bin/nuxt.js',
      args: 'start'
    }
  ]
}

To reload the app run :

pm2 reload MyAppName

To see current node.js running :

pm2 list

Delete app :

pm2 delete ID_APP

HTTPS with certbot


Documentation


sudo certbot --nginx -d example.com

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published