wire up Web proj behind nginx

This commit is contained in:
Collin M. Barrett 2019-01-20 18:42:15 -06:00
parent 4d2f3aabce
commit 5637d3563b
6 changed files with 40 additions and 27 deletions

View file

@ -17,17 +17,19 @@ services:
- "80/tcp"
depends_on:
- FilterLists.MariaDB
# FilterLists.Web:
# image: 'filterlists.web'
# build:
# context: src/FilterLists.Web
FilterLists.Web:
image: 'filterlists.web'
build:
context: src/FilterLists.Web
expose:
- "80/tcp"
FilterLists.NGINX:
image: 'nginx:stable-alpine'
build:
context: ./ops/nginx
ports:
- '80:80'
- '443:443'
- '80:80/tcp'
- '443:443/tcp'
links:
- FilterLists.Api
# - FilterLists.Web
- FilterLists.Web

View file

@ -5,15 +5,21 @@ events { worker_connections 1024; }
http {
sendfile on;
upstream app_servers {
server FilterLists.Api:80;
}
server {
listen 80;
location ^~ /api {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://FilterLists.Api:80;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
location / {
proxy_pass http://app_servers;
proxy_pass http://FilterLists.Web:80;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

View file

@ -34,7 +34,7 @@ const Footer = () =>
</footer>;
const ApiLink = () =>
<a href="https://filterlists.com/api/docs/index.html"
<a href="/api/docs/index.html"
title="API Swagger Docs">
API
</a>;

View file

@ -41,49 +41,49 @@ export class HomeContainer extends React.Component<{}, IState> {
};
fetchLanguages() {
fetch("https://filterlists.com/api/v1/languages")
fetch("/api/v1/languages")
.then(r => r.json() as Promise<ILanguage[]>)
.then(p => { this.setState({ languages: p }); });
};
fetchLicenses() {
fetch("https://filterlists.com/api/v1/licenses")
fetch("/api/v1/licenses")
.then(r => r.json() as Promise<ILicense[]>)
.then(p => { this.setState({ licenses: p }); });
};
fetchLists() {
fetch("https://filterlists.com/api/v1/lists")
fetch("/api/v1/lists")
.then(r => r.json() as Promise<IList[]>)
.then(p => { this.setState({ lists: p }); });
};
fetchMaintainers() {
fetch("https://filterlists.com/api/v1/maintainers")
fetch("/api/v1/maintainers")
.then(r => r.json() as Promise<IMaintainer[]>)
.then(p => { this.setState({ maintainers: p }); });
};
fetchSoftware() {
fetch("https://filterlists.com/api/v1/software")
fetch("/api/v1/software")
.then(r => r.json() as Promise<ISoftware[]>)
.then(p => { this.setState({ software: p }); });
};
fetchSyntaxes() {
fetch("https://filterlists.com/api/v1/syntaxes")
fetch("/api/v1/syntaxes")
.then(r => r.json() as Promise<ISyntax[]>)
.then(p => { this.setState({ syntaxes: p }); });
};
fetchTags() {
fetch("https://filterlists.com/api/v1/tags")
fetch("/api/v1/tags")
.then(r => r.json() as Promise<ITag[]>)
.then(p => { this.setState({ tags: p }); });
};
fetchRuleCount() {
fetch("https://filterlists.com/api/v1/rules")
fetch("/api/v1/rules")
.then(r => r.json() as Promise<number>)
.then(p => { this.setState({ ruleCount: p }); });
};

View file

@ -1,10 +1,15 @@
FROM microsoft/dotnet:2.2-sdk-alpine AS publish
COPY FilterLists.Web /FilterLists.Web
RUN apk add --update nodejs-npm \
&& dotnet publish FilterLists.Web/FilterLists.Web.csproj -c Release -o /out
RUN apk add --update nodejs-npm
WORKDIR /app
COPY FilterLists.Web.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /out
FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine
WORKDIR /app
COPY --from=publish /out .
ENV ASPNETCORE_URLS http://+:5001
EXPOSE 5001
ENV ASPNETCORE_URLS http://+:80
ENTRYPOINT ["dotnet", "FilterLists.Web.dll"]

View file

@ -8,6 +8,6 @@ public static class Program
public static void Main(string[] args) => CreateWebHostBuilder(args).Build().Run();
private static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args).UseUrls("http://localhost:5001;").UseStartup<Startup>();
WebHost.CreateDefaultBuilder(args).UseStartup<Startup>();
}
}