module-zero-core-template icon indicating copy to clipboard operation
module-zero-core-template copied to clipboard

Please consider this PR, to help to update the project Docker files.

Open EduardoSantanaSeverino opened this issue 3 years ago • 15 comments

Please consider this PR, to help to update the project Docker files.

EduardoSantanaSeverino avatar Aug 27 '21 21:08 EduardoSantanaSeverino

@EduardoSantanaSeverino thank you very much for your contribution. @demirmusa can you test and merge this PR ?

ismcagdas avatar Aug 28 '21 08:08 ismcagdas

Hi @ismcagdas,

The files were created to no break the current Docker build. that is why for the most part of the PR is adding files that have the suffix _udpated.

Do you rather go with overwriting the files?

EduardoSantanaSeverino avatar Sep 08 '21 17:09 EduardoSantanaSeverino

@EduardoSantanaSeverino I think updating the original files will be better.

ismcagdas avatar Sep 09 '21 05:09 ismcagdas

Thank you for your comments. I will make the update.

EduardoSantanaSeverino avatar Sep 10 '21 16:09 EduardoSantanaSeverino

I will end up not changing the default port 80. and overwriting default docker files.

EduardoSantanaSeverino avatar Sep 13 '21 19:09 EduardoSantanaSeverino

@EduardoSantanaSeverino See my comments please and I don't think -updated suffix is necessary. Just update the original files.

The -updated suffix was removed. and set the default port 80.

EduardoSantanaSeverino avatar Sep 13 '21 19:09 EduardoSantanaSeverino

@ismcagdas anything else I could do?

EduardoSantanaSeverino avatar Oct 12 '21 22:10 EduardoSantanaSeverino

@gterdem do you have any other comments ?

ismcagdas avatar Oct 13 '21 05:10 ismcagdas

@ismcagdas Is there something else I could help to get it merged?

EduardoSantanaSeverino avatar Nov 17 '21 16:11 EduardoSantanaSeverino

@EduardoSantanaSeverino no, it is fine but I couldn't have time to test it yet, sorry. We will probably test and merge this next week.

ismcagdas avatar Nov 19 '21 05:11 ismcagdas

@ismcagdas anything else I could do?

EduardoSantanaSeverino avatar Jun 24 '22 14:06 EduardoSantanaSeverino

Hi @EduardoSantanaSeverino,

I reviewed this PR, but I have a problem with running this project. Can you provide me a simple document for running this projects, to make it available for everyone? (SSL certificates etc.)

m-aliozkaya avatar Sep 06 '22 08:09 m-aliozkaya

Hi @m-aliozkaya , Thank you for your comment.

Can you provide me a simple document for running this projects, to make it available for everyone?

  • I am not sure what type of document you referring to?
  • Do you mean a PDF with instructions on how to run this PR?
  • Do you have an example of the document

(SSL certificates etc.)

Regarding SSL certificates etc. SSL certificates are not implemented in this PR, because when working with containers 99 percent of the time TLS termination proxy is used, and the SSL encryption is performed by another container/proxy.

Please let me know what type of document you referring to? or how can I help?

Thank you.

Eduardo

EduardoSantanaSeverino avatar Sep 09 '22 14:09 EduardoSantanaSeverino

@EduardoSantanaSeverino a basic step by step document to run project using Docker would be great. Markdown format is prefered option for us. We had problems when running the project using the modified files.

ismcagdas avatar Sep 11 '22 11:09 ismcagdas

Thank you @ismcagdas , I will work on it.

EduardoSantanaSeverino avatar Sep 12 '22 14:09 EduardoSantanaSeverino

I will be recording a video demonstration on how to use those files without being merged.

EduardoSantanaSeverino avatar Oct 25 '22 18:10 EduardoSantanaSeverino

Hi @ismcagdas ,

Please find the demonstration video below:

https://youtu.be/w5JxpkvVVx4

Let me know if I am missing something please.

Thank you!

Eduardo


Video content:

How to containerized your Asp.net BoilerPlate Application

Intro:

This is a video demonstration for How to containerized a new Asp.net Boiler Plate Application. The following instructions will allow you running one aspnetboilerplate application as docker container. The Dockerfile and docker-compose files are taken from a repository with a pull request and it is explained down below in the following steps.

Requirements:

For you to follow along the following instructions you will need to be familiar with git, aspnetboilerplate, docker, aspnet core, angular. that is why I will not be exaplaining anything about aspnetboilerplate, I going to be creating a full series of videos about how to create your project with aspnetboilerplate, this video is only how to run the project as a docker container.

I am going to be using the following tools:

  • Git command line for Linux or Mac or Git bash for Windows
  • Docker for Linux or Mac or Windows
  • Docker Compose for Linux or Mac or Windows
  • SQL Server Management Studio

Instructions:

  • Download the new template application from aspnetboilerplate website. Ex: https://aspnetboilerplate.com/Templates. For our example we are taking ASP.NET Core target version v7.x and Single Page Web Application with Angular.
  • Leave the Options by default which will be Include login, register, user, roles and tenant management pages. And untick the One solution.
  • Set your project name to be MyCollege.
  • Enter the captcha code, leave the latest stable version and click the download project button.
  • You will get a MyCollege.zip file.
  • Extract this file, and inside you will file the version number in our example we have 7.3. We don't need this version now. Go inside the version number folder and create a git repository in there. In my example, I will be doing:
    • unzip MyCollege.zip -d MyCollege/
    • cd MyCollege/7.3.0/
  • Once terminal and navigated to inside the version number folder, once there execute those commands:
    • git init
    • git add .
    • git commit -m 'my initial commit'
  • Then we are going to add some Docker files from this repository pull request https://github.com/aspnetboilerplate/module-zero-core-template/pull/613. Basically we are taking all updated and new files from this pull request and copy them over to our new project folder. In my example I am copying those file with this command:
    • cp -r ../../copy-from-merge/* ./
    • git status
    • Open the folder: /root/source/MyCollege/7.3.0, and Look that files, for example:
    • angular/src/assets/appconfig.container.json
    • angular/Dockerfile
    • angular/.dockerignore
    • aspnet-core/Dockerfile
    • aspnet-core/.dockerignore
    • aspnet-core/build/build-with-ng-updated.sh
    • aspnet-core/docker/ng/docker-compose.yml
    • aspnet-core/docker/ng/.gitignore
  • Open the root of the repository folder with any IDE/text editor of your preference, I am using VS Code.
  • Update the file aspnet-core/Dockerfile place holder AbpCompanyName.AbpProjectName with your project own name. In my case I am doing MyCollege name, and executing this commands:
    • cat ./aspnet-core/Dockerfile
    • sed -i "s/AbpCompanyName.AbpProjectName/MyCollege/g" ./aspnet-core/Dockerfile
    • cat ./aspnet-core/Dockerfile
  • Create a new database in your MS SQL Server, for me it will be MyCollegeDb. Therefore I am going to MS SQL Management Studio and executing the CREATE DATABASE MyCollegeDb command.
  • Go back to VS code and set the connection string in the aspnet-core/src/MyCollege.Migrator/appsettings.json file. For my example the connection string will be: Server=192.168.22.101;Database=MyCollegeDb;User Id=sa;Password=D8JeW7jjSmBVXLcRxWLDwMjYLnf6xVG8;. For my example:
    • cat ./aspnet-core/src/MyCollege.Migrator/appsettings.json
    • sed -i "s/Server=localhost; Database=MyCollegeDb; Trusted_Connection=True;/Server=192.168.22.101;Database=MyCollegeDb;User Id=sa;Password=D8JeW7jjSmBVXLcRxWLDwMjYLnf6xVG8;/g" ./aspnet-core/src/MyCollege.Migrator/appsettings.json
    • cat ./aspnet-core/src/MyCollege.Migrator/appsettings.json
  • With your terminal navigate to migration project folder and run this project with the following command:
    • cd ./aspnet-core/src/MyCollege.Migrator
    • dotnet run
  • Build the container image for the Angular Application and the Aspnet Core Application by running the script hosted in aspnet-core/build/build-with-ng-updated.sh. Please note this script is expecting you to navigate your terminal to the folder aspnet-core/build and then execute the script from there.
    • cd ../../../aspnet-core/build
    • ls -al
    • cat ./build-with-ng-updated.sh
    • docker image ls
    • ./build-with-ng-updated.sh
  • Run your docker-compose file by updating the environment variables on the file aspnet-core/docker/ng/docker-compose.yml as desired. and finally, navigate your terminal to: aspnet-core/docker/ng, once there execute the following command:
    • cd ../../aspnet-core/docker/ng
    • cat ./docker-compose.yml
    • sed -i "s/Server=10.0.75.1; Database=AbpProjectNameDb; User=AbpProjectNameUser; Password=YourStrongPassword;/Server=192.168.22.101;Database=MyCollegeDb;User Id=sa;Password=YOUR_PASSWORD;/g" ./docker-compose.yml
    • cat ./docker-compose.yml
    • docker-compose up -d
    • docker-compose ps

Final Notes:

Once the pull request is merged all you would need to run your application as docker container is follow the steps number 11 and 15.

Finally updating the remote repository:

  • git remote add origin [email protected]:EduardoSantanaSeverino/MyCollegeTest01.git
  • git push origin master
  • https://github.com/EduardoSantanaSeverino/MyCollegeTest01

EduardoSantanaSeverino avatar Oct 27 '22 00:10 EduardoSantanaSeverino

@m-aliozkaya could you check it again ? @EduardoSantanaSeverino thanks a lot for your contribution again.

ismcagdas avatar Oct 27 '22 05:10 ismcagdas

My mistake, I removed: m-aliozkaya from the reviewers.

EduardoSantanaSeverino avatar Oct 27 '22 18:10 EduardoSantanaSeverino

Hi @EduardoSantanaSeverino,

I followed the steps, it's working great. Thank you for contributing.

m-aliozkaya avatar Oct 28 '22 14:10 m-aliozkaya

Hi @EduardoSantanaSeverino,

I updated the Powershell script and renamed the Bash script. If these changes are ok, I merge

m-aliozkaya avatar Nov 03 '22 06:11 m-aliozkaya

Looks good to me!

EduardoSantanaSeverino avatar Nov 03 '22 14:11 EduardoSantanaSeverino