forumone / nextjs-project

Next.js project template
0 stars 0 forks source link
nextjs

NextJS Project Template

This is a build guide to help walk you through setting up a new NextJS project.

Requirements

Getting started...

  1. Clone this repository using Tiged/Degit.

    degit --mode=git git@github.com:forumone/nextjs-project.git [project-name]

    Note: If you have an issue with that command try without the --mode=git option

  2. Initialize the new project as a Git repository.

    cd [project-name]
    git init
  3. Add the git remote for the new repository.

    git remote add origin git@github.com:forumone/[project-name].git
  4. Update configuration in the ./.ddev/config.yaml

    1. Update name: [project name] to the correct project name.
  1. Go through the rest of the build process

Assuming Forum One hosted project,

Do you need storybook?

No

Please remove:

Do you need github action linting?

No

Please delete: ./github folder.

Do you need to use environment variables?

No
Yes

Configuring Capistrano

Configuring Capistrano deployments requires editing of the following files:

If additional environments are required you can copy capistrano/deploy/dev.rb to a new stage file and make the required changes.

capistrano/deploy.rb

Configuring the general deployment settings happens in capistrano/deploy.rb and requires replacing the following placeholder tokens in the settings:

APP_NAME

This is simply a name for the application that will be used as a directory name. Replace it with a relevant string to be used to identify your application.

HTTPS_REPO_URL

This should be the HTTPS clone URL for your repo to be deployed. You may access this from the GitHub UI.

capistrano/deploy/<dev|stage|prod>.rb

The files located at capistrano/deploy/*.rb define deployment targets for the application to be released to. For each environment the application is being deployed to there should be one matching file with the environment-specific configuration defined. To create a new deployment environment, the capistrano/deploy/dev.rb file may be duplicated and renamed to match the name of the new environment. Then the same configuration process described below should be followed by customizing each of the following tokens in the file settings:

stage

The stage name should match that of the containing file. For example, the dev.rb file should set this to :dev.

SITE_URL

This is the URL used to access the site being deployed.

ENVIRONMENT_NAME

This is the name of the environment's vhost directory where the application will be deployed to. Usually this is a combination of a short application name followed by the environment name, e.g., nextjs.dev. By replacing this token in the full path, the setting would look like this:

# The path to the project on the server
set :deploy_to, '/var/www/vhosts/nextjs.dev'
BRANCH

This is the specific git branch to be deployed to this environment from the repository. Typically these follow the pattern in the following table.

Environment Branch
dev integration
stage main
prod live
SERVER_LOGIN

This defines the servers to be deployed to and the logins to be used for access. In most use cases, each instance of this token will use the same login. An example login would look like:

# Simple Role Syntax
# ==================
# Supports bulk-adding hosts to roles, the primary
# server in each group is considered to be the first
# unless any hosts have the primary property set.
role :app, %w{wordpress@wordpress.byf1.dev}, :primary => true
role :web, %w{wordpress@wordpress.byf1.dev}
role :db,  %w{wordpress@wordpress.byf1.dev}

Project README

Remove this README.md file and rename the README.project.md file to README.md. Update the README.md with the correct details for your projects. Take note of the Project Name at the top as well as the Buildkite badge setup. (Note: The Buildkite build status badge can be found in the Buildkite pipeline settings online.)