The and-cli
is built upon our team's best practices for setting up projects.
Cross-platform wrapper of file and directory copying. See shelljs cp command for additional options for the --flags
argument.
and-cli copy --source path/to/existing/file.txt --destination path/to/destination/folder
- Copy file to destination folderand-cli copy --source path/to/existingfolder --destination path/to/destination/folder --flags "-r"
- Copy file to destination folder recursively
Collection of deployment sub-commands to manage a variety of application types.
Amazon provides a variety of command-line tools to interact with their services. Below are general system and project configuration requirements to run them via and-cli
System requirements:
- Python 3.7+
- Ensure configured in your PATH
- Configure AWS IAM User account
- Log into AWS console
- Click Username dropdown > My Security Credentials > Users
- Click
Add User
- Add User name
{project}-{environment}
(ie. andculture-working) - Select
Programmatic Access
andAWS Management Console access
- Add User name
- Click `Next: Permissions
- Click
Attach existing policies directly
AWSElasticBeanstalkFullAccess
- Any other policies necessary
Project requirements:
- Add new AWS EB profile to your
~/.aws/config
file[profile your-name] aws_access_key_id = YOUR_ACCESS_KEY_ID aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
- Ensure general AWS system/project requirements are met
- Ensure your IAM User has the
AWSElasticBeanstalkFullAccess
security policy enabled - Perform initial EB setup in project repository in desired git branch
$: eb init --profile {YOUR_PROFILE_NAME}
- Or for an existing application update your
.elasticbeanstalk/config
fileglobal: profile: {YOUR_PROFILE_NAME}
- Setup AWS beanstalk manifest
- dotnet
- Create
dotnet/aws-windows-deployment-manifest.json
. Example...{ "manifestVersion": 1, "deployments": { "aspNetCoreWeb": [ { "name": "my-application", "parameters": { "appBundle": "release.zip", "iisPath": "/", "iisWebSite": "Default Web Site" } } ] } }
- Create
- dotnet
- Configure application's entry point
- dotnet
- Configure a
web.config
with your aspnet core assembly<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> </handlers> <aspNetCore processPath="dotnet" arguments=".\Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" /> </system.webServer> </configuration>
- Configure a
- dotnet
and-cli deploy aws-beanstalk --dotnet
- Deploy dotnet core application to AWS beanstalk- Optionally pass
--timeout <number>
to set the timeout in minutes, defaults to 20. - Optionally pass
--verbose
to stream events from the Elastic Beanstalk log.
- Optionally pass
- Ensure general AWS system/project requirements are met
- Ensure your IAM User has the
AWSS3FullAccess
security policy enabled
and-cli deploy aws-s3 --webpack --destination my-bucket/folder/name --profile {YOUR_PROFILE_NAME}
- Copies webpack build artifacts from
frontend/build
and deploys them to--destination
- Optionally pass
--publish
flag to perform webpack build as a part of the call --profile
argument specifies IAM profile with permissions to S3.
- Copies webpack build artifacts from
Azure has a number of CLI commands for managing resources on their service. In order to utilize these commands, you can either use a service principal with a secret to deploy to your Azure resources (recommended), or you can use the credentials for an Azure account directly.
It is recommended that Azure Active Directory is utilized to deploy resources, as this allows fine-grained access to only the resources related to your project. However, this is not required, and you are able to deploy resources using credentials for an Azure account with appropriate access (with some exceptions).
Setting up Azure AD:
- Configure Azure AD Service Principal
- Log into Azure Portal
- Navigate to your Azure Active Directory
- Navigate to the App Registrations section
- Click New Registration
- Add name
{project}-{environment}
(ie. andculture-working) - Click Register
- You should get re-directed to the dashboard for the new app registration. If not, navigate to the App Registrations section and click on the newly created App Registration.
- Take note of the
Application (client) ID
andDirectory (tenant) ID
as you will need these later.
- Add name
- Navigate to the Certificates & Secrets section
- Click New client secret.
- Select an expiration date, if applicable.
- Take note of the
Value
of the newly created secret, as you will need this later.
Project requirements (if using Azure AD):
- For each resource in your application, do the following:
- Navigate to the dashboard of the resource
- Navigate to Access control (IAM)
- Click Add in the Add a role assignment section
- Select the appropriate role
- Search for the app registration you have created for this project
- Click Save
- Ensure general Azure system/project requirements are met.
- Get the Service Principal credentials, or the Azure account credentials.
and-cli deploy azure-storage --webpack --destination https://azure-blob-storage-url/container/folder --client-id CLIENT_ID_HERE --tenant-id TENANT_ID_HERE --secret SECRET_HERE
- Copies webpack build artifacts from
frontend/build
and deploys them to--destination
- Optionally pass
--publish
flag to perform webpack build as a part of the call - Optionally pass
--public-url
flag to setup local.env with PUBLIC_URL environment variable. - Optionally pass
--recursive
flag to recursive upload directory to Azure. - If not using a Service Principal, pass the account username in the
--username
argument instead of--client-id
and--tenant-id
, and pass the account password in the--secret
argument.
- Copies webpack build artifacts from
- Ensure general Azure system/project requirements are met.
- Get the Service Principal credentials, or the Azure account credentials.
- Setup the Web App for local git deployment.
This command allows you to deploy to Azure Web Apps through local git deployment. This works by adding a remote to your Azure Web App git address and pushing a specified branch to that remote. Kudu will then build your project on Azure and deploy the application.
and-cli deploy azure-web-app --app-name APP_NAME_HERE --resource-group RESOURCE_GROUP_NAME_HERE --client-id CLIENT_ID_HERE --tenant-id TENANT_ID_HERE --secret SECRET_HERE --branch BRANCH_NAME_TO_DEPLOY_HERE --remote REMOTE_NAME_HERE
- Checks to see if the remote exists in your git repository, if not, grabs the URL from Azure for your Web App and creates the remote. Then, pushes the indicated branch to
master
in the newly created remote for your Web App. - Optionally pass
--force
to use the-f
flag in the git push to the remote. - If not using a Service Principal, pass the account username in the
--username
argument instead of--client-id
and--tenant-id
, and pass the account password in the--secret
argument.
- Checks to see if the remote exists in your git repository, if not, grabs the URL from Azure for your Web App and creates the remote. Then, pushes the indicated branch to
Trigger jenkins jobs requiring parameters remotely. Jobs requiring tags
and-cli deploy jenkins --init
- Initialize jenkins configuration with jenkins server url, jenkins username and api token
and-cli deploy jenkins --new
- Create a profile name for a Jenkins job to be triggered
and-cli deploy jenkins --profile PROFILE_NAME --tag VERSION
- Trigger a jenkins job remotely by providing the specified profile name and requested tag
While the sdk will eventually locate your solution file .sln
. Placing your solution file in one of the following locations is recommended for the
best performance.
- Root
*.sln
- Child of dotnet folder
dotnet/*.sln
- Grandchild of dotnet folder
dotnet/*/*.sln
- Anywhere else
**/*.sln
and-cli dotnet
- Runs the dotnet solution's web projectand-cli dotnet -b, --build
- Builds the solutionand-cli dotnet -c, --clean
- Cleans the solutionand-cli dotnet -- --cli my command
- Runs commands through a project's custom dotnet cli projectand-cli dotnet -R, --restore
- Restores NuGet packages for the solutionand-cli dotnet -r, --run
- Runs the dotnet solution's web project (default)and-cli dotnet -w, --watch
- Runs the solution and reloads on changes
and-cli dotnet-test
- Run automated tests for the solutionand-cli dotnet-test --filter <filter>
- Runs automated tests that match the provided filter text
The and-cli
itself requires some minor setup and these commands hopefully ease that lift.
and-cli install
- Configures global npm package, project-specificand-cli
alias and the developerand-cli-dev
alias
This command wraps the functionality provided by the dotnet ef tool for common Entity Framework interactions, such as creating a new migration, applying the migration, or deleting an existing migration.
and-cli migration --add <migration name>
- Creates a new entity framework migration based on changes from the last context snapshot.and-cli migration --run <migration name>
- Applies (or reverts) an entity framework migration based on the current database.and-cli migration --delete
- Removes files for the most recent migration, which cannot be applied to the database. If already applied, you need to revert to a previous migration first.
Various commands to interact with github andculture related resources.
and-cli github repo -l|--list
- Lists main AndcultureCode repositoriesand-cli github repo --list -u|--username <username>
- Lists forked AndcultureCode repositories for the supplied github usernameand-cli github topic --list --repo AndcultureCode.Cli
- Lists topics for a specified AndcultureCode repoand-cli github topic --add hacktoberfest --repo AndcultureCode.Cli
- Adds a topic to a specified AndcultureCodeRepoand-cli github topic --remove hacktoberfest --repo AndcultureCode.Cli
- Removes a topic from a specified AndcultureCode repoand-cli github topic --remove hacktoberfest
- Removes a topic from all AndcultureCode reposand-cli github issue --list --repo AndcultureCode.Cli
- Lists open issues for the cli repoand-cli github issue --clone-from AndcultureCode.JavaScript.Core#95 --repo AndcultureCode.JavaScript.React
- Clones issue from one AndcultureCode repo to another
While the dotnet core cli provides some nuget commands, the process start to finish is less than ideal. These commands aim to make that simple.
and-cli nuget --publish <version>
- Updates, packs and publishes dotnet core 'packable' projects to NuGet
Starts webpack built projects located in our team's conventional 'frontend' folder by way of the npm run start
command.
and-cli webpack
- Starts webpack development server configured in the 'frontend' folder.and-cli webpack -c -R
- Optionally cleans and restores npm packages before running the frontend application.and-cli webpack-test
- Starts interactive frontend tests vianpm run test
in 'frontend' folderand-cli webpack-test -c -R
- Optionally cleans and restores npm packages before running test suiteand-cli webpack-test --ci
- Optionally runs frontend tests synchronously for use in continous integration
Series of commands to synchronize a development workspace for easy contributions for AndcultureCode repositories.
and-cli workspace -c|--clone
- Clones all public AndcultureCode organization repositories into current folderand-cli workspace -u|--usernames <username1,username2,...>
- Additionally clones forks of the AndcultureCode repositories for the supplied user(s)and-cli workspace -f|--fork
- Will create forks of AndcultureCode repos for currently authenticated github userand-cli workspace --fork --usernames yourusername
- Combiningusernames
andfork
flag, you can have your full workspace forked and those forks automatically cloned all in one pass.