Giter Site home page Giter Site logo

Comments (10)

32teeth avatar 32teeth commented on August 9, 2024 2

now fixed

for anyone running into similar issues, heres what i found

  • if you downloaded the the compiler from github, you need to edit your yml file
  • make sure your yml director paths include the master branch folder

before

[snip]
    arduino_cores_dir: /opt/codebender/codebender-arduino-core-files
    external_core_files: /opt/codebender/external-core-files
    clang: /opt/codebender/codebender-arduino-core-files/clang/v3_5/bin/clang
[snip]

after

[snip]
    arduino_cores_dir: /opt/codebender/codebender-arduino-core-files/arduino-core-files-master
    external_core_files: /opt/codebender/external-core-files/external_cores-master
    clang: /opt/codebender/codebender-arduino-core-files/arduino-core-files-master/clang/v3_5/bin/clang
[snip]

from compiler.

weiway avatar weiway commented on August 9, 2024

I tried both the installation instructions on the wiki and on the repo readme

from compiler.

dastergon avatar dastergon commented on August 9, 2024

Hello @weiway,

Thanks for reporting your issue.
The instructions in the wiki page are Ubuntu 12.04-specific.
Could you give us more info about the exact steps that you're following?

I write a brief how-to below for Ubuntu 14.04 setup so you can give it a try.

After your new EC2 instance is up:

General

  • Run # apt-get update and # apt-get upgrade to get the latest packages.
  • If you have an EBS-backed instance, restart autofs : # service autofs restart
  • Install acl, git and curl if they are not already installed # apt-get install acl git curl

Apache

  • Install apache2 # apt-get install apache2
  • Check which MPM apache2 is currently running. (It should be prefork to use mod_php5)
# apachectl -V | grep -i mpm

Result:
Server MPM:     prefork

Otherwise run # a2enmod mpm_prefork

  • Enable mod_alias: # a2enmod alias
  • Enable mod_rewrite: # a2enmod rewrite

PHP

  • Install PHP5: # apt-get install php5
  • Enable mod_php5: # a2enmod php5
  • Install some PHP extensions that are required: # apt-get install php5-intl php5-curl php5-sqlite

Deployment

  • Create a directory to clone the required repositories (i.e /opt/weiway/ or the default /var/www/)
  • Clone the Arduino core files: git clone https://github.com/codebendercc/arduino-core-files.git
  • Clone the non-standard core files used by compiler: git clone https://github.com/codebendercc/external_cores.git
  • Clone the compiler repo: git clone https://github.com/codebendercc/compiler.git
  • Go to compiler's directory: cd /path/to/your/compiler
  • Go to the Symfony directory: cd Symfony
  • Install dependencies with composer: composer install --no-dev --optimize-autoloader (remove --no-dev if you want to use compiler for development)
  • Change your parameters.yml as necessary(/path/to/compiler/Symfony/app/conf/parameters.yml)
  • Fix Symfony cache/logs issues (assuming that you are already in the Symfony directory):
  mkdir -p app/cache app/logs
  setfacl -R -m u:www-data:rwX -m u:ubuntu:rwX app/cache/ app/logs/
  setfacl -dR -m u:www-data:rwx -m u:ubuntu:rwx app/cache/ app/logs/
  • Clear the cache (if exists) : # php app/console cache:clear --env=prod --no-debug
  • Warmup cache: # php app/console cache:warmup --env=prod --no-debug
  • Create an Apache vhost (i.e /etc/apache2/sites-available/compiler.conf) with the following content:
<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName compiler.yourdomain.com
    DocumentRoot /path/to/compiler/Symfony/web
    DirectoryIndex index.php
    SetEnv APPLICATION_ENV "production"

   <Directory /path/to/compiler/Symfony/web>
        Options -Indexes +FollowSymLinks +MultiViews
        Require all granted
        AllowOverride All
    </Directory>
</VirtualHost>
  • Enable the vhost: # a2ensite compiler
  • Restart apache2: # service apache2 restart

Now to see if the setup was successful, run : curl http://your_ip/status and you should expect {"success":true,"status":"OK"} as a response. If you don't get a successful return message try curl http://your_ip/app_dev.php/status to see if it is a cache issue.

For any problems refer to /var/log/apache2/error.log and /path/to/your/compiler/Symfony/app/logs/

I hope it helped. Let me know if you have any questions.

Pavlos

from compiler.

weiway avatar weiway commented on August 9, 2024

Thank you for answering!

This time I followed your instruction for Ubuntu14.04 step by step.

At first the server still reponse with a 404 error, but I then disabled an apache site with a2dissite 000-default.conf command ( only left compiler.conf in /etc/apache2/site-enabled folder), then server will reponse to /status request with correct json message.

However, the request to /myauthword/apiversion will return a 500 error.
But if i entered wrong auth word or api version number server will response with a json.

Here is the line in the /var/log/apache2/error.log for the api post request with 500 status

[Wed Sep 09 23:11:18.094677 2015] [:error] [pid 28749] PHP Fatal error: require_once(): Failed opening required 'System.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/compiler/Symfony/src/Codebender/CompilerBundle/Handler/CompilerHandler.php on line 17

Thank you very much!

ps. In your installation guide, commands to enable mod_alias, mod_rewrite, mod_php5 didn't work, I used the following:
a2enmod php5
a2enmod alias
a2enmod rewrite

from compiler.

dastergon avatar dastergon commented on August 9, 2024

I've updated my guide and fixed the mod_ prefixes.

Regarding API setup.

  • Have you set myauthword to authorizationKey key in parameters.yml?
  • Did you cache:clear after you changed your parameters.yml?

Example

  • Lets say we have set githubCompiler as value in authorizationKey.
  • Clean the cache: # php app/console cache:clear --env=prod --no-debug
  • Try: http://your_ip/githubCompiler/v1 and http://your_ip/githubCompiler/v1/status/

Let me know if it works.

For further information see here

from compiler.

weiway avatar weiway commented on August 9, 2024

Yes I did setup the authkey in parameters.yml (which is inside /var/www/compiler/Symphony/app/config/)

I did clean the cache following your command
php app/console cache:clear --env=prod --no-debug returned Clearing the cache for the prod environment with debug false
php app/console cache:clear --env=dev --no-debug returned Clearing the cache for the prod environment with debug true

The results are:
http://myIP/status will return 200 with {"success":true,"status":"OK"}
http://myIP/wrongAuthKey/v1 will return 200 with {"success":false,"step":0,"message":"Invalid authorization key."}
http://myIP/authKey/wrongVersion will return 200 with {"success":false,"step":0,"message":"Invalid API version."}
http://myIP/authKey/v1 will return a 500 error with no message
http://myIP/authKey/v1/status/ will return a 404 error with a html

The error.log inside /var/log/apache2/ has following content for the failed request with 500 error code:
[Thu Sep 10 17:28:45.565717 2015] [:error] [pid 1452] PHP Fatal error: require_once(): Failed opening required 'System.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/compiler/Symfony/src/Codebender/CompilerBundle/Handler/CompilerHandler.php on line 17

which complains the failure of opening System.php

My compiler server is hosted at 52.88.1.188, authKey is code, you can go and see for yourself

from compiler.

weiway avatar weiway commented on August 9, 2024

Any suggestions?

from compiler.

 avatar commented on August 9, 2024

There are some missing steps in the how-to which might cause a confusion to inexperienced people... Anyway... I experienced the same issue as @weiway. The solution seems to be to install php-pear (sudo apt-get install php-pear).

from compiler.

32teeth avatar 32teeth commented on August 9, 2024

i have an issue with the authKey

compiler

{
"success": true,
"status": "OK"
}

compiler with 'thirty' as authKey

404

compiler with 'thirty' as authKey and v1

{
"success": false,
"step": 0,
"message": "Invalid authorization key."
}

yml file

parameters:
    locale: en
    secret: secretcode
    arduino_cores_dir: /opt/codebender/codebender-arduino-core-files
    auth_key: thirty
    myauthword: thirty
    cc: /usr/bin/avr-gcc
    cpp: /usr/bin/avr-g++
    as: /usr/bin/avr-gcc
    ld: /usr/bin/avr-gcc
    clang: /usr/bin/clang
    objcopy: /usr/bin/avr-objcopy
    size: /usr/bin/avr-size
    cflags: '-Os -ffunction-sections -fdata-sections'
    cppflags: '-Os -ffunction-sections -fdata-sections -fno-exceptions'
    asflags: -assembler-with-cpp
    ldflags: '-Os -Wl,--gc-sections'
    ldflags_tail: '-lm -lc'
    clang_flags: '-w -fsyntax-only -fcolor-diagnostics'
    objcopy_flags: '-R .eeprom'
    size_flags: ''
    arduino_skel: main.cpp
    output: output

ran

$ php app/console cache:clear --env=dev --no-debug
$ php app/console cache:clear --env=prod --no-debug
$ sudo service apache2 restart

still getting authKey error

{
"success": false,
"step": 0,
"message": "Invalid authorization key."
}

any insight would be helpful

from compiler.

32teeth avatar 32teeth commented on August 9, 2024

okay, so i've made some progress,
now, if i use postman

endpoint

http://52.55.100.50/thirty/v1

example 1

payload

{
  "board":"Arduino Leonardo",       
  "build":{
      "core":"arduino",
      "f_cpu":"16000000L",
      "mcu":"atmega32u4",
      "pid":"0x8036",
      "variant":"leonardo",         
      "vid":"0x2341"
  },
  "files":[
    {
      "filename":"blank.ino",
      "content":"void setup(){}\nvoid loop(){}"
    }
  ],
  "format":"hex",
  "upload":{
      "disable_flushing":"true",
      "maximum_size":"28672",
      "protocol":"avr109",
      "speed":"57600"
  },
  "version":"105"     
}

results

{
"success": false
"step": 0
"message": "Invalid input."
}

##example 2
payload

{
   "files":[
      {
         "filename":"hello.ino",
         "content":"void setup(){}\nvoid loop(){}"
      }
   ],
   "libraries":{},
   "format":"syntax",
   "version":"105",
   "build":{
      "core":"arduino",
      "f_cpu":"16000000L",
      "mcu":"atmega32u4",
      "pid":"0x8036",
      "variant":"leonardo",         
      "vid":"0x2341"
   }
}

result

{
"success": false
"step": 3
"message": "Failed to detect core files."
}

from compiler.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.