Document How to Run in Azure VM

Aberta
#241 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
35/100
Tipo de issue
Documentação
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
azure, node.js, postgresql, shell, ubuntu

Direção de pesquisa

Nenhum arquivo de documentação de destino é nomeado. Comece encontrando a documentação existente do projeto sobre deployment ou hosting e, em seguida, compare suas convenções com as etapas de Azure VM nesta issue. Considera-se concluído quando um guia sustentável de Azure VM abranger PostgreSQL, a inicialização do PostGraphile, o acesso externo, a verificação e a desconexão do processo.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Feature description

Document how to run in Azure on a VM.

Motivating example

I wanted to host in Azure and followed the steps below.


Steps that enabled me to host in an Azure VM:

Using Graphile over PostgreSQL 12

Created Ubuntu 20.04 Gen1 VM in Azure using static IP address

Connect using OSX Terminal SSH command

Launchpad
Terminal

ssh {vm_username}@{ip_address}
Create database user
sudo adduser {database_username}
Install PostgreSQL
sudo apt-get update
sudo apt-get install postgresql-12
CREATE ROLE {datebase_username} WITH LOGIN CREATEDB ENCRYPTED PASSWORD '{database_user_password}';
CREATE DATABASE {database_name};
GRANT ALL PRIVILEGES ON DATABASE {database_name} to {database_username};
\q
su {database_username}
psql -d {database_name}
CREATE TABLE testtable(
  ID INT PRIMARY KEY NOT NULL,
  NAME TEXT NOT NULL
);
\d

psql "postgres://{database_username}:{database_user_password}@localhost/{database_name}"

Note: connection strings require URL encoding.

Steps above were adapted from https://tecadmin.net/install-postgresql-server-on-ubuntu/

PostgreSQL Adding GUID (UUID) Support:
sudo su postgres
psql {database_name}
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
SELECT uuid_generate_v4();

Steps above were adapted from https://www.postgresqltutorial.com/postgresql-uuid/#:~:text=The%20Basics%20Of%20PostgreSQL%20UUID,table%20with%20UUID%20column.

Install NPM
sudo apt install npm
Install Yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn
Install PostGraphile
yarn add postgraphile
Install Optional Plugins
yarn add @graphile-contrib/pg-simplify-inflector
Start Graphile with:
npx postgraphile \
  --subscriptions \
  --watch \
  --dynamic-json \
  --no-setof-functions-contain-nulls \
  --no-ignore-rbac \
  --no-ignore-indexes \
  --show-error-stack=json \
  --extended-errors hint,detail,errcode \
  --append-plugins @graphile-contrib/pg-simplify-inflector \
  --export-schema-graphql schema.graphql \
  --graphiql "/graphiql" \
  --enhance-graphiql \
  --allow-explain \
  --enable-query-batching \
  --legacy-relations omit \
  --connection postgres://{database_username}:{database_user_password}@localhost/{database_name} \
  --owner-connection postgres://postgres:{postgress_password}@localhost/{database_name} \
  --schema public \
  --host 0.0.0.0

Documentation: CLI Usage: https://www.graphile.org/postgraphile/usage-cli/

Note: By default only localhost works but the --host 0.0.0.0 argument enables access from outside the server.

Note: sudo tcpdump port 5000 can be used to debug network issues to determine if traffic is hitting the server.

Verify Server is Working:
curl http://{vm_ip_address}:5000/graphiql
Disconnect Graphile execution from SSH window:
# Press <ctrl+z>
bg
disown -h
Linguagem predominante
SCSS
Estrelas
27
Forks
124
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

  • Sem Dockerfile nem arquivo Docker Compose
  • Tem um modelo de pull request
  • Sem guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de graphile/graphile.github.io

Todas as issues de graphile/graphile.github.io

Issues semelhantes

Mais issues de Cloud

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.