Deploy process cleaned up

This commit is contained in:
Alexandre Bourlier 2018-05-01 06:18:20 +02:00
parent 95d6c6abf8
commit 0057e9245b
9 changed files with 87 additions and 16 deletions

1
.gitignore vendored
View File

@ -10,4 +10,5 @@ dist/html/*
# Files
index.html
config.php
issues.md

View File

@ -3,7 +3,6 @@ HD app is the magic tool that allows the Happy Dev network to thrive in a decent
## Install (Ubuntu)
* `git clone --recurse-submodules https://git.happy-dev.fr/happy-dev/hd-app.git`
* `cd hd-app`
* `apt install npm`
* `npm install -g grunt-cli`
* `npm install`

8
config-sample.php Normal file
View File

@ -0,0 +1,8 @@
<?php
$dn = getenv("DN");// Domain Name of the app
$sdn = getenv("SDN");// Server Domain Name
if ($dn === NULL) {
$dn = 'http://hd-app.local';
$sdn = 'http://localhost:8000';
}

9
deploy.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
export DN="http://app.happy-dev.fr"
export SDN="http://hd-ldp.happy-dev.fr"
php index.php > index.html
grunt
ssh happy-dev_alex@ssh-happy-dev.alwaysdata.net "cd hd-app; rm -Rf ./*; mkdir -p src/fonts; mkdir -p dist/css;"
scp -r index.html happy-dev_alex@ssh-happy-dev.alwaysdata.net:~/hd-app/
scp -r dist/css/ happy-dev_alex@ssh-happy-dev.alwaysdata.net:~/hd-app/dist/
scp -r src/fonts/ happy-dev_alex@ssh-happy-dev.alwaysdata.net:~/hd-app/src/

View File

@ -1,7 +1,7 @@
<?php
// Some useful variables
$v = rand();// Used to avoid abusive caching by the browser
$dn = 'http://'. $_SERVER['HTTP_HOST'];
require_once("config.php");// Use "config-sample.php" to create your own
?>
<!DOCTYPE html>
<html lang="fr">
@ -12,20 +12,14 @@
<title>Happy Dev App</title>
<!-- Stylesheets -->
<link rel="stylesheet" href="<?php echo $dn; ?>/node_modules/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="<?php echo $dn; ?>/dist/css/hd-app.css?v=<?php echo $v ?>" />
<link rel="stylesheet" href="<?php echo $dn; ?>/node_modules/font-awesome/css/font-awesome.min.css" />
<!-- Javascript -->
<script type="text/javascript" src="<?php echo $dn; ?>/node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $dn; ?>/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo $dn; ?>/dist/lib/webcomponentsjs/webcomponents-loader.js"></script>
<!-- Web components -->
<link rel="import" href="<?php echo $dn; ?>/dist/lib/ldp-display/ldp-display.html?v=<?php echo $v ?>" />
<link rel="import" href="<?php echo $dn; ?>/dist/lib/ldp-display/ldp-router.html?v=<?php echo $v ?>" />
<link rel="import" href="<?php echo $dn; ?>/dist/lib/xmpp-chat-component/chat-window-component.html?v=<?php echo $v ?>">
<?php
// Prod/Dev setup
if ($dn == 'http://app.happy-dev.fr') {
require_once("src/html/dependencies-prod.php");
} else {
require_once("src/html/dependencies-dev.php");
}
?>
</head>
<body>

View File

@ -0,0 +1,15 @@
<!-- Stylesheets -->
<link rel="stylesheet" href="<?php echo $dn; ?>/node_modules/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="<?php echo $dn; ?>/dist/css/hd-app.css?v=<?php echo $v ?>" />
<link rel="stylesheet" href="<?php echo $dn; ?>/node_modules/font-awesome/css/font-awesome.min.css" />
<!-- Javascript -->
<script type="text/javascript" src="<?php echo $dn; ?>/node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $dn; ?>/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo $dn; ?>/dist/lib/webcomponentsjs/webcomponents-loader.js"></script>
<!-- Web components -->
<link rel="import" href="<?php echo $dn; ?>/dist/lib/ldp-display/ldp-display.html?v=<?php echo $v ?>" />
<link rel="import" href="<?php echo $dn; ?>/dist/lib/ldp-display/ldp-router.html?v=<?php echo $v ?>" />
<link rel="import" href="<?php echo $dn; ?>/dist/lib/xmpp-chat-component/chat-window-component.html?v=<?php echo $v ?>">

View File

@ -0,0 +1,15 @@
<!-- Stylesheets -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
<link rel="stylesheet" href="<?php echo $dn; ?>/dist/css/hd-app.css?v=<?php echo $v ?>" />
<!-- Javascript -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.2.0/webcomponents-loader.js" integrity="sha256-fUVqCtpScUF69qkFkeuHmcShr2N2UleRQJhRG4etHds=" crossorigin="anonymous"></script>
<!-- Web components -->
<link rel="import" href="https://cdn.happy-dev.fr/ldp-display/ldp-display.html?v=<?php echo $v ?>" />
<link rel="import" href="https://cdn.happy-dev.fr/ldp-display/ldp-router.html?v=<?php echo $v ?>" />
<link rel="import" href="https://cdn.happy-dev.fr/xmpp-chat-component/chat-window-component.html?v=<?php echo $v ?>">

30
src/server/urls.py Normal file
View File

@ -0,0 +1,30 @@
"""hdappserver URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
from djangoldp.views import LDPViewSet
from .models import Member, Skill, Project, Client, Cell, Channel
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^members/', LDPViewSet.urls(model=Member, nested_field="skills")),
url(r'^skills/', LDPViewSet.urls(model=Skill)),
url(r'^projects/', LDPViewSet.urls(model=Project, nested_field="team")),
url(r'^clients/', LDPViewSet.urls(model=Client)),
url(r'^cells/', LDPViewSet.urls(model=Cell)),
url(r'^channels/', LDPViewSet.urls(model=Channel, nested_field="members")),
]