Merge branch 'alper/standalone-product'

pull/997/head
Alper Ebicoglu 7 years ago
commit 678b4406d8

2
.gitignore vendored

@ -267,7 +267,7 @@ framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Logs/*.*
modules/blog/app/Volo.BlogTestApp/Logs/*.*
modules/blogging/app/Volo.BloggingTestApp/Logs/*.*
modules/blogging/app/Volo.BloggingTestApp/wwwroot/files/*.*
modules/docs/app/Volo.DocsTestApp/Logs/*.*
modules/docs/app/VoloDocs.Web/Logs/*.*
samples/BookStore/src/Acme.BookStore.Web/Logs/*.*
templates/module/app/MyCompanyName.MyProjectName.DemoApp/Logs/*.*
templates/mvc/src/MyCompanyName.MyProjectName.Web/Logs/*.*

@ -0,0 +1,146 @@
# VoloDocs
## What is VoloDocs?
VoloDocs is a cross-platform web application that allows you to easily create beautiful documentation and build developer communities. It simplifies software documentation with the help of GitHub integration. You use the power of GitHub for versioning, hosting of your docs. You let your users to edit a document.
## Main Features
- Serves documents from your GitHub repository.
- Supports Markdown / HTML document formatting.
- Supports versioning (integrated to GitHub releases).
- Support multiple projects.
- Allows users to edit a document on GitHub.
- Cross-platform; deployable to Windows / Linux / macOS.
## GitHub Repository
It's free & open-source. You can browse VoloDocs source-code and contribute on GitHub:
https://github.com/abpframework/abp/tree/master/modules/docs
## Download
You can download the VoloDocs release from the following link:
http://apps.abp.io/VoloDocs/VoloDocs.zip
## Folder Structure
When you extract the VoloDocs.Release zip file, you see a `Web` folder and a `Migrator` folder. `Web` folder contains the website files and `Migrator` contains the application to build your database. Before publishing your website, you need to create a new database or update your existing database to the latest. If this is the first time you install VoloDocs, `Migrator` will create a new database for you, otherwise it updates to the latest version. The only setting you need to configure, is the `ConnectionString` which is located in the `appsettings.json` file. See the next section for how to configure your VoloDocs application.
## Steps by Step Deployment
- ### Database Migration
To update your existing database or create your initial database, go to `Migrator` folder in your VoloDocs directory.
Open `appsettings.json` in your text editor and set your database connection string. If you don't know how to write the connection string for your database system, you can check out https://www.connectionstrings.com/.
After you set your connection string, run `Migrate.bat` for Windows platform and `VoloDocs.Migrator` for other operating systems. That's it now configure your website.
- ### Configuring Website
Go to `Web` folder in your VoloDocs directory. Open `appsettings.json` in your text editor. Set your connection string (same as in the `Migrator`'s `appsettings.json`). Set `title` of your website. This will be written on the left-upper corner of your website. That's it! Now you can publish your website.
If you want to run
- ### Publishing Website
In the previous step, you created or updated your database. Ensure that your database exists on the specified connection string.
- #### Publishing to IIS
- Move `Web` folder to your `wwwroot ` folder.
- Rename `Web` folder to `VoloDocs` (Now you have `C:\inetpub\wwwroot\VoloDocs`).![Add IIS Website](images/volodocs-iis-add-website.png)
- The `VoloDocs` application pool is being created automatically. Open **Application Pools** and double click `VoloDocs` application pool and set
- **.NET CLR version**: `No Managed Code`
- **Managed pipeline mode**: `Integrated`
![Add IIS Website](images/volodocs-iis-application-pool.png)
- If you get the below error, it means don't have the hosting bundle installed on the server. See [this document](https://docs.microsoft.com/aspnet/core/host-and-deploy/iis/#install-the-net-core-hosting-bundle) to learn how to install it or [download Hosting Bundle](https://www.microsoft.com/net/permalink/dotnetcore-current-windows-runtime-bundle-installer) and run on your server.
```
Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list using IIS
```
- Further information about hosting VoloDocs check out [Microsoft's official document for hosting ASP.NET Core application on IIS](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis).
- #### Publishing to Azure
Microsoft has a good document on how to deploy your ASP.NET Core web app to Azure App Service. We recommend you to read this document https://docs.microsoft.com/en-us/azure/app-service/app-service-web-get-started-dotnet.
- #### Running the Application From Command Line
Alternatively you can run the application from command line, navigate to `VoloDocs\Web` folder and run the below command in your command line for Windows:
```powershell
dotnet VoloDocs.Web.dll
```
- ### First Run
To start the website, navigate to your address (as configured in the previous section).
When you first open the website, you need to create a project.
#### Creating a Project
Go to the following address to create project
- `http://<yourwebsite>/Account/Login?returnUrl=/Docs/Admin/Projects`
##### Default credentials
To login the admin side, use the following credentials:
* **Username**: `admin`
* **Password**: `1q2w3E*`
##### An example project definition
Here's a sample project information that uses GitHub source.
We will configure the VoloDocs to show ABP Framework's documentation that's stored in GitHub.
Here's the link to ABP Framework GitHub docs folder:
https://github.com/abpframework/abp/tree/master/docs/en
* **Name**: `ABP Framework`
* **Short name**: `abp`
* **Format**: `markdown`
* **Default document name**: `Index`
* **Navigation document name**: `docs-nav.json`
* **Minimum version**: <empty>
* **Main web site URL**: /
* **Latest version branch name**: <empty>
* **GitHub root URL**: `https://github.com/abpframework/abp/tree/{version}/docs/en/`
* **GitHub access token**: <retrieve from GitHub>
* **GitHub user agent**: <your username>
After you save the project, go to root website address and you will see your documentation.
* `http://<yourwebsite>/documents`

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

@ -23,10 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.Web", "src\Volo.D
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "app", "app", "{555508AD-F593-43E3-9354-9FA51512F181}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.DocsTestApp", "app\Volo.DocsTestApp\Volo.DocsTestApp.csproj", "{30BC20A3-85CE-4907-8FD0-54153C3F190C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.DocsTestApp.EntityFrameworkCore", "app\Volo.DocsTestApp.EntityFrameworkCore\Volo.DocsTestApp.EntityFrameworkCore.csproj", "{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "domain", "domain", "{A982A58E-1E92-4764-9F56-39E7AABB8556}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "admin-app", "admin-app", "{BCA19441-17E9-43E6-AED1-15344D18F967}"
@ -55,6 +51,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.TestBase", "test\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.Admin.Application.Tests", "test\Volo.Docs.Admin.Application.Tests\Volo.Docs.Admin.Application.Tests.csproj", "{E9CF69BC-EEA6-4621-BE0E-64EE37C89807}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VoloDocs.EntityFrameworkCore", "app\VoloDocs.EntityFrameworkCore\VoloDocs.EntityFrameworkCore.csproj", "{1B459653-8DAC-41CD-A08E-28D6E74265D3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VoloDocs.Web", "app\VoloDocs.Web\VoloDocs.Web.csproj", "{057EA924-4524-4452-840C-5E3D509F2ED3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VoloDocs.Migrator", "app\VoloDocs.Migrator\VoloDocs.Migrator.csproj", "{8A5E5001-C017-44A8-ADDA-DC66C102556E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -93,14 +95,6 @@ Global
{871FB966-C89F-4AF5-BB1D-172625AA571C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{871FB966-C89F-4AF5-BB1D-172625AA571C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{871FB966-C89F-4AF5-BB1D-172625AA571C}.Release|Any CPU.Build.0 = Release|Any CPU
{30BC20A3-85CE-4907-8FD0-54153C3F190C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30BC20A3-85CE-4907-8FD0-54153C3F190C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30BC20A3-85CE-4907-8FD0-54153C3F190C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30BC20A3-85CE-4907-8FD0-54153C3F190C}.Release|Any CPU.Build.0 = Release|Any CPU
{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A}.Release|Any CPU.Build.0 = Release|Any CPU
{37D483C8-400B-4127-A6D0-2EE4E80CB696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37D483C8-400B-4127-A6D0-2EE4E80CB696}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37D483C8-400B-4127-A6D0-2EE4E80CB696}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -141,6 +135,18 @@ Global
{E9CF69BC-EEA6-4621-BE0E-64EE37C89807}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9CF69BC-EEA6-4621-BE0E-64EE37C89807}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9CF69BC-EEA6-4621-BE0E-64EE37C89807}.Release|Any CPU.Build.0 = Release|Any CPU
{1B459653-8DAC-41CD-A08E-28D6E74265D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B459653-8DAC-41CD-A08E-28D6E74265D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B459653-8DAC-41CD-A08E-28D6E74265D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B459653-8DAC-41CD-A08E-28D6E74265D3}.Release|Any CPU.Build.0 = Release|Any CPU
{057EA924-4524-4452-840C-5E3D509F2ED3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{057EA924-4524-4452-840C-5E3D509F2ED3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{057EA924-4524-4452-840C-5E3D509F2ED3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{057EA924-4524-4452-840C-5E3D509F2ED3}.Release|Any CPU.Build.0 = Release|Any CPU
{8A5E5001-C017-44A8-ADDA-DC66C102556E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A5E5001-C017-44A8-ADDA-DC66C102556E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A5E5001-C017-44A8-ADDA-DC66C102556E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A5E5001-C017-44A8-ADDA-DC66C102556E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -154,8 +160,6 @@ Global
{30808C64-F590-47F7-AF8A-256F6B6E186B} = {8B0CDFC9-E313-4323-9390-59CFFAAC60B5}
{BF3FDDFF-BED8-422C-82E9-07F181A2D47F} = {8B0CDFC9-E313-4323-9390-59CFFAAC60B5}
{871FB966-C89F-4AF5-BB1D-172625AA571C} = {8B0CDFC9-E313-4323-9390-59CFFAAC60B5}
{30BC20A3-85CE-4907-8FD0-54153C3F190C} = {555508AD-F593-43E3-9354-9FA51512F181}
{A5F88BCB-6B22-4E2D-AE89-AEF1E3DC727A} = {555508AD-F593-43E3-9354-9FA51512F181}
{A982A58E-1E92-4764-9F56-39E7AABB8556} = {42416152-5BAB-4706-93A6-57A19E71FE14}
{BCA19441-17E9-43E6-AED1-15344D18F967} = {42416152-5BAB-4706-93A6-57A19E71FE14}
{8B0CDFC9-E313-4323-9390-59CFFAAC60B5} = {42416152-5BAB-4706-93A6-57A19E71FE14}
@ -169,6 +173,9 @@ Global
{89F895EA-C4A0-4D91-9181-016F78459776} = {59D430A9-AC61-4457-8338-5DA0705ABB5D}
{C8BF652A-6DDF-4E5C-8CBA-BA5AFC50BFE2} = {59D430A9-AC61-4457-8338-5DA0705ABB5D}
{E9CF69BC-EEA6-4621-BE0E-64EE37C89807} = {59D430A9-AC61-4457-8338-5DA0705ABB5D}
{1B459653-8DAC-41CD-A08E-28D6E74265D3} = {555508AD-F593-43E3-9354-9FA51512F181}
{057EA924-4524-4452-840C-5E3D509F2ED3} = {555508AD-F593-43E3-9354-9FA51512F181}
{8A5E5001-C017-44A8-ADDA-DC66C102556E} = {555508AD-F593-43E3-9354-9FA51512F181}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {13691265-2547-4FFF-B757-E8FACB05679D}

@ -1,4 +0,0 @@
@page
@model Volo.DocsTestApp.Pages.IndexModel
<h3>Welcome to the Docs Demo!</h3>
<a href="/documents/">Go to documents...</a>

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Volo.DocsTestApp.Pages
{
public class IndexModel : PageModel
{
public void OnGet()
{
}
}
}

@ -1,6 +0,0 @@
{
"ConnectionStrings": {
"SqlServer": "Server=localhost;Database=DocsTestApp;Trusted_Connection=True;MultipleActiveResultSets=true",
"MongoDb": "mongodb://localhost:27017|DocsTestApp"
}
}

@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.DocsTestApp.EntityFrameworkCore;
using VoloDocs.EntityFrameworkCore;
namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations
namespace VoloDocs.EntityFrameworkCore.Migrations
{
[DbContext(typeof(DocsTestAppDbContext))]
[DbContext(typeof(VoloDocsDbContext))]
[Migration("20181225134002_Initial20181225")]
partial class Initial20181225
{

@ -1,7 +1,7 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations
namespace VoloDocs.EntityFrameworkCore.Migrations
{
public partial class Initial20181225 : Migration
{

@ -4,12 +4,12 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.DocsTestApp.EntityFrameworkCore;
using VoloDocs.EntityFrameworkCore;
namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations
namespace VoloDocs.EntityFrameworkCore.Migrations
{
[DbContext(typeof(DocsTestAppDbContext))]
partial class DocsTestAppDbContextModelSnapshot : ModelSnapshot
[DbContext(typeof(VoloDocsDbContext))]
partial class VoloDocsDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{

@ -5,11 +5,11 @@ using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Docs.EntityFrameworkCore;
namespace Volo.DocsTestApp.EntityFrameworkCore
namespace VoloDocs.EntityFrameworkCore
{
public class DocsTestAppDbContext : AbpDbContext<DocsTestAppDbContext>
public class VoloDocsDbContext : AbpDbContext<VoloDocsDbContext>
{
public DocsTestAppDbContext(DbContextOptions<DocsTestAppDbContext> options)
public VoloDocsDbContext(DbContextOptions<VoloDocsDbContext> options)
: base(options)
{

@ -3,24 +3,24 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace Volo.DocsTestApp.EntityFrameworkCore
namespace VoloDocs.EntityFrameworkCore
{
public class DocsTestAppDbContextFactory : IDesignTimeDbContextFactory<DocsTestAppDbContext>
public class VoloDocsDbContextFactory : IDesignTimeDbContextFactory<VoloDocsDbContext>
{
public DocsTestAppDbContext CreateDbContext(string[] args)
public VoloDocsDbContext CreateDbContext(string[] args)
{
var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<DocsTestAppDbContext>()
.UseSqlServer(configuration.GetConnectionString("SqlServer"));
var builder = new DbContextOptionsBuilder<VoloDocsDbContext>()
.UseSqlServer(configuration["ConnectionString"]);
return new DocsTestAppDbContext(builder.Options);
return new VoloDocsDbContext(builder.Options);
}
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../Volo.DocsTestApp/"))
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../VoloDocs/"))
.AddJsonFile("appsettings.json", optional: false);
return builder.Build();

@ -5,7 +5,7 @@ using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Docs.EntityFrameworkCore;
namespace Volo.DocsTestApp.EntityFrameworkCore
namespace VoloDocs.EntityFrameworkCore
{
[DependsOn(
typeof(DocsEntityFrameworkCoreModule),
@ -13,7 +13,7 @@ namespace Volo.DocsTestApp.EntityFrameworkCore
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpEntityFrameworkCoreSqlServerModule))]
public class DocsTestAppEntityFrameworkCoreModule : AbpModule
public class VoloDocsEntityFrameworkCoreModule : AbpModule
{
}

@ -0,0 +1,13 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
namespace VoloDocs.Migrator
{
public static class AppExtensions
{
public static T Resolve<T>(this IAbpApplicationWithInternalServiceProvider app)
{
return (T)app.ServiceProvider.GetRequiredService<T>();
}
}
}

@ -0,0 +1 @@
@dotnet VoloDocs.Migrator.dll

@ -0,0 +1,94 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using VoloDocs.EntityFrameworkCore;
namespace VoloDocs.Migrator
{
class Program
{
private const string ScriptFile = "Script.txt";
static void Main(string[] args)
{
Console.WriteLine("Initializing VoloDocs Migrator ... ");
using (var app = AbpApplicationFactory.Create<VoloDocsMigratorModule>())
{
app.Initialize();
using (var dbContext = app.Resolve<VoloDocsDbContext>())
{
var connectionString = dbContext.Database.GetDbConnection().ConnectionString;
Console.Clear();
if (args != null && args.Contains("-script"))
{
GenerateMigrationScript(dbContext);
return;
}
RunMigrations(connectionString, dbContext);
}
Console.WriteLine("\n\nPress ENTER to exit...");
Console.ReadLine();
}
}
private static void RunMigrations(string connectionString, VoloDocsDbContext dbContext)
{
Console.Write("\nThis program updates an existing database or creates a new one if not exists.\n" +
"The following connection string will be used:\n\n" +
connectionString + "\n\n" +
"Are you sure you want to run the migration? (y/n) ");
if (Console.ReadKey().Key == ConsoleKey.Y)
{
Console.WriteLine("\n\nMigrating database...");
try
{
dbContext.Database.Migrate();
Console.WriteLine("Migration completed.");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
while (ex.InnerException != null)
{
ex = ex.InnerException;
Console.WriteLine(ex.Message);
}
Console.Write("\nThere was problem while applying migrations. " +
"Do you want to create the migration script? (y/n) ");
if (Console.ReadKey().Key == ConsoleKey.Y)
{
GenerateMigrationScript(dbContext);
}
}
}
}
private static void GenerateMigrationScript(VoloDocsDbContext dbContext)
{
if (File.Exists(ScriptFile))
{
File.Delete(ScriptFile);
}
Console.Write("\nGenerating migration scripts...");
File.WriteAllText(ScriptFile, dbContext.Database.GenerateCreateScript());
Console.Write("\nMigration script has been created to Script.txt file");
}
}
}

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Core\Volo.Abp.Core.csproj" />
<ProjectReference Include="..\VoloDocs.EntityFrameworkCore\VoloDocs.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Update="Migrate.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

@ -0,0 +1,29 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity;
using VoloDocs.EntityFrameworkCore;
namespace VoloDocs.Migrator
{
[DependsOn(typeof(VoloDocsEntityFrameworkCoreModule))]
public class VoloDocsMigratorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
context.Services.AddAbpDbContext<VoloDocsDbContext>();
Configure<DbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = configuration["ConnectionString"];
});
Configure<AbpDbContextOptions>(options =>
{
options.UseSqlServer();
});
}
}
}

@ -0,0 +1,3 @@
{
"ConnectionString": "Server=localhost;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@ -0,0 +1,29 @@
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Components;
using Volo.Abp.Configuration;
using Volo.Abp.DependencyInjection;
namespace Volo.Docs.Branding
{
[Dependency(ReplaceServices = true)]
public class VoloDocsBrandingProvider : DefaultBrandingProvider
{
public VoloDocsBrandingProvider(IConfigurationAccessor configurationAccessor)
{
var configuration = configurationAccessor.Configuration;
if (configuration["Title"] != null)
{
AppName = configuration["Title"];
}
if (configuration["LogoUrl"] != null)
{
LogoUrl = configuration["LogoUrl"];
}
}
public override string AppName { get; }
public override string LogoUrl { get; }
}
}

@ -1,6 +1,6 @@
using Volo.Abp.AspNetCore.Mvc;
namespace Volo.DocsTestApp.Controllers
namespace Volo.Docs.Controllers
{
public class HomeController : AbpController
{

@ -0,0 +1,9 @@
{
"culture": "en",
"texts": {
"WelcomeVoloDocs": "Welcome to the VoloDocs!",
"NoProjectWarning": "There`s no defined project yet!",
"CreateYourFirstProject": "Click here to start your first project",
"NoProject": "No project!"
}
}

@ -0,0 +1,9 @@
{
"culture": "tr",
"texts": {
"WelcomeVoloDocs": "VoloDocs Hoşgeldiniz!",
"NoProjectWarning": "Henüz bir proje yok!",
"CreateYourFirstProject": "İlk projenizi oluşturmak için tıklayın",
"NoProject": "Proje yok!"
}
}

@ -0,0 +1,11 @@
@page
@model VoloDocs.Web.Pages.ErrorModel
@{
<div class="text-center">
<pre>
@Model.ErrorMessage
</pre>
<a href="/" class="btn btn-outline-primary">Home Page</a>
</div>
}

@ -1,43 +1,52 @@
using System;
using System;
using System.Collections.Generic;
using System.Net;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Serilog;
using Volo.Abp.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace Volo.DocsTestApp.Controllers
namespace VoloDocs.Web.Pages
{
public class ErrorController : AbpController
public class ErrorModel : AbpPageModel
{
[Route("error/{statusCode}")]
[HttpGet]
public IActionResult Index(int statusCode = 0)
public string ErrorMessage { get; set; }
public ActionResult OnGet(string statusCode)
{
var statusFeature = HttpContext.Features.Get<IStatusCodeReExecuteFeature>();
if (statusFeature != null)
try
{
Log.Warning("Handled {0} error for URL: {1}", statusCode, statusFeature.OriginalPath);
}
if (!int.TryParse(statusCode, out var errorStatusCode))
{
errorStatusCode = (int)HttpStatusCode.BadRequest;
}
var statusFeature = HttpContext.Features.Get<IStatusCodeReExecuteFeature>();
if (statusFeature != null)
{
Logger.LogWarning("Handled {0} error for URL: {1}", statusCode, statusFeature.OriginalPath);
}
var isValidStatusCode = Enum.IsDefined(typeof(HttpStatusCode), errorStatusCode);
if (!isValidStatusCode)
{
errorStatusCode = (int)HttpStatusCode.BadRequest;
}
var isValidStatusCode = Enum.IsDefined(typeof(HttpStatusCode), statusCode);
if (!isValidStatusCode)
ErrorMessage = _errorMessages.ContainsKey(errorStatusCode)
? _errorMessages[errorStatusCode]
: "Looks like something went wrong!";
}
catch (Exception e)
{
statusCode = (int)HttpStatusCode.BadRequest;
Logger.LogError("Error on error page: " + e);
}
return new ContentResult
{
ContentType = System.Net.Mime.MediaTypeNames.Text.Html,
StatusCode = statusCode,
Content = string.Format(HtmlBody, _errorMessages.ContainsKey(statusCode)
? _errorMessages[statusCode]
: "Looks like something went wrong!")
};
return Page();
}
private const string HtmlBody = "<html><body><div style='text-align:center'><pre>{0}</pre><a href='/'>Go to home page</a></div></body></html>";
#region Error Messages
/*For more ASCII arts http://patorjk.com/software/taag/#p=display&h=0&f=Big&t=400*/
private readonly Dictionary<int, string> _errorMessages = new Dictionary<int, string>
{
@ -84,7 +93,7 @@ This is a forbidden area!"
| | | |_| | | |
|_| \___/ |_|
We can't find the page you're looking for..."
Hmm, we couldn't find the page you're looking for..."
},
{
500,
@ -123,5 +132,6 @@ Ooops! Our server is experiencing a mild case of the hiccups."
Looks like we're having some server issues."
}
};
#endregion
}
}
}

@ -0,0 +1,55 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Docs
@using Volo.Docs.Localization
@using Volo.Docs.Pages.Documents
@model VoloDocs.Web.Pages.IndexModel
@inject IHtmlLocalizer<DocsResource> L
@section styles {
<abp-style-bundle name="@typeof(IndexModel).FullName">
<abp-style src="/Pages/Documents/Shared/Styles/vs.css" />
<abp-style src="/assets/fa/css/font-awesome.min.css" />
</abp-style-bundle>
}
<div class="p-5">
<h1 class="text-center mb-5">
@L["WelcomeVoloDocs"]
</h1>
@if (!Model.Projects.Any())
{
<div class="d-flex justify-content-center">
<div class="alert alert-secondary col-md-6 text-center" role="alert">
<p>@L["NoProjectWarning"]</p>
<hr />
<a href="@Model.CreateProjectLink">@L["CreateYourFirstProject"] <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
}
else if (Model.Projects.Count > 1)
{
<h2>@L["Projects"]</h2>
<p>
<ul style="list-style-type: upper-roman;">
@foreach (var project in Model.Projects)
{
<li>
<h3>
<a asp-page="./Project/Index"
asp-route-projectName="@project.ShortName"
asp-route-version="@DocsAppConsts.Latest">
@project.Name
</a>
</h3>
</li>
}
</ul>
</p>
}
</div>

@ -0,0 +1,46 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Volo.Abp.Users;
using Volo.Docs;
using Volo.Docs.Projects;
namespace VoloDocs.Web.Pages
{
public class IndexModel : PageModel
{
public IReadOnlyList<ProjectDto> Projects { get; set; }
public string CreateProjectLink { get; set; }
private readonly IProjectAppService _projectAppService;
private readonly ICurrentUser _currentUser;
public IndexModel(IProjectAppService projectAppService, ICurrentUser currentUser)
{
_projectAppService = projectAppService;
_currentUser = currentUser;
}
public async Task<IActionResult> OnGet()
{
CreateProjectLink = _currentUser.Id.HasValue
? "/Docs/Admin/Projects"
: "/Account/Login?returnUrl=/Docs/Admin/Projects";
Projects = (await _projectAppService.GetListAsync()).Items;
if (Projects.Count == 1)
{
return RedirectToPage("./Documents/Project/Index", new
{
projectName = Projects[0].ShortName,
version = DocsAppConsts.Latest,
documentName = Projects[0].DefaultDocumentName
});
}
return Page();
}
}
}

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Hosting;
using Serilog;
using Serilog.Events;
namespace Volo.DocsTestApp
namespace Volo.Docs
{
public class Program
{

@ -15,7 +15,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.DocsTestApp": {
"VoloDocs": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {

@ -5,13 +5,13 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Volo.Abp;
namespace Volo.DocsTestApp
namespace Volo.Docs
{
public class Startup
{
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddApplication<DocsTestAppModule>(options =>
services.AddApplication<VoloDocsWebModule>(options =>
{
options.UseAutofac();
});

@ -0,0 +1,32 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Volo.Abp.AspNetCore.Uow;
namespace VoloDocs.Web.Utils
{
public class GlobalExceptionHandlerMiddleware
{
private readonly RequestDelegate _next;
private readonly ILogger<AbpUnitOfWorkMiddleware> _logger;
public GlobalExceptionHandlerMiddleware(RequestDelegate next, ILogger<AbpUnitOfWorkMiddleware> logger)
{
_logger = logger;
_next = next;
}
public async Task Invoke(HttpContext httpContext)
{
try
{
await _next(httpContext);
}
catch (Exception ex)
{
_logger.LogError("Handled a global exception: " + ex.Message, ex);
}
}
}
}

@ -2,11 +2,15 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Logs\**" />
<None Remove="Logs\**" />
<EmbeddedResource Include="Localization\Resources\VoloDocs\Web\en.json" />
<EmbeddedResource Include="Localization\Resources\VoloDocs\Web\tr.json" />
</ItemGroup>
<ItemGroup>
@ -23,12 +27,23 @@
<ProjectReference Include="..\..\src\Volo.Docs.Admin.Web\Volo.Docs.Admin.Web.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj" />
<ProjectReference Include="..\Volo.DocsTestApp.EntityFrameworkCore\Volo.DocsTestApp.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\VoloDocs.EntityFrameworkCore\VoloDocs.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Application\Volo.Abp.Identity.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Web\Volo.Abp.Identity.Web.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.PermissionManagement.Domain.Identity\Volo.Abp.PermissionManagement.Domain.Identity.csproj" />
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.Application\Volo.Abp.PermissionManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.Web\Volo.Abp.Account.Web.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Assets\Images\" />
<Folder Include="Logs\" />
</ItemGroup>
<ItemGroup>
<None Update="run.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

@ -1,16 +1,16 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
@ -21,24 +21,28 @@ using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity;
using Volo.Abp.Identity.Web;
using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.PermissionManagement.Identity;
using Volo.Abp.Threading;
using Volo.Abp.UI;
using Volo.Abp.VirtualFileSystem;
using Volo.Docs;
using Volo.Docs.Admin;
using Volo.DocsTestApp.EntityFrameworkCore;
using Volo.Docs.Localization;
using Volo.Docs.Utils;
using VoloDocs.EntityFrameworkCore;
using VoloDocs.Web.Utils;
namespace Volo.DocsTestApp
{
namespace Volo.Docs
{
[DependsOn(
typeof(DocsWebModule),
typeof(DocsAdminWebModule),
typeof(DocsApplicationModule),
typeof(DocsAdminApplicationModule),
typeof(DocsTestAppEntityFrameworkCoreModule),
typeof(VoloDocsEntityFrameworkCoreModule),
typeof(AbpAutofacModule),
typeof(AbpAccountWebModule),
typeof(AbpIdentityWebModule),
@ -47,8 +51,16 @@ namespace Volo.DocsTestApp
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule)
)]
public class DocsTestAppModule : AbpModule
public class VoloDocsWebModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options =>
{
options.AddAssemblyResource(typeof(DocsResource), typeof(VoloDocsWebModule).Assembly);
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
@ -56,8 +68,7 @@ namespace Volo.DocsTestApp
Configure<DbConnectionOptions>(options =>
{
const string connStringName = "SqlServer";
options.ConnectionStrings.Default = configuration.GetConnectionString(connStringName);
options.ConnectionStrings.Default = configuration["ConnectionString"];
});
Configure<AbpDbContextOptions>(options =>
@ -83,7 +94,11 @@ namespace Volo.DocsTestApp
context.Services.AddSwaggerGen(
options =>
{
options.SwaggerDoc("v1", new Info { Title = "Docs API", Version = "v1" });
options.SwaggerDoc("v1", new Info
{
Title = "Docs API",
Version = "v1"
});
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
});
@ -96,17 +111,35 @@ namespace Volo.DocsTestApp
options.SupportedUICultures = cultures;
});
Configure<VirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<VoloDocsWebModule>("VoloDocs.Web");
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Get<DocsResource>()
.AddBaseTypes(typeof(AbpValidationResource))
.AddBaseTypes(typeof(AbpUiModule))
.AddVirtualJson("/Localization/Resources/VoloDocs/Web");
});
Configure<ThemingOptions>(options =>
{
options.DefaultThemeName = BasicTheme.Name;
});
Configure<RazorPagesOptions>(options =>
{
options.Conventions.AddPageRoute("/Error", "error/{statusCode}");
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseDeveloperExceptionPage();
var env = context.GetEnvironment();
app.UseVirtualFiles();
@ -119,8 +152,9 @@ namespace Volo.DocsTestApp
app.UseAuthentication();
app.UseRequestLocalization(app.ApplicationServices.GetRequiredService<IOptions<RequestLocalizationOptions>>().Value);
app.UseStatusCodePagesWithReExecute("/error/{0}");
app.UseMiddleware<GlobalExceptionHandlerMiddleware>();
app.UseMvc(routes =>
{

@ -0,0 +1,5 @@
{
"ConnectionString": "Server=localhost;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true",
"Title": "Volo Documents",
"LogoUrl": "/Assets/Images/Logo.png"
}

@ -0,0 +1,11 @@
@echo off
dotnet clean
dotnet restore
dotnet build
DEL /F/Q/S "C:\Publishes\VoloDocs" > NUL && RMDIR /Q/S "C:\Publishes\VoloDocs"
dotnet publish -c Release -o "C:\Publishes\VoloDocs\Web"
cd..\VoloDocs.Migrator && dotnet publish -c Release -o "C:\Publishes\VoloDocs\Migrator"

@ -0,0 +1 @@
@dotnet VoloDocs.Web.dll

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save