Skip to content

dev: update docker node version, server address, and docker-compose #3053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version: "3"

services:
postgres:
image: postgres:9.6
Expand All @@ -10,16 +11,19 @@ services:
- 5432:5432
volumes:
- postgres-data:/var/lib/postgresql/data

backend:
build:
context: .
dockerfile: backend.Dockerfile
environment:
DEV_DOCKER: "true"
DATABASE_URL: postgres://postgres:password@postgres/cargo_registry
SESSION_KEY: badkeyabcdefghijklmnopqrstuvwxyzabcdef
GIT_REPO_URL: file://./tmp/index-bare
GH_CLIENT_ID: ""
GH_CLIENT_SECRET: ""
WEB_ALLOWED_ORIGINS: http://localhost:8888,http://localhost:4200
links:
- postgres
ports:
Expand All @@ -32,6 +36,7 @@ services:
- index:/app/tmp
- cargo-cache:/usr/local/cargo/registry
- target-cache:/app/target

frontend:
build:
context: .
Expand Down
3 changes: 3 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,9 @@ services:
GH_CLIENT_SECRET: blahblah_secret
```

These environment variables can also be defined in a local `.env` file, see `.env.sample`
for various configuration options.

#### Accessing services

By default, the services will be exposed on their normal ports:
Expand Down
2 changes: 1 addition & 1 deletion frontend.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12.9-alpine
FROM node:14.9-alpine

WORKDIR /app
COPY package.json yarn.lock /app/
Expand Down
8 changes: 7 additions & 1 deletion src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

let heroku = dotenv::var("HEROKU").is_ok();
let fastboot = dotenv::var("USE_FASTBOOT").is_ok();
let dev_docker = dotenv::var("DEV_DOCKER").is_ok();

let ip = if dev_docker {
[0, 0, 0, 0]
} else {
[127, 0, 0, 1]
};
let port = if heroku {
8888
} else {
Expand Down Expand Up @@ -103,7 +109,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
async move { Service::from_blocking(handler, addr) }
});

let addr = ([127, 0, 0, 1], port).into();
let addr = (ip, port).into();
#[allow(clippy::async_yields_async)]
let server = rt.block_on(async { hyper::Server::bind(&addr).serve(make_service) });

Expand Down