Giter Site home page Giter Site logo

ponggun / codesanook-ef-note Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codesanook/codesanook-ef-note

1.0 0.0 1.0 1.6 MB

Demo app for EF course

TSQL 3.65% C# 58.90% HTML 27.80% SCSS 2.73% JavaScript 3.02% Shell 2.83% Dockerfile 1.07%

codesanook-ef-note's Introduction

codesanook-ef-note

How to run the project locally

  • Fork this project
  • Clone the project to your computer.
git clone [email protected]:{your-github-username}/codesanook-ef-note.git

!!! Change {your-github-username} to your GitHub username

  • CD to to the root folder.
cd codesanook-ef-note
  • Launch Docker containers.
docker-compose down --volumes; docker-compose up --build
  • Wait for a while until you see dotnet watch messages, e.g.
web_1  | info: Microsoft.Hosting.Lifetime[0]
web_1  |       Now listening on: http://[::]:8000
  • Open a browser and navigate to http://localhost:8000/
  • You will find a simple note app that you can
    • Add a new notebook which is a group/container of each note
    • Add a new note.
    • Add a new tag.
    • Update/Delete notebook, note and tag.

Hot reload

  • Edit some C# source code in app folder.
  • Code will be compile automatically.
  • Refresh a browser and see what you have changed.

EF Note in a browser

ef-note-animated-screenshot.gif

Release compose for testing only

docker-compose down --volumes; docker-compose -f docker-compose.yml -f docker-compose.release.yml up --build

Production release

Create a new App Service

  • Create Azure App Service with a container
  • Use DockerHub registry and mcr.microsoft.com/dotnet/samples:aspnetapp image
  • Check log in deployment, open a browser and navigate to https://{your-app-service-name}.azurewebsites.net/
  • You should find an example ASP.NET Core MVC app

Set some configurations

  • Set these configurations:
    • WEBSITE_WEBDEPLOY_USE_SCM
      • true
    • WEBSITES_PORT
      • 8000
    • WEBSITES_PORT
      • true
    • CONNECTIONSTRINGS__DEFAULTCONNECTION
      • Server={your-server-name}.mysql.database.azure.com; Port=3306; Database={your-database-name}; Uid={your-username}@{your-server-name}; Pwd={your-password}; SslMode=Preferred;CharSet=utf8mb4;

Create DockerHub repository and get a new token

  • Create a public DockerHub repository
  • Get DockerHub token from Account Settings > Security > New Access Token

Create GitHub secret

  • Download publish profile from your App Service and use it a value of AZURE_WEBAPP_CONTAINER_PUBLISH_PROFILE secret
  • Create these GitHub secrets with their values:
    • AZURE_WEBAPP_CONTAINER_PUBLISH_PROFILE
    • AZURE_WEBAPP_NAME
    • DOCKERHUB_REPOSITORY
    • DOCKERHUB_TOKEN
    • DOCKERHUB_USERNAME

Trigger GitHub Actions

  • Go to GitHub Action tab and enable it
  • Create new commit and push the project to the main branch

Debugging

  • CD to app folder and launch run with debugging with VS Code .NET Core launch (web)
  • Start only a database container
docker-compose up db

Presentation

TODO

  • Improve code quality
  • Use async/await

codesanook-ef-note's People

Contributors

aaronamm avatar

Stargazers

 avatar

Forkers

bazukaaa

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.