diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000..2f9fb2a --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,144 @@ +# ServiceStack mix GitHub Actions +`release.yml` generated from `x mix release-ecr-aws`, this template in designed to help with automating CI deployments to AWS ECS and dedicated AWS ECS cluster. +This is a cheap way to start without an AWS Application Load Balancer (ALB) and also be in a situation that will easier to add one once the web service needs additional scale or high availability. + +## Overview +`release.yml` is designed to work with a ServiceStack app templates deploying directly to a single server in a dedicated ECS cluster via templated GitHub Actions. + +## Setup +### Create unique ECS cluster +For this setup, it is best to create a separate cluster as cluster will only have the single instance in it running. +This pattern is to start from a good base with AWS ECS and automated CI deployment while avoiding the higher costs of needing to run an application load balancer (ALB). + +If/when you can justify the cost of an ALB for easier scaling and zero downtime deployment, the GitHub Action `release.yml` can be slightly modified to be used with a re-created or different ECS Service that is configured to be used with an Application Load Balancer and Target Group. + +### Elastic IP (optional) +The reason you might want to register this first is because we are only running one EC2 instance and hosting our own `nginx-proxy` on the same instance as the applications. +Since an `A` record will be pointing there, one advantage of not using an auto-assigned IP is that we can reassign the elastic IP if for what ever reason the instance goes down or is lost. + +## Launch to EC2 Instance +When launching the EC2 instance, you'll need to select an 'ECS optimized' AMI as the image used for your instance. +### Choose AMI +The easiest way to find the latest Amazon Linux 2 image for this is to go to the [AWS documentation for ECS-optimized AMIs and look up your region here](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html#ecs-optimized-ami-linux). + +Using the AMI ID (starts with `ami-`) at the bottom, search in the 'Community AMIs' tab on the first step of the `Launch EC2 Instance` wizard. + +### Choose Instance Type +A t2.micro or larger will work fine, this pattern can be used to host multiple applications on the 1 server so if the number of applications gets larger, you might need a larger instance type. +> Note this pattern is suitable for testing prototypes or low traffic applications as it is cost effective and makes it easy to bundle multiple apps onto 1 EC2 instance. + +### Configure Instance +Under `IAM role`, use the `ecsInstanceRole`, if this is not available, see [AWS documentation for the process of checking if it exists and creating it if needed](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html). + +You will also want to add the following Userdata script (in the `Configure` step of the launch wizard) with your own `ECS_CLUSTER` value. This tells the ecs-agent running on the instance which ECS cluster the instance should join. + +```bash +#!/bin/bash +cat </etc/ecs/ecs.config +ECS_CLUSTER=stack-apiss +ECS_AVAILABLE_LOGGING_DRIVERS=["awslogs", "syslog"] +ECS_ENABLE_CONTAINER_METADATA=true +EOS +``` + +Note down your cluster name as it will need to be used to create the cluster in ECS before it is visible. +See [`ECS Container Agent Configuration`](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html) for more information. + +### Add Storage +The default of 30gb is fine but take into account how large/how many applications you'll have running. + +### Configure Security Groups +You'll want to expose at least ports 80 and 443. + +### Setup Docker-compose and nginx-proxy +To let your server handle multiple ServiceStack applications and automate the generation and management of TLS certificates, an additional docker-compose file is provided via the `x mix` template, `nginx-proxy-compose.yml`. This docker-compose file is ready to run and can be copied to the deployment server. +> This is done via docker-compose rather than via ECS for simplicity. + +For example, once copied to remote `~/nginx-proxy-compose.yml`, the following command can be run on the remote server. + +``` +docker-compose -f ~/nginx-proxy-compose.yml up -d +``` + +This will run an nginx reverse proxy along with a companion container that will watch for additional containers in the same docker network and attempt to initialize them with valid TLS certificates. + +## GitHub Repository setup +The `release.yml` assumes 6 secrets have been setup. + +- AWS_ACCESS_KEY_ID - AWS access key for programmatic access to AWS APIs. +- AWS_SECRET_ACCESS_KEY - AWS access secrets for programmatic access to AWS APIs. +- AWS_REGION - default region for AWS API calls. +- AWS_ECS_CLUSTER - Cluster name in ECS, this should match the value in your Userdata. +- HOST_DOMAIN - Domain/submain of your application, eg `stack-apis.example.com` . +- LETSENCRYPT_EMAIL - Email address, required for Let's Encrypt automated TLS certificates. + +These secrets are used to populate variables within GitHub Actions and other configuration files. + +For the AWS access, a separate user specifically for deploying via GitHub Actions should be used. + +The policies required for the complete initial setup will be: +- `AmazonEC2ContainerRegistryFullAccess` +- `AmazonECS_FullAccess` + +Once the application is successfully deployed the first time, reduced access for both ECR and ECS can be used instead. For application updates, the GitHub Action can use the following policy. + +```json +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "VisualEditor0", + "Effect": "Allow", + "Action": [ + "ecr:GetRegistryPolicy", + "ecr:PutImageTagMutability", + "ecr:GetDownloadUrlForLayer", + "ecr:DescribeRegistry", + "ecr:GetAuthorizationToken", + "ecr:ListTagsForResource", + "ecr:UploadLayerPart", + "ecr:ListImages", + "ecr:PutImage", + "ecr:UntagResource", + "ecr:BatchGetImage", + "ecr:CompleteLayerUpload", + "ecr:DescribeImages", + "ecr:TagResource", + "ecr:DescribeRepositories", + "ecr:InitiateLayerUpload", + "ecr:BatchCheckLayerAvailability", + "ecr:ReplicateImage", + "ecr:GetRepositoryPolicy", + "ecs:SubmitTaskStateChange", + "ecs:UpdateContainerInstancesState", + "ecs:RegisterContainerInstance", + "ecs:DescribeTaskDefinition", + "ecs:DescribeClusters", + "ecs:ListServices", + "ecs:UpdateService", + "ecs:ListTasks", + "ecs:ListTaskDefinitionFamilies", + "ecs:RegisterTaskDefinition", + "ecs:SubmitContainerStateChange", + "ecs:StopTask", + "ecs:DescribeServices", + "ecs:ListContainerInstances", + "ecs:DescribeContainerInstances", + "ecs:DeregisterContainerInstance", + "ecs:TagResource", + "ecs:DescribeTasks", + "ecs:UntagResource", + "ecs:ListTaskDefinitions", + "ecs:ListClusters" + ], + "Resource": "*" + } + ] +} +``` +> Further permission reduction can be done by reducing what resources can be accessed. +> Application permissions can be controlled via `taskRoleArn`, see [AWS docs for details](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html). + +## What's the process of the `release.yml`? + +![](https://raw.githubusercontent.com/ServiceStack/docs/master/docs/images/mix/release-ecr-aws-diagram.png) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..99657c9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: Build + +on: + pull_request: {} + push: + branches: + - '**' # matches every branch + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: checkout + uses: actions/checkout@v2.0.0 + + - name: setup .net core + uses: actions/setup-dotnet@v1.7.2 + with: + dotnet-version: 5.0.100 + + - name: build + run: dotnet build + working-directory: ./src + + - name: test + run: | + dotnet test + if [ $? -eq 0 ]; then + echo TESTS PASSED + else + echo TESTS FAILED + exit 1 + fi + working-directory: ./src/StackApis.Tests + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8bf8c5f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,94 @@ +name: Release +on: + release: + types: [published] +jobs: + push_to_ecr: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: repository name fix + run: echo "image_repository_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Login to Amazon ECR + id: login_ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Create ECR repo if not exists. + env: + ECR_REPOSITORY: ${{ env.image_repository_name }} + run: aws ecr describe-repositories --repository-names ${ECR_REPOSITORY} || aws ecr create-repository --repository-name ${ECR_REPOSITORY} + + - name: Build and push to ECR + id: push_image_to_ecr + uses: docker/build-push-action@v2.2.2 + with: + file: Dockerfile + context: . + push: true + tags: ${{ steps.login_ecr.outputs.registry }}/${{ env.image_repository_name }}:${{ github.event.release.tag_name }} + + deploy_ecs: + needs: push_to_ecr + runs-on: ubuntu-20.04 + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Login to Amazon ECR + id: login_ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Repository name fix and env values setup + run: | + echo "image_repository_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + echo "domain=${{ secrets.HOST_DOMAIN }}" >> $GITHUB_ENV + echo "letsencrypt_email=${{ secrets.LETSENCRYPT_EMAIL }}" >> $GITHUB_ENV + echo "app_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]' | cut -d'/' -f2)" >> $GITHUB_ENV + echo "cluster_name=${{ secrets.AWS_ECS_CLUSTER }}" >> $GITHUB_ENV + echo "image_url=${{ steps.login_ecr.outputs.registry }}/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ github.event.release.tag_name }}" >> $GITHUB_ENV + echo "aws_region=${{ secrets.AWS_REGION }}" >> $GITHUB_ENV + + - name: Populate task definition template + uses: danielr1996/envsubst-action@1.0.0 + env: + RELEASE_VERSION: ${{ github.event.release.tag_name }} + APP_NAME: ${{ env.app_name }} + IMAGE_URL: ${{ env.image_url }} + HOST_DOMAIN: ${{ env.domain }} + LETSENCRYPT_EMAIL: ${{ env.letsencrypt_email }} + AWS_REGION: ${{ env.aws_region }} + CLUSTER_NAME: ${{ env.cluster_name }} + with: + input: deploy/task-definition-template.json + output: deploy/task-definition.json + + - name: Create task definition if doesn't exist + run: aws ecs describe-task-definition --task-definition ${{ env.app_name }} || aws ecs register-task-definition --cli-input-json file://deploy/task-definition.json + + - name: Create ECS Service if not exists. + run: aws ecs describe-services --cluster ${{ env.cluster_name }} --services ${{ env.app_name }} | jq '.services[0]' -e || aws ecs create-service --cluster ${{ env.cluster_name }} --service-name ${{ env.app_name }} --task-definition ${{ env.app_name }} --desired-count 1 + + - name: Deploy new revision of the task definition + uses: aws-actions/amazon-ecs-deploy-task-definition@v1 + with: + task-definition: deploy/task-definition.json + service: ${{ env.app_name }} + cluster: ${{ env.cluster_name }} + force-new-deployment: true diff --git a/.gitignore b/.gitignore index aa60b74..a8fa6e0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,24 +4,34 @@ # User-specific files *.suo *.user +*.userosscache *.sln.docstates -.vs/ + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs # Build results [Dd]ebug/ [Dd]ebugPublic/ [Rr]elease/ +[Rr]eleases/ x64/ -build/ +x86/ bld/ [Bb]in/ [Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* -#NUNIT +# NUNIT *.VisualState.xml TestResult.xml @@ -30,6 +40,12 @@ TestResult.xml [Rr]eleasePS/ dlldata.c +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ +*.lock.json + *_i.c *_p.c *_i.h @@ -62,14 +78,18 @@ _Chutzpah* ipch/ *.aps *.ncb +*.opendb *.opensdf *.sdf *.cachefile +*.VC.db +*.VC.VC.opendb # Visual Studio profiler *.psess *.vsp *.vspx +*.sap # TFS 2012 Local Workspace $tf/ @@ -82,7 +102,7 @@ _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user -# JustCode is a .NET coding addin-in +# JustCode is a .NET coding add-in .JustCode # TeamCity is a build add-in @@ -91,10 +111,14 @@ _TeamCity* # DotCover is a Code Coverage Tool *.dotCover +# Visual Studio code coverage results +*.coverage +*.coveragexml + # NCrunch -*.ncrunch* _NCrunch_* .*crunch*.local.xml +nCrunchTemp_* # MightyMoose *.mm.* @@ -122,41 +146,70 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml - -# NuGet Packages Directory -packages/ -## TODO: If the tool you use requires repositories.config uncomment the next line -#!packages/repositories.config - -# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets -# This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented) -!packages/build/ - -# Windows Azure Build Output +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output csx/ *.build.csdef -# Windows Store app package directory +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ # Others -sql/ -*.Cache ClientBin/ -[Ss]tyle[Cc]op.* ~$* *~ *.dbmdl *.dbproj.schemaview +*.jfm *.pfx *.publishsettings node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ # RIA/Silverlight projects Generated_Code/ -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML @@ -173,3 +226,44 @@ UpgradeLog*.htm # Microsoft Fakes FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..d203e18 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,46 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (web)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/src/StackApis/bin/Debug/netcoreapp1.1/StackApis.dll", + "args": [], + "cwd": "${workspaceFolder}/src/StackApis", + "stopAtEntry": false, + "internalConsoleOptions": "openOnSessionStart", + "launchBrowser": { + "enabled": true, + "args": "${auto-detect-url}", + "windows": { + "command": "cmd.exe", + "args": "/C start ${auto-detect-url}" + }, + "osx": { + "command": "open" + }, + "linux": { + "command": "xdg-open" + } + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "sourceFileMap": { + "/Views": "${workspaceFolder}/Views" + } + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..64e7f88 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,15 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "taskName": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/src/StackApis/StackApis.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6f39989 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /source + +COPY . . +RUN dotnet restore ./src/ + +WORKDIR /source/src +RUN dotnet publish -c release -o /app --no-restore + +FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime +WORKDIR /app +COPY --from=build /app ./ +ENTRYPOINT ["dotnet", "StackApis.dll"] diff --git a/README.md b/README.md index de87479..5ef7edf 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -StackApis +StackApis [![Build Status](https://travis-ci.org/NetCoreApps/StackApis.svg?branch=master)](https://travis-ci.org/NetCoreApps/StackApis) ========= [![StackApis Home](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/apps/StackApis/stackapis-home.png)](http://stackapis.servicestack.net/) -[StackApis](http://stackapis.servicestack.net/) is a simple new ServiceStack + AngularJS example project created with [ServiceStackVS AngularJS Template](https://github.com/ServiceStack/ServiceStackVS#servicestackvs) showcasing how quick and easy it is to create responsive feature-rich Single Page Apps with AngularJS and [AutoQuery](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query). StackApis is powered by a Sqlite database containing [snapshot of ServiceStack questions from StackOverflow APIs](https://github.com/ServiceStackApps/StackApis/blob/master/src/StackApis.Tests/UnitTests.cs#L67) that's [persisted in an sqlite database using OrmLite](https://github.com/ServiceStackApps/StackApis/blob/master/src/StackApis.Tests/UnitTests.cs#L119-L124). +[StackApis](http://stackapis.servicestack.net/) is a simple new ServiceStack + AngularJS example project created with [ServiceStackVS AngularJS Template](https://github.com/ServiceStack/ServiceStackVS#servicestackvs) showcasing how quick and easy it is to create responsive feature-rich Single Page Apps with AngularJS and [AutoQuery](https://docs.servicestack.net/autoquery). StackApis is powered by a Sqlite database containing [snapshot of ServiceStack questions from StackOverflow APIs](https://github.com/ServiceStackApps/StackApis/blob/master/src/StackApis.Tests/UnitTests.cs#L67) that's [persisted in an sqlite database using OrmLite](https://github.com/ServiceStackApps/StackApis/blob/master/src/StackApis.Tests/UnitTests.cs#L119-L124). ### StackApis AutoQuery Service -The [Home Page](https://github.com/ServiceStackApps/StackApis/blob/master/src/StackApis/default.cshtml) is built with less than **<50 Lines** of JavaScript which thanks to [AutoQuery](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query) routes all requests to the single AutoQuery Service below: +The [Home Page](https://github.com/ServiceStackApps/StackApis/blob/master/src/StackApis/default.cshtml) is built with less than **<50 Lines** of JavaScript which thanks to [AutoQuery](https://docs.servicestack.net/autoquery) routes all requests to the single AutoQuery Service below: ```csharp [Route("/questions")] @@ -17,8 +17,8 @@ public class StackOverflowQuery : QueryBase } ``` -> Not even `ScoreGreaterThan` is a required property, it's just an example of a [formalized convention](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query#advantages-of-well-defined-service-contracts) enabling queries from Typed Service Clients. +> Not even `ScoreGreaterThan` is a required property, it's just an example of a [formalized convention](https://docs.servicestack.net/autoquery-rdbms#advantages-of-well-defined-service-contracts) enabling queries from Typed Service Clients. Feel free to play around with a deployed version of StackApis at [stackapis.servicestack.net](http://stackapis.servicestack.net/). -You can also use the public `http://stackapis.servicestack.net/` url to test out ServiceStack's new **Add ServiceStack Reference** feature :) +You can also use the public `https://stackapis.netcore.io/` url to test out ServiceStack's new **Add ServiceStack Reference** feature :) diff --git a/deploy/nginx-proxy-compose.yml b/deploy/nginx-proxy-compose.yml new file mode 100644 index 0000000..11ba1a9 --- /dev/null +++ b/deploy/nginx-proxy-compose.yml @@ -0,0 +1,45 @@ +version: '2' + +services: + nginx-proxy: + image: jwilder/nginx-proxy + container_name: nginx-proxy + restart: always + ports: + - "80:80" + - "443:443" + volumes: + - conf:/etc/nginx/conf.d + - vhost:/etc/nginx/vhost.d + - html:/usr/share/nginx/html + - dhparam:/etc/nginx/dhparam + - certs:/etc/nginx/certs:ro + - /var/run/docker.sock:/tmp/docker.sock:ro + network_mode: bridge + + letsencrypt: + image: jrcs/letsencrypt-nginx-proxy-companion + container_name: nginx-proxy-le + restart: always + environment: + - DEFAULT_EMAIL=you@example.com + volumes_from: + - nginx-proxy + volumes: + - certs:/etc/nginx/certs:rw + - acme:/etc/acme.sh + - /var/run/docker.sock:/var/run/docker.sock:ro + network_mode: bridge + +volumes: + conf: + vhost: + html: + dhparam: + certs: + acme: + +networks: + default: + external: + name: webproxy \ No newline at end of file diff --git a/deploy/task-definition-template.json b/deploy/task-definition-template.json new file mode 100644 index 0000000..32a6f48 --- /dev/null +++ b/deploy/task-definition-template.json @@ -0,0 +1,49 @@ +{ + "family": "${APP_NAME}", + "requiresCompatibilities": [ + "EC2" + ], + "networkMode": "bridge", + "containerDefinitions": [ + { + "portMappings": [ + { + "protocol": "tcp", + "containerPort": 80 + } + ], + "environment": [ + { + "name": "VIRTUAL_HOST", + "value": "${HOST_DOMAIN}" + }, + { + "name": "LETSENCRYPT_HOST", + "value": "${HOST_DOMAIN}" + }, + { + "name": "LETSENCRYPT_EMAIL", + "value": "${LETSENCRYPT_EMAIL}" + }, + { + "name": "APP_VERSION", + "value": "${RELEASE_VERSION}" + } + ], + "mountPoints": [], + "memoryReservation": 128, + "volumesFrom": [], + "image": "${IMAGE_URL}", + "essential": true, + "name": "${APP_NAME}", + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "${CLUSTER_NAME}-${APP_NAME}", + "awslogs-region": "${AWS_REGION}", + "awslogs-create-group": "true" + } + } + } + ] +} diff --git a/src/.vs/config/applicationhost.config b/src/.vs/config/applicationhost.config index cb87481..9dbdae2 100644 --- a/src/.vs/config/applicationhost.config +++ b/src/.vs/config/applicationhost.config @@ -1,4 +1,4 @@ - + - - - - - -
-
-
-
-
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
- -
-
- -
-
-
- - -
-
-
-
-
-
- -
-
+ + +
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/StackApis.ServiceInterface/Properties/AssemblyInfo.cs b/src/StackApis.ServiceInterface/Properties/AssemblyInfo.cs index 9ac8d1c..ef957ce 100644 --- a/src/StackApis.ServiceInterface/Properties/AssemblyInfo.cs +++ b/src/StackApis.ServiceInterface/Properties/AssemblyInfo.cs @@ -2,35 +2,18 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("StackAPI.Questions.ServiceInterface")] -[assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("StackAPI.Questions.ServiceInterface")] -[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyProduct("StackApis.ServiceInterface")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a3df7e56-770c-4ae0-aa21-1f7f11b69cd6")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("f5383b6c-a46a-4ddb-9b64-6e2c6bb270e2")] diff --git a/src/StackApis.ServiceInterface/StackApis.ServiceInterface.csproj b/src/StackApis.ServiceInterface/StackApis.ServiceInterface.csproj old mode 100644 new mode 100755 index 4ec54c4..e98abd0 --- a/src/StackApis.ServiceInterface/StackApis.ServiceInterface.csproj +++ b/src/StackApis.ServiceInterface/StackApis.ServiceInterface.csproj @@ -1,121 +1,25 @@ - - - + + - Debug - AnyCPU - {582DFB0F-F84D-4E43-9BCA-2A5A86600B7A} - Library - Properties - StackApis.ServiceInterface + netstandard2.0 StackApis.ServiceInterface - v4.5 - 512 - true + StackApis.ServiceInterface + false + false + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\ServiceStack.OrmLite.Sqlite.Mono.4.5.0\lib\net45\Mono.Data.Sqlite.dll - True - - - ..\packages\ServiceStack.4.5.0\lib\net45\ServiceStack.dll - True - - - ..\packages\ServiceStack.Api.Swagger.4.5.0\lib\net45\ServiceStack.Api.Swagger.dll - True - - - ..\packages\ServiceStack.Client.4.5.0\lib\net45\ServiceStack.Client.dll - True - - - ..\packages\ServiceStack.Common.4.5.0\lib\net45\ServiceStack.Common.dll - True - - - ..\packages\ServiceStack.Interfaces.4.5.0\lib\portable-wp80+sl5+net45+win8+wpa81+monotouch+monoandroid+xamarin.ios10\ServiceStack.Interfaces.dll - True - - - ..\packages\ServiceStack.OrmLite.4.5.0\lib\net45\ServiceStack.OrmLite.dll - True - - - ..\packages\ServiceStack.OrmLite.Sqlite.Mono.4.5.0\lib\net45\ServiceStack.OrmLite.Sqlite.dll - True - - - ..\packages\ServiceStack.Razor.4.5.0\lib\net45\ServiceStack.Razor.dll - True - - - ..\packages\ServiceStack.Redis.4.5.0\lib\net45\ServiceStack.Redis.dll - True - - - ..\packages\ServiceStack.Server.4.5.0\lib\net45\ServiceStack.Server.dll - True - - - ..\packages\ServiceStack.Text.4.5.0\lib\net45\ServiceStack.Text.dll - True - - - - - ..\packages\ServiceStack.Razor.4.5.0\lib\net45\System.Web.Razor.dll - True - - - - - - - - - - - - - - {08bef328-ab7d-48d3-800d-48acc75c7914} - StackApis.ServiceModel - - + - + + - - PreserveNewest - + + + + + + - - - - \ No newline at end of file + + diff --git a/src/StackApis.ServiceInterface/packages.config b/src/StackApis.ServiceInterface/packages.config deleted file mode 100644 index f73100b..0000000 --- a/src/StackApis.ServiceInterface/packages.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/StackApis.ServiceInterface/sqlite3.dll b/src/StackApis.ServiceInterface/sqlite3.dll deleted file mode 100644 index 1058a2b..0000000 Binary files a/src/StackApis.ServiceInterface/sqlite3.dll and /dev/null differ diff --git a/src/StackApis.ServiceModel/Properties/AssemblyInfo.cs b/src/StackApis.ServiceModel/Properties/AssemblyInfo.cs index 4171a91..05b9ec2 100644 --- a/src/StackApis.ServiceModel/Properties/AssemblyInfo.cs +++ b/src/StackApis.ServiceModel/Properties/AssemblyInfo.cs @@ -2,35 +2,18 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("StackAPI.Questions.ServiceModel")] -[assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("StackAPI.Questions.ServiceModel")] -[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyProduct("StackApis.ServiceModel")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("885f607b-ae42-4671-b569-c9eaa5188c17")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("720ed405-a0a3-4fb7-9081-9e4a31ee658f")] diff --git a/src/StackApis.ServiceModel/StackApis.ServiceModel.csproj b/src/StackApis.ServiceModel/StackApis.ServiceModel.csproj old mode 100644 new mode 100755 index 68221b9..138ce59 --- a/src/StackApis.ServiceModel/StackApis.ServiceModel.csproj +++ b/src/StackApis.ServiceModel/StackApis.ServiceModel.csproj @@ -1,120 +1,16 @@ - - - + + - Debug - AnyCPU - {08BEF328-AB7D-48D3-800D-48ACC75C7914} - Library - Properties - StackApis.ServiceModel + netstandard2.0 StackApis.ServiceModel - v4.5 - 512 - ..\..\ - true + StackApis.ServiceModel + false + false + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\ServiceStack.OrmLite.Sqlite.Mono.4.5.0\lib\net45\Mono.Data.Sqlite.dll - True - - - ..\packages\ServiceStack.4.5.0\lib\net45\ServiceStack.dll - True - - - ..\packages\ServiceStack.Api.Swagger.4.5.0\lib\net45\ServiceStack.Api.Swagger.dll - True - - - ..\packages\ServiceStack.Client.4.5.0\lib\net45\ServiceStack.Client.dll - True - - - ..\packages\ServiceStack.Common.4.5.0\lib\net45\ServiceStack.Common.dll - True - - - ..\packages\ServiceStack.Interfaces.4.5.0\lib\portable-wp80+sl5+net45+win8+wpa81+monotouch+monoandroid+xamarin.ios10\ServiceStack.Interfaces.dll - True - - - ..\packages\ServiceStack.OrmLite.4.5.0\lib\net45\ServiceStack.OrmLite.dll - True - - - ..\packages\ServiceStack.OrmLite.Sqlite.Mono.4.5.0\lib\net45\ServiceStack.OrmLite.Sqlite.dll - True - - - ..\packages\ServiceStack.Razor.4.5.0\lib\net45\ServiceStack.Razor.dll - True - - - ..\packages\ServiceStack.Redis.4.5.0\lib\net45\ServiceStack.Redis.dll - True - - - ..\packages\ServiceStack.Server.4.5.0\lib\net45\ServiceStack.Server.dll - True - - - ..\packages\ServiceStack.Text.4.5.0\lib\net45\ServiceStack.Text.dll - True - - - - - ..\packages\ServiceStack.Razor.4.5.0\lib\net45\System.Web.Razor.dll - True - - - - - - - - - - - - - - - - - - + - - PreserveNewest - + - - - - \ No newline at end of file + + diff --git a/src/StackApis.ServiceModel/sqlite3.dll b/src/StackApis.ServiceModel/sqlite3.dll deleted file mode 100644 index 1058a2b..0000000 Binary files a/src/StackApis.ServiceModel/sqlite3.dll and /dev/null differ diff --git a/src/StackApis.Tests/App_Data/db.sqlite b/src/StackApis.Tests/App_Data/db.sqlite index c5952f5..f53c009 100644 Binary files a/src/StackApis.Tests/App_Data/db.sqlite and b/src/StackApis.Tests/App_Data/db.sqlite differ diff --git a/src/StackApis.Tests/Properties/AssemblyInfo.cs b/src/StackApis.Tests/Properties/AssemblyInfo.cs index 1d23e0f..0731d93 100644 --- a/src/StackApis.Tests/Properties/AssemblyInfo.cs +++ b/src/StackApis.Tests/Properties/AssemblyInfo.cs @@ -2,35 +2,18 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("StackAPI.Questions.Tests")] -[assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("StackAPI.Questions.Tests")] -[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyProduct("StackApis.Tests")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2991ae08-aa90-4568-9483-f62cf9023dde")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("bb4752a7-9031-452b-b26a-05dc44d0d6d3")] diff --git a/src/StackApis.Tests/StackApis.Tests.csproj b/src/StackApis.Tests/StackApis.Tests.csproj old mode 100644 new mode 100755 index f9b94f5..bb4698e --- a/src/StackApis.Tests/StackApis.Tests.csproj +++ b/src/StackApis.Tests/StackApis.Tests.csproj @@ -1,130 +1,31 @@ - - + + - Debug - AnyCPU - {B1665387-EF91-4CA0-82BB-66E5781ED800} - Library - Properties - StackApis.Tests + netcoreapp2.0 StackApis.Tests - v4.5 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest + StackApis.Tests + false + false + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - x86 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\ServiceStack.OrmLite.Sqlite.Mono.4.5.0\lib\net45\Mono.Data.Sqlite.dll - True - - - ..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll - True - - - ..\packages\ServiceStack.4.5.0\lib\net45\ServiceStack.dll - True - - - ..\packages\ServiceStack.Api.Swagger.4.5.0\lib\net45\ServiceStack.Api.Swagger.dll - True - - - ..\packages\ServiceStack.Client.4.5.0\lib\net45\ServiceStack.Client.dll - True - - - ..\packages\ServiceStack.Common.4.5.0\lib\net45\ServiceStack.Common.dll - True - - - ..\packages\ServiceStack.Interfaces.4.5.0\lib\portable-wp80+sl5+net45+win8+wpa81+monotouch+monoandroid+xamarin.ios10\ServiceStack.Interfaces.dll - True - - - ..\packages\ServiceStack.OrmLite.4.5.0\lib\net45\ServiceStack.OrmLite.dll - True - - - ..\packages\ServiceStack.OrmLite.Sqlite.Mono.4.5.0\lib\net45\ServiceStack.OrmLite.Sqlite.dll - True - - - ..\packages\ServiceStack.Razor.4.5.0\lib\net45\ServiceStack.Razor.dll - True - - - ..\packages\ServiceStack.Redis.4.5.0\lib\net45\ServiceStack.Redis.dll - True - - - ..\packages\ServiceStack.Server.4.5.0\lib\net45\ServiceStack.Server.dll - True - - - ..\packages\ServiceStack.Text.4.5.0\lib\net45\ServiceStack.Text.dll - True - - - - - ..\packages\ServiceStack.Razor.4.5.0\lib\net45\System.Web.Razor.dll - True - - - - - - - - - - + - - {582dfb0f-f84d-4e43-9bca-2a5a86600b7a} - StackApis.ServiceInterface - - - {08bef328-ab7d-48d3-800d-48acc75c7914} - StackApis.ServiceModel - + + + - - PreserveNewest - + + + + + + + + + + + - - - - \ No newline at end of file + + diff --git a/src/StackApis.Tests/StackOverflowTasks.cs b/src/StackApis.Tests/StackOverflowTasks.cs index 142cea5..8c1ad1e 100644 --- a/src/StackApis.Tests/StackOverflowTasks.cs +++ b/src/StackApis.Tests/StackOverflowTasks.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading; using NUnit.Framework; @@ -20,15 +21,18 @@ public class StackOverflowTasks [OneTimeSetUp] public void OneTimeSetUp() { - dbFactory = new OrmLiteConnectionFactory( - "~/../../../StackApis/App_Data/db.sqlite".MapServerPath(), SqliteDialect.Provider); + var dbPath = "~/App_Data/db.sqlite".MapProjectPath(); + if (File.Exists(dbPath)) + { + File.Delete(dbPath); + } + dbFactory = new OrmLiteConnectionFactory(dbPath, SqliteDialect.Provider); } [Test] public void Import_from_StackOverflow() { - var client = new JsonServiceClient(); - int numberOfPages = 10; + int numberOfPages = 100; int pageSize = 100; var dbQuestions = new List(); var dbAnswers = new List(); @@ -38,13 +42,13 @@ public void Import_from_StackOverflow() { //Throttle queries Thread.Sleep(100); - var questionsResponse = client.Get("https://api.stackexchange.com/2.2/questions?page={0}&pagesize={1}&site={2}&tagged=servicestack" - .Fmt(i, pageSize, "stackoverflow")); + //StackOverflow API always returns gzipped response and .NET Core HttpWebRequest doesn't support auto uncompressing yet so need to decompress manually + var bytes = $"https://api.stackexchange.com/2.2/questions?page={i}&pagesize={pageSize}&site=stackoverflow&tagged=servicestack".GetBytesFromUrl(); + var json = bytes.GUnzip(); QuestionsResponse qResponse; using (new ConfigScope()) { - var json = questionsResponse.ReadToEnd(); qResponse = json.FromJson(); dbQuestions.AddRange(qResponse.Items.Select(q => q.ConvertTo())); } @@ -54,12 +58,12 @@ public void Import_from_StackOverflow() .Where(x => x.AcceptedAnswerId != null) .Select(x => x.AcceptedAnswerId).ToList(); - var answersResponse = client.Get("https://api.stackexchange.com/2.2/answers/{0}?sort=activity&site=stackoverflow" - .Fmt(acceptedAnswers.Join(";"))); + var answersList = acceptedAnswers.Join(";"); + bytes = $"https://api.stackexchange.com/2.2/answers/{answersList}?sort=activity&site=stackoverflow".GetBytesFromUrl(); + json = bytes.GUnzip(); using (new ConfigScope()) { - var json = answersResponse.ReadToEnd(); var aResponse = JsonSerializer.DeserializeFromString(json); dbAnswers.AddRange(aResponse.Items.Select(a => a.ConvertTo())); } diff --git a/src/StackApis.Tests/app.config b/src/StackApis.Tests/app.config deleted file mode 100644 index d16e134..0000000 --- a/src/StackApis.Tests/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/StackApis.Tests/packages.config b/src/StackApis.Tests/packages.config deleted file mode 100644 index 5dddcf6..0000000 --- a/src/StackApis.Tests/packages.config +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/StackApis.Tests/sqlite3.dll b/src/StackApis.Tests/sqlite3.dll deleted file mode 100644 index 1058a2b..0000000 Binary files a/src/StackApis.Tests/sqlite3.dll and /dev/null differ diff --git a/src/StackApis.sln b/src/StackApis.sln index 6186b68..30e6c5f 100644 --- a/src/StackApis.sln +++ b/src/StackApis.sln @@ -1,13 +1,15 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackApis", "StackApis\StackApis.csproj", "{6F86FC59-9DE7-4BF5-8D11-CB7E99DA29FC}" +# Visual Studio 15 +VisualStudioVersion = 15.0.26114.2 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackApis", "StackApis\StackApis.csproj", "{9E85D153-5880-4F9B-AA7A-783B8653F9F5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackApis.ServiceInterface", "StackApis.ServiceInterface\StackApis.ServiceInterface.csproj", "{582DFB0F-F84D-4E43-9BCA-2A5A86600B7A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackApis.ServiceInterface", "StackApis.ServiceInterface\StackApis.ServiceInterface.csproj", "{F5383B6C-A46A-4DDB-9B64-6E2C6BB270E2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackApis.ServiceModel", "StackApis.ServiceModel\StackApis.ServiceModel.csproj", "{08BEF328-AB7D-48D3-800D-48ACC75C7914}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackApis.ServiceModel", "StackApis.ServiceModel\StackApis.ServiceModel.csproj", "{720ED405-A0A3-4FB7-9081-9E4A31EE658F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackApis.Tests", "StackApis.Tests\StackApis.Tests.csproj", "{B1665387-EF91-4CA0-82BB-66E5781ED800}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackApis.Tests", "StackApis.Tests\StackApis.Tests.csproj", "{BB4752A7-9031-452B-B26A-05DC44D0D6D3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,22 +17,22 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6F86FC59-9DE7-4BF5-8D11-CB7E99DA29FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6F86FC59-9DE7-4BF5-8D11-CB7E99DA29FC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6F86FC59-9DE7-4BF5-8D11-CB7E99DA29FC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6F86FC59-9DE7-4BF5-8D11-CB7E99DA29FC}.Release|Any CPU.Build.0 = Release|Any CPU - {582DFB0F-F84D-4E43-9BCA-2A5A86600B7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {582DFB0F-F84D-4E43-9BCA-2A5A86600B7A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {582DFB0F-F84D-4E43-9BCA-2A5A86600B7A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {582DFB0F-F84D-4E43-9BCA-2A5A86600B7A}.Release|Any CPU.Build.0 = Release|Any CPU - {08BEF328-AB7D-48D3-800D-48ACC75C7914}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {08BEF328-AB7D-48D3-800D-48ACC75C7914}.Debug|Any CPU.Build.0 = Debug|Any CPU - {08BEF328-AB7D-48D3-800D-48ACC75C7914}.Release|Any CPU.ActiveCfg = Release|Any CPU - {08BEF328-AB7D-48D3-800D-48ACC75C7914}.Release|Any CPU.Build.0 = Release|Any CPU - {B1665387-EF91-4CA0-82BB-66E5781ED800}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B1665387-EF91-4CA0-82BB-66E5781ED800}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B1665387-EF91-4CA0-82BB-66E5781ED800}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B1665387-EF91-4CA0-82BB-66E5781ED800}.Release|Any CPU.Build.0 = Release|Any CPU + {9E85D153-5880-4F9B-AA7A-783B8653F9F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9E85D153-5880-4F9B-AA7A-783B8653F9F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E85D153-5880-4F9B-AA7A-783B8653F9F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9E85D153-5880-4F9B-AA7A-783B8653F9F5}.Release|Any CPU.Build.0 = Release|Any CPU + {F5383B6C-A46A-4DDB-9B64-6E2C6BB270E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F5383B6C-A46A-4DDB-9B64-6E2C6BB270E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F5383B6C-A46A-4DDB-9B64-6E2C6BB270E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F5383B6C-A46A-4DDB-9B64-6E2C6BB270E2}.Release|Any CPU.Build.0 = Release|Any CPU + {720ED405-A0A3-4FB7-9081-9E4A31EE658F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {720ED405-A0A3-4FB7-9081-9E4A31EE658F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {720ED405-A0A3-4FB7-9081-9E4A31EE658F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {720ED405-A0A3-4FB7-9081-9E4A31EE658F}.Release|Any CPU.Build.0 = Release|Any CPU + {BB4752A7-9031-452B-B26A-05DC44D0D6D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB4752A7-9031-452B-B26A-05DC44D0D6D3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB4752A7-9031-452B-B26A-05DC44D0D6D3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB4752A7-9031-452B-B26A-05DC44D0D6D3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/StackApis/AppHost.cs b/src/StackApis/AppHost.cs deleted file mode 100644 index 856c1f5..0000000 --- a/src/StackApis/AppHost.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Funq; -using ServiceStack; -using ServiceStack.Admin; -using ServiceStack.Api.Swagger; -using ServiceStack.Data; -using ServiceStack.OrmLite; -using ServiceStack.Razor; -using StackApis.ServiceInterface; - -namespace StackApis -{ - public class AppHost : AppHostBase - { - /// - /// Default constructor. - /// Base constructor requires a name and assembly to locate web service classes. - /// - public AppHost() - : base("StackApis", typeof(MyServices).Assembly) {} - - /// - /// Application specific configuration - /// This method should initialize any IoC resources utilized by your web service classes. - /// - /// - public override void Configure(Container container) - { - //Config examples - this.Plugins.Add(new SwaggerFeature { UseBootstrapTheme = true }); - this.Plugins.Add(new PostmanFeature()); - this.Plugins.Add(new CorsFeature()); - - Plugins.Add(new RazorFormat()); - - Plugins.Add(new AutoQueryMetadataFeature - { - MaxLimit = 100, - AutoQueryViewerConfig = - { - ServiceDescription = "Search for ServiceStack Questions on StackOverflow", - ServiceIconUrl = "/Content/app/logo-76.png", - BackgroundColor = "#fc9a24", - TextColor = "#fff", - LinkColor = "#ffff8d", - BrandImageUrl = "/Content/app/brand.png", - BrandUrl = "http://stackapis.servicestack.net/", - BackgroundImageUrl = "/Content/app/bg.png", - IsPublic = true, - } - }); - Plugins.Add(new AutoQueryFeature { MaxLimit = 100 }); - Plugins.Add(new AdminFeature()); - - container.Register( - new OrmLiteConnectionFactory("~/App_Data/db.sqlite".MapServerPath(), SqliteDialect.Provider)); - } - } -} \ No newline at end of file diff --git a/src/StackApis/App_Data/db.sqlite b/src/StackApis/App_Data/db.sqlite index 0dc8864..f53c009 100644 Binary files a/src/StackApis/App_Data/db.sqlite and b/src/StackApis/App_Data/db.sqlite differ diff --git a/src/StackApis/Global.asax b/src/StackApis/Global.asax deleted file mode 100644 index 5d048b8..0000000 --- a/src/StackApis/Global.asax +++ /dev/null @@ -1 +0,0 @@ -<%@ Application Codebehind="Global.asax.cs" Inherits="StackApis.Global" Language="C#" %> diff --git a/src/StackApis/Global.asax.cs b/src/StackApis/Global.asax.cs deleted file mode 100644 index 3fc2a2d..0000000 --- a/src/StackApis/Global.asax.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace StackApis -{ - public class Global : System.Web.HttpApplication - { - protected void Application_Start(object sender, EventArgs e) - { - new AppHost().Init(); - } - } -} \ No newline at end of file diff --git a/src/StackApis/Program.cs b/src/StackApis/Program.cs new file mode 100644 index 0000000..5d8b5e5 --- /dev/null +++ b/src/StackApis/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; + +namespace StackApis +{ + public class Program + { + public static void Main(string[] args) + { + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup() + .Build(); + } +} diff --git a/src/StackApis/Properties/AssemblyInfo.cs b/src/StackApis/Properties/AssemblyInfo.cs deleted file mode 100644 index 83c183a..0000000 --- a/src/StackApis/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("StackApis")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("StackApis")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a9ea6792-8f1c-4223-a732-ab43cbd6849e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/StackApis/Properties/PublishProfiles/WebDeploy.pubxml b/src/StackApis/Properties/PublishProfiles/WebDeploy.pubxml deleted file mode 100644 index 04c6158..0000000 --- a/src/StackApis/Properties/PublishProfiles/WebDeploy.pubxml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - MSDeploy - Release - Any CPU - http://stackapis.servicestack.net - True - False - awstest.servicestack.net - StackApis - - True - WMSVC - True - deploy - <_SavePWD>True - - \ No newline at end of file diff --git a/src/StackApis/Properties/launchSettings.json b/src/StackApis/Properties/launchSettings.json new file mode 100644 index 0000000..2331807 --- /dev/null +++ b/src/StackApis/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52697/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "StackApis": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/src/StackApis/StackApis.csproj b/src/StackApis/StackApis.csproj old mode 100644 new mode 100755 index f993ba2..eaad563 --- a/src/StackApis/StackApis.csproj +++ b/src/StackApis/StackApis.csproj @@ -1,229 +1,37 @@ - - - + + - Debug - AnyCPU - - - 2.0 - {6F86FC59-9DE7-4BF5-8D11-CB7E99DA29FC} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - StackApis + net5 + true StackApis - v4.5 - true - - - - - true - + Exe + StackApis - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - - ..\packages\ServiceStack.OrmLite.Sqlite.Mono.4.5.0\lib\net45\Mono.Data.Sqlite.dll - True - - - ..\packages\ServiceStack.4.5.0\lib\net45\ServiceStack.dll - True - - - ..\packages\ServiceStack.Admin.4.5.0\lib\net45\ServiceStack.Admin.dll - True - - - ..\packages\ServiceStack.Api.Swagger.4.5.0\lib\net45\ServiceStack.Api.Swagger.dll - True - - - ..\packages\ServiceStack.Client.4.5.0\lib\net45\ServiceStack.Client.dll - True - - - ..\packages\ServiceStack.Common.4.5.0\lib\net45\ServiceStack.Common.dll - True - - - ..\packages\ServiceStack.Interfaces.4.5.0\lib\portable-wp80+sl5+net45+win8+wpa81+monotouch+monoandroid+xamarin.ios10\ServiceStack.Interfaces.dll - True - - - ..\packages\ServiceStack.OrmLite.4.5.0\lib\net45\ServiceStack.OrmLite.dll - True - - - ..\packages\ServiceStack.OrmLite.Sqlite.Mono.4.5.0\lib\net45\ServiceStack.OrmLite.Sqlite.dll - True - - - ..\packages\ServiceStack.Razor.4.5.0\lib\net45\ServiceStack.Razor.dll - True - - - ..\packages\ServiceStack.Redis.4.5.0\lib\net45\ServiceStack.Redis.dll - True - - - ..\packages\ServiceStack.Server.4.5.0\lib\net45\ServiceStack.Server.dll - True - - - ..\packages\ServiceStack.Text.4.5.0\lib\net45\ServiceStack.Text.dll - True - - - - - - - - - - - - ..\packages\ServiceStack.Razor.4.5.0\lib\net45\System.Web.Razor.dll - True - - - - - - - - - + - - - - - - - - - - - - - - - - Designer - - - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - - - - - Web.config - - - Web.config + + PreserveNewest + - - - Designer - + + + - - - Global.asax - - + + + + + + + + + + + + - - - - - - {582dfb0f-f84d-4e43-9bca-2a5a86600b7a} - StackApis.ServiceInterface - - - {08bef328-ab7d-48d3-800d-48acc75c7914} - StackApis.ServiceModel - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - - True - True - 32494 - / - http://localhost:32494/ - False - False - - - False - - - - - - \ No newline at end of file + + diff --git a/src/StackApis/Startup.cs b/src/StackApis/Startup.cs new file mode 100644 index 0000000..26974e1 --- /dev/null +++ b/src/StackApis/Startup.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Funq; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using ServiceStack; +using ServiceStack.Admin; +using ServiceStack.Api.OpenApi; +using ServiceStack.Data; +using ServiceStack.Mvc; +using ServiceStack.OrmLite; +using StackApis.ServiceInterface; + +namespace StackApis +{ + public class Startup + { + // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940 + public void ConfigureServices(IServiceCollection services) + { + // Add framework services. + services.AddMvc(options => options.EnableEndpointRouting = false); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + } + + app.UseStaticFiles(); + + app.UseServiceStack(new AppHost()); + + app.UseMvc(routes => + { + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + }); + } + } + + public class AppHost : AppHostBase + { + /// + /// Default constructor. + /// Base constructor requires a name and assembly to locate web service classes. + /// + public AppHost() + : base("StackApis", typeof(MyServices).Assembly) { } + + /// + /// Application specific configuration + /// This method should initialize any IoC resources utilized by your web service classes. + /// + public override void Configure(Container container) + { + SetConfig(new HostConfig { UseCamelCase = false }); + + this.Plugins.Add(new OpenApiFeature()); + this.Plugins.Add(new PostmanFeature()); + this.Plugins.Add(new CorsFeature()); + + Plugins.Add(new RazorFormat()); + + Plugins.Add(new AutoQueryFeature { MaxLimit = 100 }); + Plugins.Add(new AdminFeature()); + + container.Register( + new OrmLiteConnectionFactory(MapProjectPath("~/App_Data/db.sqlite"), SqliteDialect.Provider)); + } + } +} diff --git a/src/StackApis/Views/Hello.cshtml b/src/StackApis/Views/Hello.cshtml deleted file mode 100644 index f44b3ee..0000000 --- a/src/StackApis/Views/Hello.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@inherits ViewPage - -

@Model.Result

- -

< home

diff --git a/src/StackApis/Views/Shared/_Layout.cshtml b/src/StackApis/Views/Shared/_Layout.cshtml index 5085400..e22a701 100644 --- a/src/StackApis/Views/Shared/_Layout.cshtml +++ b/src/StackApis/Views/Shared/_Layout.cshtml @@ -61,14 +61,14 @@ - + StackApis diff --git a/src/StackApis/Views/StackOverflowQuery.cshtml b/src/StackApis/Views/StackOverflowQuery.cshtml index e508564..669d696 100644 --- a/src/StackApis/Views/StackOverflowQuery.cshtml +++ b/src/StackApis/Views/StackOverflowQuery.cshtml @@ -1,5 +1,4 @@ -@using System.Linq -@inherits ViewPage> +@model QueryResponse @{ ViewBag.Title = "ServiceStack StackOverflow questions"; } diff --git a/src/StackApis/Views/_ViewImports.cshtml b/src/StackApis/Views/_ViewImports.cshtml new file mode 100644 index 0000000..b2985d0 --- /dev/null +++ b/src/StackApis/Views/_ViewImports.cshtml @@ -0,0 +1,7 @@ +@using ServiceStack +@using ServiceStack.Mvc +@using StackApis +@using StackApis.ServiceModel +@using StackApis.ServiceModel.Types + +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/src/StackApis/Views/_ViewStart.cshtml b/src/StackApis/Views/_ViewStart.cshtml new file mode 100644 index 0000000..a5f1004 --- /dev/null +++ b/src/StackApis/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/src/StackApis/Web.Debug.config b/src/StackApis/Web.Debug.config deleted file mode 100644 index 2e302f9..0000000 --- a/src/StackApis/Web.Debug.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/src/StackApis/Web.Release.config b/src/StackApis/Web.Release.config deleted file mode 100644 index c358444..0000000 --- a/src/StackApis/Web.Release.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/StackApis/Web.config b/src/StackApis/Web.config index bd36261..dc0514f 100644 --- a/src/StackApis/Web.config +++ b/src/StackApis/Web.config @@ -1,59 +1,14 @@  + - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + diff --git a/src/StackApis/favicon.ico b/src/StackApis/favicon.ico deleted file mode 100644 index 41c2ac6..0000000 Binary files a/src/StackApis/favicon.ico and /dev/null differ diff --git a/src/StackApis/packages.config b/src/StackApis/packages.config deleted file mode 100644 index 9964f0e..0000000 --- a/src/StackApis/packages.config +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/StackApis/sqlite3.dll b/src/StackApis/sqlite3.dll deleted file mode 100644 index 1058a2b..0000000 Binary files a/src/StackApis/sqlite3.dll and /dev/null differ diff --git a/src/StackApis/Content/Images/logo-280-white.png b/src/StackApis/wwwroot/Content/Images/logo-280-white.png similarity index 100% rename from src/StackApis/Content/Images/logo-280-white.png rename to src/StackApis/wwwroot/Content/Images/logo-280-white.png diff --git a/src/StackApis/Content/Images/logo-280.png b/src/StackApis/wwwroot/Content/Images/logo-280.png similarity index 100% rename from src/StackApis/Content/Images/logo-280.png rename to src/StackApis/wwwroot/Content/Images/logo-280.png diff --git a/src/StackApis/Content/app/bg.png b/src/StackApis/wwwroot/Content/app/bg.png similarity index 100% rename from src/StackApis/Content/app/bg.png rename to src/StackApis/wwwroot/Content/app/bg.png diff --git a/src/StackApis/Content/app/brand.png b/src/StackApis/wwwroot/Content/app/brand.png similarity index 100% rename from src/StackApis/Content/app/brand.png rename to src/StackApis/wwwroot/Content/app/brand.png diff --git a/src/StackApis/Content/app/logo-76.png b/src/StackApis/wwwroot/Content/app/logo-76.png similarity index 100% rename from src/StackApis/Content/app/logo-76.png rename to src/StackApis/wwwroot/Content/app/logo-76.png diff --git a/src/StackApis/Content/app/stacks-75.png b/src/StackApis/wwwroot/Content/app/stacks-75.png similarity index 100% rename from src/StackApis/Content/app/stacks-75.png rename to src/StackApis/wwwroot/Content/app/stacks-75.png diff --git a/src/StackApis/Content/app/stacks-white-75.png b/src/StackApis/wwwroot/Content/app/stacks-white-75.png similarity index 100% rename from src/StackApis/Content/app/stacks-white-75.png rename to src/StackApis/wwwroot/Content/app/stacks-white-75.png diff --git a/src/StackApis/Content/bootstrap-theme.css b/src/StackApis/wwwroot/Content/bootstrap-theme.css similarity index 100% rename from src/StackApis/Content/bootstrap-theme.css rename to src/StackApis/wwwroot/Content/bootstrap-theme.css diff --git a/src/StackApis/Content/bootstrap-theme.css.map b/src/StackApis/wwwroot/Content/bootstrap-theme.css.map similarity index 100% rename from src/StackApis/Content/bootstrap-theme.css.map rename to src/StackApis/wwwroot/Content/bootstrap-theme.css.map diff --git a/src/StackApis/Content/bootstrap-theme.min.css b/src/StackApis/wwwroot/Content/bootstrap-theme.min.css similarity index 100% rename from src/StackApis/Content/bootstrap-theme.min.css rename to src/StackApis/wwwroot/Content/bootstrap-theme.min.css diff --git a/src/StackApis/Content/bootstrap.css b/src/StackApis/wwwroot/Content/bootstrap.css similarity index 100% rename from src/StackApis/Content/bootstrap.css rename to src/StackApis/wwwroot/Content/bootstrap.css diff --git a/src/StackApis/Content/bootstrap.css.map b/src/StackApis/wwwroot/Content/bootstrap.css.map similarity index 100% rename from src/StackApis/Content/bootstrap.css.map rename to src/StackApis/wwwroot/Content/bootstrap.css.map diff --git a/src/StackApis/Content/bootstrap.min.css b/src/StackApis/wwwroot/Content/bootstrap.min.css similarity index 100% rename from src/StackApis/Content/bootstrap.min.css rename to src/StackApis/wwwroot/Content/bootstrap.min.css diff --git a/src/StackApis/wwwroot/_ViewImports.cshtml b/src/StackApis/wwwroot/_ViewImports.cshtml new file mode 100644 index 0000000..0d9db1b --- /dev/null +++ b/src/StackApis/wwwroot/_ViewImports.cshtml @@ -0,0 +1,10 @@ +@inherits ViewPage + +@using ServiceStack +@using ServiceStack.Mvc +@using ServiceStack.Text +@using StackApis +@using StackApis.ServiceModel +@using StackApis.ServiceModel.Types + +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/src/StackApis/wwwroot/_ViewStart.cshtml b/src/StackApis/wwwroot/_ViewStart.cshtml new file mode 100644 index 0000000..a5f1004 --- /dev/null +++ b/src/StackApis/wwwroot/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/src/StackApis/default.cshtml b/src/StackApis/wwwroot/default.cshtml similarity index 99% rename from src/StackApis/default.cshtml rename to src/StackApis/wwwroot/default.cshtml index f0d1ddd..f649763 100644 --- a/src/StackApis/default.cshtml +++ b/src/StackApis/wwwroot/default.cshtml @@ -1,6 +1,5 @@ -@using StackApis.ServiceModel -@inherits ViewPage -@{ +@{ + Layout = "_Layout"; ViewBag.Title = "ServiceStack Questions"; }