-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix social login using vk when run in production
* by specifying good dns for backend service; * specify/upgrade versions of base docker images (java 12 -> 14, postgres 12, node 12 -> 14); * specify "expose" to see which port(s) are relevant for specific image; * track efforts put into configuring and using Tor proxy (for possible future reference); * update cpu limits.
- Loading branch information
Showing
18 changed files
with
107 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM postgres:alpine | ||
FROM postgres:12.4-alpine | ||
COPY healthcheck.sh /scripts/healthcheck.sh | ||
HEALTHCHECK --interval=30s --timeout=15s --retries=3 \ | ||
CMD bash /scripts/healthcheck.sh || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# [Running Tor Proxy with Docker](https://dev.to/nabarun/running-tor-proxy-with-docker-56n9) | ||
|
||
# set alpine as the base image of the Dockerfile | ||
FROM alpine:3.12.0 | ||
|
||
# install Tor and curl | ||
RUN apk add --no-cache tor curl | ||
|
||
# Copy over the torrc created above and set the owner to `tor` | ||
COPY torrc /etc/tor/torrc | ||
RUN chown -R tor /etc/tor | ||
|
||
# Set `tor` as the default user during the container runtime | ||
USER tor | ||
|
||
# Set `tor` as the entrypoint for the image | ||
ENTRYPOINT ["tor"] | ||
|
||
EXPOSE 9050 | ||
|
||
# Set the default container command | ||
# This can be overridden later when running a container | ||
CMD ["-f", "/etc/tor/torrc"] | ||
|
||
COPY healthcheck.sh /scripts/healthcheck.sh | ||
HEALTHCHECK --interval=30s --timeout=15s --retries=3 --start-period=20s \ | ||
CMD sh /scripts/healthcheck.sh || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
# [How to check if Tor is working and debug the problem on CLI?](https://tor.stackexchange.com/questions/12678/how-to-check-if-tor-is-working-and-debug-the-problem-on-cli) | ||
status=$(curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.torproject.org/ | cat | grep -m 1 Congratulations | wc -l) | ||
|
||
if [ $status -eq 1 ]; then | ||
exit 0 | ||
fi; | ||
|
||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Tor (for development/test environment) | ||
1. [Setting up Tor Proxy and Hidden Services in Linux](https://www.devdungeon.com/content/setting-tor-proxy-and-hidden-services-linux) | ||
2. [Using CURL with TOR as a Proxy on CentOs](https://stackoverflow.com/questions/39257293/using-curl-with-tor-as-a-proxy-on-centos) | ||
|
||
|
||
## docker-compose.yml | ||
``` | ||
bd-tor: | ||
build: ./better-dating-tor | ||
image: skivol/better-dating-tor:latest | ||
container_name: "bd-prod-tor" | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '0.25' | ||
memory: 50M | ||
reservations: | ||
cpus: '0.05' | ||
memory: 20M | ||
restart_policy: | ||
condition: any | ||
delay: 10s | ||
max_attempts: 2 | ||
window: 120s | ||
``` | ||
|
||
## reactor-netty | ||
``` | ||
private fun proxyConnector(proxySettings: ProxySettings): ReactorClientHttpConnector { | ||
// inspired by https://github.com/reactor/reactor-netty/issues/887 | ||
val httpClient = HttpClient.create() | ||
.proxy { | ||
it.type(ProxyProvider.Proxy.SOCKS5) | ||
.host(proxySettings.host) | ||
.port(proxySettings.port) | ||
} | ||
return ReactorClientHttpConnector(httpClient) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SocksPort 0.0.0.0:9050 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters