Skip to content
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

Docker compose #21

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:12
WORKDIR /usr/src/app
COPY . .
RUN yarn
EXPOSE 8080
ENV NODE_ENV=production
CMD [ "yarn", "dev" ]
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@

https://github.com/ide-stories/vscode-stories

# How to run on your computer
# How to run with docker (recommended, requires docker & docker-compose)
1. Make sure you have no services running on ports 5050, 8080 and 5432 (e.g. with `netstat -tulpn | grep LISTEN`).
If necessary, you can change the *ports* section of each service in the *docker-compose.yml*.
2. Set the `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` variables in *docker-compose.yml*.
3. Run `docker-compose up -d` from the project root
4. Your stack is now running partially. Open pgAdmin on *localhost:5050* with the default credentials (*[email protected]|admin*)
and create a server with host 'postgres_container',
username 'postgres', password 'changeme'. Create a database called *stories*.
5. Restart the api service with `docker-compose restart api`
6. Check with `docker-compose logs api` if the server is running. It should say *server started*

# How to run on your computer (native)
1. Have PostgreSQL running on your computer
2. Create a database called `stories`
3. Copy `.env.example` to `.env` and fill in `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` (you will have to register a GitHub OAuth account and set the callback url to: http://localhost:8080/auth/github/callback)
Expand Down
61 changes: 61 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: '3.5'

services:

api:
container_name: stories_api
build: .
ports:
- 8080:8080

environment:
TOKEN_SECRET: jqowd0qwe012jjje21dojdol2io1dj12o
DB_HOST: postgres_container
DB_USER: postgres
DB_PASSWORD: changeme
DB_PORT: 5432
GITHUB_CLIENT_ID: test
GITHUB_CLIENT_SECRET: test
SERVER_URL: 'localhost:8080'
REFRESH_TOKEN_SECRET: wqoikdjq90d210381jdwq0oe0192803e12ejmsakldjqowei12
ACCESS_TOKEN_SECRET: woqieod12u09e8120eusaoidcnasjo0923810ued9j1n2oijaqwe
networks:
- postgres
restart: unless-stopped

postgres:
container_name: postgres_container
image: postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: changeme
PGDATA: /data/postgres
volumes:
- postgres:/data/postgres
ports:
- 5432:5432
networks:
- postgres
restart: unless-stopped

pgadmin:
container_name: pgadmin_container
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: admin
volumes:
- pgadmin:/root/.pgadmin
ports:
- 5050:80
networks:
- postgres
restart: unless-stopped

networks:
postgres:
driver: bridge

volumes:
postgres:
pgadmin: