Giter Club home page Giter Club logo

polkukone's Introduction

Polkukone

The application is built using the AWS Serverless Application Model (SAM) and is deployed using the AWS Cloud Development Kit (CDK).

Project was initially created using the cdk init polkukone --language typescript command.

Original README.md file is available for reference as README-CDK.md.

Packages

For package specific instructions, you can refer to the following README.md files:

These README.md files provide detailed description about the packages and their dependencies and how to run them locally.

Requirements

  • XCode - xcode-select --install
  • Homebrew - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Node.js - brew install node@18
  • Visual Studio Code - brew install visual-studio-code
    • VS Code is recommended editor for the project.
    • Project ships with VS Code Workspace Settings located at .vscode/.

Prerequisites

You should already have Git installed on your machine to use AWS CodeCommit. You can verify the installation by running:

git --version

If Git is not installed, you can install it using Homebrew:

brew install git

AWS CLI

Install and configure the AWS CLI with your credentials:

brew install awscli
aws configure

You will be prompted for your Access Key ID, Secret Access Key, default region, and output format. Enter these accordingly.

AWS CodeCommit

OS X includes a system-level Git credential store that might interfere with the AWS CLI's credential helper when attempting to connect to AWS CodeCommit repositories.

Insert following lines into your ~/.gitconfig file and you're able to use the credential helper for AWS CodeCommit repositories and the osxkeychain helper for all other repositories:

[credential "https://git-codecommit.*.amazonaws.com"]
    helper = !aws codecommit credential-helper $@
    UseHttpPath = true
[credential "https://github.com"]
    helper = osxkeychain
[credential "https://gitlab.com"]
    helper = osxkeychain

Setup

If the infrastructure has already been setup up using AWS CDK, you can skip the Infrastructure section and proceed directly to the Deployment section.

Infrastructure has been setup if the repository was cloned using the CodeCommit URL. In that case, the remote is already set to the CodeCommit repository and the infrastructure is most likely already deployed.

After inital deployment, the resources and services are updated using AWS CodePipeline and AWS CodeBuild. The pipelines are triggered by pushing changes to the main branch of the AWS CodeCommit repository.

npm/yarn/pnpm workspaces are not used currently. This is because lock file (package-lock.json/yarn.lock/pnpm-lock.yaml) is needed for each service and currently there's no way to do that with workspaces properly (there's some hackish community implementations so we'll wait for official solution).

Only downside is that we need to run npm install in each package directory separately and we don't get the benefit of hoisting dependencies to the root node_modules directory.

Infrastructure

Run the following commands to deploy the infrastructure using AWS CDK.

Install AWS CDK:

npm install -g aws-cdk

Set up the AWS CDK Toolkit stack in your AWS account:

cdk bootstrap

Install dependencies:

npm install

Deploy the CDK stack:

cdk deploy

CfnOutput outputs resources and services that are deployed by the CDK stack. You're able to access these resources and services using the URL's printed in the output.

Git Remote

Make sure your Git remote is set to the CodeCommit repository. HTTP & SSH clone URL's are printed in the output (CfnOutput) of the cdk deploy command.

If you would want to use GitHub instead of CodeCommit, you would need to change the repository property of the CodeCommitSourceAction in lib/polkukone-pipeline-stack.ts to GitHubSourceAction and set origin remote to the GitHub repository URL.

For GitLab, you would need to set repository mirroring to the GitLab repository URL as there is no GitLab source action available in AWS CDK currently.

Run these commands from repository root:

# Remove the default remote
git remote remove origin

# Replace the URL with the one from the output of `cdk deploy`
git remote set-url origin https://git-codecommit.eu-central-1.amazonaws.com/v1/repos/polkukone

Deployment

Push changes to the main branch of the CodeCommit repository and the pipeline will automatically deploy the changes to the resources and services.

Known Issues

  • Sequelize auto increment get's fucked up when importing from multiple CSV sources (final bulkCreate operation)

polkukone's People

Contributors

jaakkolehtonen avatar

Watchers

 avatar  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.